decord/beta/source/modules/notifications/NotificationSettingsUtils.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

130 lines
5.4 KiB
TypeScript

// Module ID: 14011
// Function ID: 14012
// Name: notifications/NotificationSettingsUtils
// Dependencies: [32, 19, 14005, 14012, 14013, 504, 1435, 2]
// Exports: getAssignedNotifSettingsAndMappings, useIsDeclarativeSettingsUIAvailable, useNotifCategoryVisibility, useNotifSettingVisibility
// Module 14011 (notifications/NotificationSettingsUtils)
import NotificationSettingsExperiments from "NotificationSettingsExperiments" /* 14012 */;
import DeclarativeNotificationSettingsRedesignExperiment from "DeclarativeNotificationSettingsRedesignExperiment" /* 14013 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
const require = globalThis.__r;
require = fn;
function getNamedExperiment(experiment) {
const tmp = NotificationSettingsExperiments.knownExperimentConfigs[experiment];
if (tmp.definition.name !== experiment) {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error = new Error("Experiment called " + tmp.definition.name + " assigned to name " + experiment);
throw error;
} else {
return tmp;
}
}
const NotificationSettingsConstants = fn(14005);
({ NOTIF_SETTING_MAPPING: closure_4, NOTIF_SETTINGS: hasOwnProperty } = NotificationSettingsConstants);
const size = fn(2);
let result = size.fileFinishedImporting("modules/notifications/NotificationSettingsUtils.tsx");
export const getAssignedNotifSettingsAndMappings = function getAssignedNotifSettingsAndMappings() {
const settings = [];
const mappings = [];
const result = DeclarativeNotificationSettingsRedesignExperiment.isDeclarativeNotificationSettingsRedesignEnabled("getAssignedNotifSettingsAndMappings");
const set = new Set();
const iter = dependencyMap[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp4 = nextResult;
let redesignState = nextResult.redesignState;
if (null == redesignState) {
if (null != tmp4.experiment) {
let obj3 = getNamedExperiment(tmp4.experiment);
let variations = tmp4.variations;
continue;
}
let arr = settings.push(tmp4);
let addResult = set.add(tmp4.id);
}
continue;
}
const entries = Object.entries(React4);
while (tmp14 !== undefined) {
let tmp17 = _slicedToArray(tmp15, 2);
let tmp18 = tmp17[1];
let _parseInt = parseInt;
let parsed = parseInt(tmp17[0]);
for (const item10071 of tmp18) {
let tmp22 = item10071;
if (set.has(item10071)) {
let obj2 = { notifType: null, notifSetting: null };
obj2.notifType = parsed;
obj2.notifSetting = tmp22;
let arr2 = mappings.push(obj2);
obj4.return();
break;
}
continue;
}
continue;
}
return { settings, mappings };
};
export const useIsDeclarativeSettingsUIAvailable = function useIsDeclarativeSettingsUIAvailable(AndroidMessageNotificationsSetting) {
return DeclarativeNotificationSettingsRedesignExperiment.useIsDeclarativeNotificationSettingsRedesignEnabled("useIsDeclarativeSettingsUIAvailable:" + AndroidMessageNotificationsSetting);
};
export const useNotifCategoryVisibility = function useNotifCategoryVisibility(CATEGORY_OTHER) {
return DeclarativeNotificationSettingsRedesignExperiment.useIsDeclarativeNotificationSettingsRedesignEnabled("useIsDeclarativeSettingsUIAvailable:" + CATEGORY_OTHER);
};
export const useNotifSettingVisibility = function useNotifSettingVisibility(GAMING_DEFAULT) {
_require = GAMING_DEFAULT;
const items = [GAMING_DEFAULT];
const memo = noop.useMemo(() => (function getExperimentAndConfigBySettingId(arg0) {
const iter = dependencyMap[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp3 = nextResult;
if (nextResult.id === arg0) {
let redesignState = tmp3.redesignState;
if (null != tmp3.experiment) {
let obj2 = { redesignState, experiment: null, variations: null };
obj2.experiment = closure_1_6(nextResult.experiment);
obj2.variations = nextResult.variations;
iter.return();
return obj2;
} else if (null != redesignState) {
let obj = { redesignState: null };
obj.redesignState = redesignState;
iter.return();
return obj;
}
}
continue;
}
return {};
})(closure_0), items);
const experiment = memo.experiment;
const variations = memo.variations;
const items1 = [require("ApexExperiment").ApexExperimentStore];
const items2 = [experiment];
const stateFromStores = require("initialize").useStateFromStores(items1, () => {
let config;
if (experiment != null) {
config = experiment.getConfig({ location: "useNotifSettingVisibility" });
}
return config;
}, items2);
let obj = require("initialize");
let isDeclarativeNotificationSettingsRedesignEnabled = require("DeclarativeNotificationSettingsRedesignExperiment").useIsDeclarativeNotificationSettingsRedesignEnabled("useIsDeclarativeSettingsUIAvailable:" + "useNotifSettingVisibility");
if (isDeclarativeNotificationSettingsRedesignEnabled) {
let tmp4 = false !== memo.redesignState;
if (tmp4) {
tmp4 = null == stateFromStores || null == variations || variations.includes(stateFromStores.variation);
let tmp6 = null == stateFromStores || null == variations || variations.includes(stateFromStores.variation);
}
isDeclarativeNotificationSettingsRedesignEnabled = tmp4;
}
return isDeclarativeNotificationSettingsRedesignEnabled;
};