Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
297 lines
13 KiB
TypeScript
297 lines
13 KiB
TypeScript
// Module ID: 9508
|
|
// Function ID: 9509
|
|
// Name: PremiumUpsellUtils
|
|
// Dependencies: [19, 1372, 1074, 1374, 21, 9509, 1115, 9510, 9511, 9512, 4483, 9513, 9514, 9515, 5196, 9517, 1980, 7777, 9557, 4695, 1241, 4796, 9589, 2]
|
|
// Exports: getUpsellItems, usePremiumUpsellConfig
|
|
|
|
// Module 9508 (PremiumUpsellUtils)
|
|
import util from "util" /* 1115 */;
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
|
|
import asyncRequireImpl from "asyncRequireImpl" /* 1980 */;
|
|
import PremiumUtils from "PremiumUtils" /* 4483 */;
|
|
import ChatInputUtils from "ChatInputUtils" /* 4695 */;
|
|
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4796 */;
|
|
import _modDef9509 from "module_9509" /* 9509 */;
|
|
import _modDef9510 from "module_9510" /* 9510 */;
|
|
import _modDef9511 from "module_9511" /* 9511 */;
|
|
import _modDef9512 from "module_9512" /* 9512 */;
|
|
import _modDef9513 from "module_9513" /* 9513 */;
|
|
import _modDef9514 from "module_9514" /* 9514 */;
|
|
import PremiumFeaturesCards from "PremiumFeaturesCards" /* 9557 */;
|
|
import openPremiumModalDefault from "openPremiumModal" /* 9589 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import UserStore from "UserStore" /* 1372 */;
|
|
|
|
require = fn;
|
|
function usePremiumUpsellConfig(upsellType, analyticsLocations, analyticsLocation) {
|
|
_require = upsellType;
|
|
closure_1 = analyticsLocations;
|
|
dependencyMap = analyticsLocation;
|
|
const premiumTrialOffer = require("usePremiumTrialOffer").usePremiumTrialOffer();
|
|
let items = [, ];
|
|
({ GLOBAL_EMOJI: arr[0], UPLOAD: arr[1] } = closure_7);
|
|
const set = new Set(items);
|
|
let hasItem = null != premiumTrialOffer;
|
|
if (hasItem) {
|
|
hasItem = set.has(upsellType);
|
|
}
|
|
let tmp4 = hasItem;
|
|
if (hasItem) {
|
|
let skuId;
|
|
if (premiumTrialOffer != null) {
|
|
let subscriptionTrial = premiumTrialOffer.subscriptionTrial;
|
|
if (subscriptionTrial != null) {
|
|
skuId = subscriptionTrial.skuId;
|
|
}
|
|
}
|
|
tmp4 = skuId === TIER_0.TIER_0;
|
|
}
|
|
closure_5 = tmp4;
|
|
const items1 = [upsellType, tmp4];
|
|
const memo = premiumTrialOffer.useMemo(() => {
|
|
if (closure_5) {
|
|
return PremiumFeaturesCards.PremiumFeatureCardOrder.TIER_0_LEADING;
|
|
} else {
|
|
if (constants3.UPLOAD !== closure_0) {
|
|
if (tmp2.ANIMATED_EMOJI !== tmp) {
|
|
if (tmp2.GLOBAL_EMOJI !== tmp) {
|
|
if (tmp2.GLOBAL_STICKER !== tmp) {
|
|
if (tmp2.CUSTOM_PROFILES !== tmp) {
|
|
if (tmp2.PREMIUM_GUILD_PROFILE !== tmp) {
|
|
if (tmp2.APP_ICONS !== tmp) {
|
|
if (tmp2.STREAM_HIGH_QUALITY !== tmp) {
|
|
if (tmp2.SHOP_MEMBER_PRICING !== tmp) {
|
|
if (tmp2.LONGER_MESSAGE !== tmp) {
|
|
if (tmp2.GUILD_CAP !== tmp) {
|
|
const ANIMATED_AVATAR = tmp2.ANIMATED_AVATAR;
|
|
}
|
|
}
|
|
return PremiumFeaturesCards.PremiumFeatureCardOrder.TIER_0_LEADING;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return PremiumFeaturesCards.PremiumFeatureCardOrder.TIER_2_LEADING;
|
|
}
|
|
}, items1);
|
|
const items2 = [memo, analyticsLocations, analyticsLocation];
|
|
const items3 = [tmp4, premiumTrialOffer, hasItem];
|
|
const callback = premiumTrialOffer.useCallback(() => {
|
|
const bestActiveInput = ChatInputUtils.getBestActiveInput();
|
|
if (bestActiveInput != null) {
|
|
bestActiveInput.closeCustomKeyboard();
|
|
}
|
|
AnalyticsUtilsDefault.track(constants.PREMIUM_PROMOTION_OPENED, { location: _location });
|
|
const obj2 = { location: _location };
|
|
ActionSheetActionCreatorsDefault.hideAllActionSheets();
|
|
const obj4 = { analyticsLocation: null, analyticsLocations: null, premiumFeatureCardOrder: null };
|
|
const obj6 = {};
|
|
const merged = Object.assign(_location);
|
|
obj6.object = constants2.BUTTON_CTA;
|
|
obj4.analyticsLocation = obj6;
|
|
let items = closure_1;
|
|
if (closure_1 == null) {
|
|
items = [];
|
|
}
|
|
obj4.analyticsLocations = items;
|
|
obj4.premiumFeatureCardOrder = memo;
|
|
openPremiumModalDefault(obj4);
|
|
}, items2);
|
|
let obj = require("usePremiumTrialOffer");
|
|
return {
|
|
useTier0UpsellContent: tmp4,
|
|
onViewAllPerks: callback,
|
|
getNitroText: premiumTrialOffer.useMemo(() => {
|
|
if (hasItem) {
|
|
let skuId;
|
|
if (premiumTrialOffer != null) {
|
|
const subscriptionTrial = premiumTrialOffer.subscriptionTrial;
|
|
if (subscriptionTrial != null) {
|
|
skuId = subscriptionTrial.skuId;
|
|
}
|
|
}
|
|
if (React6.TIER_0 === skuId) {
|
|
const intl4 = util.intl;
|
|
return intl4.string(util.t.hz78hE);
|
|
} else if (tmp8.TIER_2 === skuId) {
|
|
const intl3 = util.intl;
|
|
return intl3.string(util.t["Gd/XHF"]);
|
|
}
|
|
} else if (closure_5) {
|
|
const intl = util.intl;
|
|
return intl.string(util.t["9CM5v9"]);
|
|
}
|
|
const intl2 = util.intl;
|
|
return intl2.string(util.t.pj0XBN);
|
|
}, items3)
|
|
};
|
|
}
|
|
const Constants = fn(1074);
|
|
({ AnalyticEvents: hasOwnProperty, AnalyticsObjects: metroRequire, UpsellTypes: closure_7 } = Constants);
|
|
const PremiumConstants = fn(1374);
|
|
({ PremiumSubscriptionSKUs: closure_8, PremiumTypes: closure_9 } = PremiumConstants);
|
|
const jsx = fn(21).jsx;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("utils/native/PremiumUpsellUtils.tsx");
|
|
|
|
export default {
|
|
handleShowUpsellAlert(initialUpsellKey) {
|
|
initialUpsellKey = initialUpsellKey.initialUpsellKey;
|
|
let analyticsLocation = initialUpsellKey.analyticsLocation;
|
|
if (undefined === analyticsLocation) {
|
|
analyticsLocation = {};
|
|
}
|
|
let analyticsLocations = initialUpsellKey.analyticsLocations;
|
|
if (undefined === analyticsLocations) {
|
|
analyticsLocations = [];
|
|
}
|
|
let analyticsProperties = initialUpsellKey.analyticsProperties;
|
|
if (undefined === analyticsProperties) {
|
|
analyticsProperties = {};
|
|
}
|
|
({ largestFileSize: UserStore, imageSource: closure_5, isDismissable } = initialUpsellKey);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
if (constants3.UPLOAD === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).isPremiumExactly(currentUser, TIER_2.TIER_2);
|
|
const obj15 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.GLOBAL_EMOJI === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseEmojisEverywhere(currentUser);
|
|
const obj14 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.ANIMATED_AVATAR === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseAnimatedAvatar(currentUser);
|
|
const obj13 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.BADGE === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseBadges(currentUser);
|
|
const obj12 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.ANIMATED_EMOJI === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseAnimatedEmojis(currentUser);
|
|
const obj11 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.EMOJI_AUTOCOMPLETE === initialUpsellKey) {
|
|
const canUseAnimatedEmojisResult = analyticsLocation(analyticsLocations[10]).canUseAnimatedEmojis(currentUser);
|
|
let tmp19 = !canUseAnimatedEmojisResult;
|
|
if (canUseAnimatedEmojisResult) {
|
|
tmp19 = !tmp16(tmp17[10]).canUseEmojisEverywhere(currentUser);
|
|
const tmp16Result = tmp16(tmp17[10]);
|
|
}
|
|
flag = tmp19;
|
|
const obj9 = analyticsLocation(analyticsLocations[10]);
|
|
tmp16 = analyticsLocation;
|
|
tmp17 = analyticsLocations;
|
|
} else if (tmp3.CUSTOM_PROFILES === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUsePremiumProfileCustomization(currentUser);
|
|
const obj8 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.APP_ICONS === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUsePremiumAppIcons(currentUser);
|
|
const obj7 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.GLOBAL_STICKER === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseCustomStickersEverywhere(currentUser);
|
|
const obj6 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.PREMIUM_GUILD_PROFILE === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUsePremiumGuildMemberProfile(currentUser);
|
|
const obj5 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.LONGER_MESSAGE === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseIncreasedMessageLength(currentUser);
|
|
const obj4 = analyticsLocation(analyticsLocations[10]);
|
|
} else if (tmp3.GUILD_CAP === initialUpsellKey) {
|
|
flag = !analyticsLocation(analyticsLocations[10]).canUseIncreasedGuildCap(currentUser);
|
|
const obj3 = analyticsLocation(analyticsLocations[10]);
|
|
} else {
|
|
flag = false;
|
|
if (tmp3.STREAM_HIGH_QUALITY === initialUpsellKey) {
|
|
flag = true;
|
|
}
|
|
}
|
|
}
|
|
if (flag) {
|
|
if (!analyticsLocation(analyticsLocations[13])(initialUpsellKey)) {
|
|
let obj = {
|
|
importer() {
|
|
return asyncRequireImpl(9517, dependencyMap.paths).then((result) => {
|
|
closure_0 = result.default;
|
|
return (arg0) => {
|
|
const obj = {};
|
|
const merged = Object.assign(arg0);
|
|
obj.initialUpsellKey = initialUpsellKey;
|
|
obj.analyticsLocation = analyticsLocation;
|
|
obj.analyticsProperties = analyticsProperties;
|
|
obj.analyticsLocations = analyticsLocations;
|
|
obj.largestFileSize = largestFileSize;
|
|
obj.imageSource = imageSource;
|
|
return <closure_0 />;
|
|
};
|
|
});
|
|
},
|
|
isDismissable: tmp
|
|
};
|
|
tmp31(tmp32[14]).openLazy(obj);
|
|
const tmp31Result = tmp31(tmp32[14]);
|
|
}
|
|
tmp31 = analyticsLocation;
|
|
tmp32 = analyticsLocations;
|
|
}
|
|
},
|
|
usePremiumUpsellConfig
|
|
};
|
|
export const getUpsellItems = function getUpsellItems() {
|
|
const obj = { key: constants3.GLOBAL_EMOJI, image: _modDef9509, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl = util.intl;
|
|
obj.activeTitle = intl.string(util.t.gKtr8N);
|
|
const intl2 = util.intl;
|
|
obj.passiveTitle = intl2.string(util.t.N8ZRNb);
|
|
const intl3 = util.intl;
|
|
obj.description = intl3.format(util.t.rf7Ixp, {});
|
|
const items = [obj, , , , , ];
|
|
const obj2 = { key: constants3.ANIMATED_EMOJI, image: _modDef9510, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl4 = util.intl;
|
|
obj2.activeTitle = intl4.string(util.t.F6rmyq);
|
|
const intl5 = util.intl;
|
|
obj2.passiveTitle = intl5.string(util.t.e4cKNt);
|
|
const intl6 = util.intl;
|
|
obj2.description = intl6.format(util.t.JxTzzb, {});
|
|
items[1] = obj2;
|
|
const obj3 = { key: constants3.ANIMATED_AVATAR, image: _modDef9511, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl7 = util.intl;
|
|
obj3.activeTitle = intl7.string(util.t["tQh+gF"]);
|
|
const intl8 = util.intl;
|
|
obj3.passiveTitle = intl8.string(util.t.HGSXTM);
|
|
const intl9 = util.intl;
|
|
obj3.description = intl9.format(util.t["Tso/Fn"], {});
|
|
items[2] = obj3;
|
|
const obj4 = { key: constants3.UPLOAD, image: _modDef9512, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl10 = util.intl;
|
|
obj4.activeTitle = intl10.string(util.t["1EOZqw"]);
|
|
const intl11 = util.intl;
|
|
obj4.passiveTitle = intl11.string(util.t.tB51W4);
|
|
const intl12 = util.intl;
|
|
const obj5 = { maxUploadStandard: null, maxUploadPremium: null };
|
|
const intl13 = util.intl;
|
|
obj5.maxUploadStandard = intl13.string(util.t.Ll40SK);
|
|
obj5.maxUploadPremium = PremiumUtils.getMaxFileSizeForPremiumType(React7.TIER_2);
|
|
obj4.description = intl12.format(util.t.DUT5IC, obj5);
|
|
items[3] = obj4;
|
|
const obj7 = { key: constants3.BADGE, image: _modDef9513, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl14 = util.intl;
|
|
obj7.activeTitle = intl14.string(util.t["602BK4"]);
|
|
const intl15 = util.intl;
|
|
obj7.passiveTitle = intl15.string(util.t.j0TXTX);
|
|
const intl16 = util.intl;
|
|
obj7.description = intl16.format(util.t["p7i+li"], {});
|
|
items[4] = obj7;
|
|
const obj8 = { key: constants3.APP_ICONS, image: _modDef9514, activeTitle: null, passiveTitle: null, description: null };
|
|
const intl17 = util.intl;
|
|
obj8.activeTitle = intl17.string(util.t["1B1Cyn"]);
|
|
const intl18 = util.intl;
|
|
obj8.passiveTitle = intl18.string(util.t["1B1Cyn"]);
|
|
const intl19 = util.intl;
|
|
obj8.description = intl19.string(util.t.VL5TYT);
|
|
items[5] = obj8;
|
|
return items;
|
|
};
|
|
export { usePremiumUpsellConfig };
|