61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
// Metro module 5796 (f5797).
|
|
import { b64ToPreloadedUserSettingsProto, mergeTopLevelFields } from "../user_settings/UserSettingsUtils";
|
|
import { PreloadedUserSettings } from "../../_bundle/Module1306";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let c3609_2 = false;
|
|
let c3609_3 = {};
|
|
let c3609_4 = {};
|
|
class FamilyCenterControlledSettingsStore extends Module589.Store {
|
|
static displayName = "FamilyCenterControlledSettingsStore";
|
|
getSettings(a0) {
|
|
return c3609_3[a0];
|
|
}
|
|
getControlledSettings(a0) {
|
|
return c3609_3[a0];
|
|
}
|
|
hasSettingsForUser(a0) {
|
|
return c3609_3[a0] != null;
|
|
}
|
|
getConsents(a0) {
|
|
return c3609_4[a0];
|
|
}
|
|
hasConsented(a0, a1) {
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const r4 = c3609_4[a0];
|
|
return r4 != null && (r4[a1] != null && r4[a1].consented);
|
|
}
|
|
get isLoading() {
|
|
return c3609_2;
|
|
}
|
|
}
|
|
const familyCenterControlledSettingsStore = new FamilyCenterControlledSettingsStore(Dispatcher, {
|
|
FAMILY_CENTER_TEEN_SETTINGS_FETCH_START: function handleTeenSettingsFetchStart() {
|
|
c3609_2 = true;
|
|
},
|
|
FAMILY_CENTER_TEEN_SETTINGS_AND_CONSENTS_FETCH_SUCCESS: function handleTeenSettingsAndConsentsFetchSuccess({ userId, settings, consents }) {
|
|
if (settings != null) {
|
|
c3609_3[userId] = b64ToPreloadedUserSettingsProto(settings);
|
|
}
|
|
if (consents != null) {
|
|
c3609_4[userId] = consents;
|
|
}
|
|
c3609_2 = false;
|
|
},
|
|
FAMILY_CENTER_TEEN_CONSENTS_UPDATE_SUCCESS: function handleTeenConsentsUpdateSuccess(a0) {
|
|
c3609_4[a0.userId] = a0.consents;
|
|
},
|
|
FAMILY_CENTER_TEEN_UPDATE_SETTINGS_SUCCESS: function handleTeenUpdateSettingsSuccess(a0) {
|
|
const userId = a0.userId;
|
|
c3609_3[userId] = mergeTopLevelFields(PreloadedUserSettings, c3609_3[userId], b64ToPreloadedUserSettingsProto(a0.settings));
|
|
},
|
|
LOGOUT: function handleLogout() {
|
|
c3609_3 = {};
|
|
c3609_4 = {};
|
|
c3609_2 = false;
|
|
}
|
|
});
|
|
export default familyCenterControlledSettingsStore;
|