decord/source/modules/premium/powerups/experiments/ServerThemeExperiment.tsx

56 lines
2.6 KiB
TypeScript
Raw Normal View History

// Module ID: 4565
// Function ID: 4566
// Name: ServerThemeExperiment
// Dependencies: [1074, 4550, 4566, 2]
2026-07-20 16:05:17 +00:00
// Exports: getServerThemeEnabled, useServerThemeEnabled
// Module 4565 (ServerThemeExperiment)
import Constants from "Constants" /* 1074 */;
import ServerThemeApexShadowExperiment2 from "ServerThemeApexShadowExperiment" /* 4566 */;
import createExperiment from "module_4550" /* 4550 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const EMPTY_STRING_SNOWFLAKE_ID = Constants.EMPTY_STRING_SNOWFLAKE_ID;
const obj = { kind: "guild", id: "2026-04_server_theme", label: "Server Theme", defaultConfig: { enabled: false, inExperiment: false, gatesApex: false }, treatments: null };
2026-07-29 08:29:29 +00:00
const items = [{ id: 0, label: "Control", config: { enabled: false, inExperiment: true, gatesApex: false } }, { id: 1, label: "Enable Server Theme", config: { enabled: true, inExperiment: true, gatesApex: false } }];
obj.treatments = items;
let experiment = createExperiment.createExperiment(obj);
const result = size.fileFinishedImporting("modules/premium/powerups/experiments/ServerThemeExperiment.tsx");
2026-07-20 16:05:17 +00:00
export const ServerThemeExperiment = experiment;
export const getServerThemeEnabled = function getServerThemeEnabled(guildId, GuildPowerupsConstants) {
const currentConfig = experiment.getCurrentConfig({ guildId, location: GuildPowerupsConstants }, { autoTrackExposure: false });
2026-07-20 16:05:17 +00:00
let enabled = currentConfig.enabled;
if (null != guildId) {
const ServerThemeApexShadowExperiment = ServerThemeApexShadowExperiment2.ServerThemeApexShadowExperiment;
const obj2 = { guildId, location: GuildPowerupsConstants };
let config = ServerThemeApexShadowExperiment.getConfig(obj2);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
config = { enabled: false, gatesApex: false };
2026-07-20 16:05:17 +00:00
}
if (!currentConfig.inExperiment) {
2026-07-29 08:29:29 +00:00
enabled = config.gatesApex && tmp4;
const tmp5 = config.gatesApex && tmp4;
2026-07-20 16:05:17 +00:00
}
return enabled;
};
export const useServerThemeEnabled = function useServerThemeEnabled(guildId, useGuildPowerupNewPerkMarketingVersion) {
experiment = experiment.useExperiment({ guildId, location: useGuildPowerupNewPerkMarketingVersion }, { autoTrackExposure: false });
2026-07-20 16:05:17 +00:00
let enabled = experiment.enabled;
const ServerThemeApexShadowExperiment = ServerThemeApexShadowExperiment2.ServerThemeApexShadowExperiment;
2026-07-20 16:05:17 +00:00
let tmp2 = guildId;
2026-07-29 08:29:29 +00:00
if (guildId == null) {
2026-07-20 16:05:17 +00:00
tmp2 = EMPTY_STRING_SNOWFLAKE_ID;
}
const config = ServerThemeApexShadowExperiment.useConfig({ guildId: tmp2, location: useGuildPowerupNewPerkMarketingVersion });
2026-07-20 16:05:17 +00:00
if (!experiment.inExperiment) {
let tmp6 = null != guildId;
if (tmp6) {
2026-07-29 08:29:29 +00:00
tmp6 = tmp5 && tmp4;
const tmp7 = tmp5 && tmp4;
2026-07-20 16:05:17 +00:00
}
enabled = tmp6;
}
return enabled;
};