decord/source/modules/user_profile/UserProfileActionCreators.tsx

287 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8424
// Function ID: 8425
2026-07-29 08:29:29 +00:00
// Name: _saveProfileChanges
2026-08-25 06:04:03 +00:00
// Dependencies: [5, 1922, 676, 1924, 1231, 1363, 1236, 698, 8425, 7287, 709, 8426, 530, 4994, 4278, 2]
// Exports: notifyUnsavedUserProfileChangesInModal, pinUserProfileBadgesOnClient, resetAllPendingChanges, resetAllTryItOutChanges, resetPendingProfileChanges, saveProfileChanges, setTryItOutAvatar, setTryItOutAvatarDecoration, setTryItOutBanner, setTryItOutCustomTypingIndicatorStyle, setTryItOutDisplayNameStyles, setTryItOutPreset, setTryItOutProfileEffect, setTryItOutThemeColors
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 8424 (_saveProfileChanges)
2026-08-24 06:08:38 +00:00
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import ComponentDispatcher from "ComponentDispatcher" /* 1231 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import AccessibilityAnnouncer2 from "AccessibilityAnnouncer" /* 1363 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
import GuildFeatures from "GuildFeatures" /* 1924 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
function _saveProfileChanges() {
const self = this;
const tmp = callback((arg0, arg1, arg2) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
c8 = 0;
c9 = 0;
c7 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, arg1, arg2) {
if (c9 === 2) {
c9 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c9 = 2;
if (0 === c8) {
if (arg0 === 1) {
c9 = 3;
throw arg1;
} else if (arg0 === 2) {
c9 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let body2 = tmp3;
2026-08-24 06:08:38 +00:00
closure_4 = tmp7;
2026-07-29 08:29:29 +00:00
let headersForMd5 = callback;
let bannerSurface = id;
callback = id;
id = undefined;
let body;
2026-08-24 06:08:38 +00:00
closure_3 = undefined;
closure_4 = undefined;
const currentUser = closure_1_4.getCurrentUser();
2026-07-29 08:29:29 +00:00
id = undefined;
if (currentUser != null) {
id = currentUser.id;
}
if (null != id) {
let obj7 = callback(body[8]);
let shouldConvertBioEmoji = null != headersForMd5.bio;
if (shouldConvertBioEmoji) {
shouldConvertBioEmoji = obj7.getShouldConvertBioEmoji();
}
if (shouldConvertBioEmoji) {
let obj8 = callback2(body[9]);
headersForMd5.bio = obj8.parse(undefined, headersForMd5.bio).content;
}
2026-08-24 06:08:38 +00:00
c7 = 1;
2026-07-29 08:29:29 +00:00
let obj9 = callback2(body[10]);
2026-08-24 06:08:38 +00:00
obj1 = { type: "USER_PROFILE_UPDATE_START", userId: null, guildId: null };
2026-07-29 08:29:29 +00:00
obj1[1] = id;
obj1[2] = bannerSurface;
obj9.dispatch(obj1);
if (null != bannerSurface) {
const obj2 = { url: null, bannerSurface: null };
obj2[0] = c7.USER_GUILD_PROFILE(bannerSurface, c8);
obj2[1] = callback(body[11]).SafetyScannedUploadSurface.USER_GUILD_PROFILE_BANNER;
let obj3 = obj2;
} else {
obj3 = { url: null, bannerSurface: null };
obj3[0] = c7.USER_PROFILE(c8);
obj3[1] = callback(body[11]).SafetyScannedUploadSurface.USER_DEFAULT_PROFILE_BANNER;
}
bannerSurface = obj3.bannerSurface;
const HTTP = callback(body[12]).HTTP;
let obj4 = { url: null, body: null, headers: null, oldFormErrors: true, rejectWithError: false };
obj4[0] = obj3.url;
obj4[1] = headersForMd5;
const obj5 = {};
obj5[bannerSurface] = tmp71;
headersForMd5 = callback2(body[13]).buildHeadersForMd5(obj5);
obj4[2] = headersForMd5;
HTTP.patch(obj4);
c8 = 2;
c9 = 1;
const obj15 = callback2(body[13]);
} else {
c9 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
tmp71 = body;
}
} else if (1 === tmp7) {
c7 = 0;
body2 = closure_6;
const aPIError = new callback(body[14]).APIError(body2);
2026-08-24 06:08:38 +00:00
closure_3 = aPIError;
2026-07-29 08:29:29 +00:00
body = undefined;
if (body2 != null) {
body = body2.body;
}
2026-08-24 06:08:38 +00:00
closure_3 = body;
2026-07-29 08:29:29 +00:00
if (body == null) {
2026-08-24 06:08:38 +00:00
closure_3 = {};
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
closure_4 = closure_3;
2026-07-29 08:29:29 +00:00
obj4 = id(body[10]);
const obj6 = { type: "USER_PROFILE_UPDATE_FAILURE", guildId: null, errors: null, apiError: null };
obj6[1] = callback;
2026-08-24 06:08:38 +00:00
obj6[2] = closure_4;
obj6[3] = closure_3;
2026-07-29 08:29:29 +00:00
obj4.dispatch(obj6);
c9 = 3;
obj7 = { value: null, done: true };
obj7[0] = body2;
return obj7;
} else if (arg0 === 1) {
c9 = 3;
throw arg1;
} else if (arg0 === 2) {
c7 = 0;
c9 = 3;
obj8 = { value: null, done: true };
obj8[0] = arg1;
return obj8;
} else {
body = arg1;
obj = id(body[10]);
obj9 = { type: "USER_PROFILE_UPDATE_SUCCESS", userId: null, guildId: null };
obj9[1] = id;
obj9[2] = callback;
const merged = Object.assign(body.body);
obj.dispatch(obj9);
c7 = 0;
c9 = 3;
const obj10 = { value: null, done: true };
obj10[0] = body;
return obj10;
}
} catch (tmp62) {
closure_6 = tmp62;
if (tmp4 === c7) {
c9 = tmp2;
throw tmp62;
} else {
c8 = tmp;
}
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_11 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
({ ComponentActions: c5, AnalyticEvents: closure_6, Endpoints: error, ME: closure_8 } = ME);
2026-07-29 08:29:29 +00:00
({ AnalyticsPremiumFeatureTiers: c9, AnalyticsPremiumFeatureNames: c10 } = GuildFeatures);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/user_profile/UserProfileActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const notifyUnsavedUserProfileChangesInModal = function notifyUnsavedUserProfileChangesInModal() {
2026-08-24 06:08:38 +00:00
const ComponentDispatch = ComponentDispatcher.ComponentDispatch;
2026-07-20 16:05:17 +00:00
ComponentDispatch.dispatch(constants.SHAKE_PROFILE_MODAL);
2026-08-24 06:08:38 +00:00
const ComponentDispatch2 = ComponentDispatcher.ComponentDispatch;
2026-07-20 16:05:17 +00:00
ComponentDispatch2.dispatch(constants.EMPHASIZE_NOTICE);
2026-08-24 06:08:38 +00:00
const AccessibilityAnnouncer = AccessibilityAnnouncer2.AccessibilityAnnouncer;
const intl = getSystemLocale.intl;
const intl2 = getSystemLocale.intl;
AccessibilityAnnouncer.announce("" + intl.string(getSystemLocale.t.GP7JLE) + " " + intl2.string(getSystemLocale.t.gKoO1D));
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
export const saveProfileChanges = function saveProfileChanges(closure_8, id2, bannerOriginalMd5) {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _saveProfileChanges.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const pinUserProfileBadgesOnClient = function pinUserProfileBadgesOnClient(items, arg1) {
2026-07-23 10:11:24 +00:00
currentUser = currentUser.getCurrentUser();
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
2026-07-20 16:05:17 +00:00
id = currentUser.id;
}
if (null != id) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "USER_PROFILE_PIN_BADGES_ON_CLIENT", badges: null, ttlInSeconds: null, userId: null };
obj[1] = items;
obj[2] = arg1;
obj[3] = id;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
}
};
export const resetPendingProfileChanges = function resetPendingProfileChanges() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "USER_PROFILE_SETTINGS_RESET_PENDING_PROFILE_CHANGES" });
2026-07-20 16:05:17 +00:00
};
export const resetAllPendingChanges = function resetAllPendingChanges() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "USER_PROFILE_SETTINGS_RESET_PENDING_CHANGES" });
2026-07-20 16:05:17 +00:00
};
2026-07-28 08:39:19 +00:00
export const resetAllTryItOutChanges = function resetAllTryItOutChanges() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "USER_PROFILE_SETTINGS_RESET_TRY_IT_OUT_CHANGES" });
2026-07-28 08:39:19 +00:00
};
2026-08-24 06:08:38 +00:00
export const setTryItOutAvatar = function setTryItOutAvatar(closure_1_4) {
let obj = dispatcherDefault;
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_AVATAR", avatar: closure_1_4 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.ANIMATED_AVATAR, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
export const setTryItOutAvatarDecoration = function setTryItOutAvatarDecoration(avatarDecoration) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_AVATAR_DECORATION", avatarDecoration };
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.AVATAR_DECORATION, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
export const setTryItOutProfileEffect = function setTryItOutProfileEffect(profileEffect) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_PROFILE_EFFECT", profileEffect };
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.PROFILE_EFFECT, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
export const setTryItOutBanner = function setTryItOutBanner(closure_1_8) {
let obj = dispatcherDefault;
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_BANNER", banner: closure_1_8 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.PROFILE_BANNER, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
export const setTryItOutThemeColors = function setTryItOutThemeColors(themeColors) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_THEME_COLORS", themeColors };
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.PROFILE_THEME_COLOR, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
export const setTryItOutDisplayNameStyles = function setTryItOutDisplayNameStyles(displayNameStyles) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_DISPLAY_NAME_STYLES", displayNameStyles };
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.DISPLAY_NAME_STYLES, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};
2026-08-25 06:04:03 +00:00
export const setTryItOutCustomTypingIndicatorStyle = function setTryItOutCustomTypingIndicatorStyle(customTypingIndicatorStyle) {
let obj = dispatcherDefault;
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_CUSTOM_TYPING_INDICATOR_STYLE", customTypingIndicatorStyle };
obj.dispatch(obj);
obj = { feature_name: constants4.TYPING_INDICATOR, feature_tier: constants3.PREMIUM_STANDARD };
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
};
2026-07-20 16:05:17 +00:00
export const setTryItOutPreset = function setTryItOutPreset(arg0) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "USER_PROFILE_SETTINGS_SET_TRY_IT_OUT_PRESET" };
const merged = Object.assign(arg0);
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { feature_name: constants4.PRESET, feature_tier: constants3.PREMIUM_STANDARD };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(constants2.PREMIUM_FEATURE_TRY_OUT, obj);
2026-07-20 16:05:17 +00:00
};