Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
98 lines
3.8 KiB
TypeScript
98 lines
3.8 KiB
TypeScript
// Module ID: 13624
|
|
// Function ID: 13625
|
|
// Name: GiftingBadgesUtils
|
|
// Dependencies: [8277, 1371, 10832, 13625, 504, 4427, 1943, 2]
|
|
// Exports: getGiftingBadgeProgressPercent, getIsGiftingBadgesDesktopEnabled, useIsEligibleToShowGiftingBadgeCoachmark, useIsGiftingBadgesDesktopEnabled
|
|
|
|
// Module 13624 (GiftingBadgesUtils)
|
|
import initialize from "initialize" /* 504 */;
|
|
import DismissibleContentUnsafeUtils from "DismissibleContentUnsafeUtils" /* 4427 */;
|
|
import BadgeDirectoryStore from "BadgeDirectoryStore" /* 8277 */;
|
|
import GiftingBadgeExperiment2 from "GiftingBadgeExperiment" /* 10832 */;
|
|
import GiftingBadgeDesktopExperiment2 from "GiftingBadgeDesktopExperiment" /* 13625 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let closure_2 = BadgeDirectoryStore.getSingleRequirementThreshold;
|
|
let result = size.fileFinishedImporting("modules/premium/gifting/GiftingBadgesUtils.tsx");
|
|
|
|
export const getGiftingBadgeProgressPercent = function getGiftingBadgeProgressPercent(badgeProgress, currentTier, nextTier) {
|
|
const tmp = closure_2(currentTier);
|
|
const tmp2 = closure_2(nextTier);
|
|
if (null != nextTier) {
|
|
let num6 = 100;
|
|
if (tmp2 > 0) {
|
|
num6 = badgeProgress / tmp2 * 100;
|
|
}
|
|
let num3 = num6;
|
|
} else {
|
|
num3 = 100;
|
|
if (tmp > 0) {
|
|
const _Math = Math;
|
|
num3 = Math.min(tmp, badgeProgress) / tmp * 100;
|
|
}
|
|
}
|
|
return Math.min(Math.max(num3, 0), 100);
|
|
};
|
|
export const useIsGiftingBadgesDesktopEnabled = function useIsGiftingBadgesDesktopEnabled(location) {
|
|
const GiftingBadgeExperiment = GiftingBadgeExperiment2.GiftingBadgeExperiment;
|
|
const enabled = GiftingBadgeExperiment.useConfig({ location }).enabled;
|
|
const GiftingBadgeDesktopExperiment = GiftingBadgeDesktopExperiment2.GiftingBadgeDesktopExperiment;
|
|
let str = "-DISABLED";
|
|
if (enabled) {
|
|
str = "";
|
|
}
|
|
const obj = { location };
|
|
const obj2 = { location: "" + location + str };
|
|
return GiftingBadgeDesktopExperiment.useConfig({ location: "" + location + str }).enabled && enabled;
|
|
};
|
|
export const getIsGiftingBadgesDesktopEnabled = function getIsGiftingBadgesDesktopEnabled(location) {
|
|
const GiftingBadgeExperiment = GiftingBadgeExperiment2.GiftingBadgeExperiment;
|
|
let enabled = GiftingBadgeExperiment.getConfig({ location }).enabled;
|
|
if (enabled) {
|
|
const GiftingBadgeDesktopExperiment = GiftingBadgeDesktopExperiment2.GiftingBadgeDesktopExperiment;
|
|
const obj2 = { location };
|
|
enabled = GiftingBadgeDesktopExperiment.getConfig(obj2).enabled;
|
|
}
|
|
return enabled;
|
|
};
|
|
export const useIsEligibleToShowGiftingBadgeCoachmark = function useIsEligibleToShowGiftingBadgeCoachmark(location) {
|
|
const _location = location.location;
|
|
const GiftingBadgeExperiment = GiftingBadgeExperiment2.GiftingBadgeExperiment;
|
|
const enabled = GiftingBadgeExperiment.useConfig({ location: _location }).enabled;
|
|
const GiftingBadgeDesktopExperiment = GiftingBadgeDesktopExperiment2.GiftingBadgeDesktopExperiment;
|
|
let str = "-DISABLED";
|
|
if ("web" === location.platform) {
|
|
str = "";
|
|
}
|
|
let enabled2 = GiftingBadgeDesktopExperiment.useConfig({ location: "" + _location + str }).enabled;
|
|
let tmp4 = enabled;
|
|
if ("web" === location.platform) {
|
|
if (enabled2) {
|
|
enabled2 = enabled;
|
|
}
|
|
tmp4 = enabled2;
|
|
}
|
|
const obj = { location: "" + _location + str };
|
|
const items = [UserStore];
|
|
const stateFromStores = initialize.useStateFromStores(items, () => {
|
|
currentUser = currentUser.getCurrentUser();
|
|
let flag;
|
|
if (currentUser != null) {
|
|
flag = currentUser.hasHadPremium();
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
});
|
|
const tmpResult = initialize;
|
|
const result = DismissibleContentUnsafeUtils.useIsDismissibleContentDismissed_UNSAFE(tmp(1943).DismissibleContent.NEW_GIFTING_BADGES_COACHMARK);
|
|
if (tmp4) {
|
|
tmp4 = stateFromStores;
|
|
}
|
|
if (tmp4) {
|
|
tmp4 = !result;
|
|
}
|
|
return tmp4;
|
|
};
|