648 lines
38 KiB
TypeScript
648 lines
38 KiB
TypeScript
/* Metro module 7260; source: modules/premium/PremiumBogoPromotionUtilsCommon.tsx; dependencies: [5, 1878, 3808, 7064, 5181, 7261, 1880, 661, 3738, 3802, 477, 4140, 7035, 7285, 7291, 632, 7062, 7258, 7292, 7293, 4223, 7289, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import SubscriptionStore from '../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import EntitlementStore from '../../stores/game_store/EntitlementStore.tsx'; /* Metro dependency 5181 */
|
|
import UserOfferStore from '../../stores/billing/UserOfferStore.tsx'; /* Metro dependency 7064 */
|
|
import PromotionsStore from './promotions/PromotionsStore.tsx'; /* Metro dependency 7261 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PremiumConstantsModule from './PremiumConstants.tsx'; /* Metro dependency 1880 */
|
|
import * as PlatformUtilsModule from '../../external/discord_common/js/shared/lib/PlatformUtils.tsx'; /* Metro dependency 4140 */
|
|
import * as BlockedPaymentsCountryExperimentModule from '../billing/experiments/BlockedPaymentsCountryExperiment.tsx'; /* Metro dependency 7035 */
|
|
import * as UsePremiumTrialOfferNativeModule from './hooks/usePremiumTrialOffer.native.tsx'; /* Metro dependency 7062 */
|
|
import * as UsePremiumDiscountOfferAndroidModule from './hooks/usePremiumDiscountOffer.android.tsx'; /* Metro dependency 7258 */
|
|
import * as PromotionsHooksModule from './promotions/PromotionsHooks.tsx'; /* Metro dependency 7285 */
|
|
import * as BogoPromotionExperimentModule from './experiments/BogoPromotionExperiment.tsx'; /* Metro dependency 7291 */
|
|
|
|
function _fun58318(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#58318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:6, offset: 0x016c4b1a, size: 323 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const isUserEligibleBasedOnCurrentOrPreviousSubs2 = isUserEligibleBasedOnCurrentOrPreviousSubs;
|
|
const closure2 = function() {
|
|
return _isEligibleForBOGOPromotion.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = PremiumConstantsModule;
|
|
const env0_9 = value.PurchasedFlags;
|
|
const env0_10 = value.PremiumTypes;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_11 = value.PaymentGateways;
|
|
const env0_12 = value.SubscriptionStatusTypes;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/premium/PremiumBogoPromotionUtilsCommon.tsx');
|
|
exports.isUserEligibleBasedOnCurrentOrPreviousSubs = isUserEligibleBasedOnCurrentOrPreviousSubs2;
|
|
exports.useIsEligibleForBogoPromotion = useIsEligibleForBogoPromotion;
|
|
exports.isEligibleForBOGOPromotion = closure2;
|
|
exports.maybeFetchActiveBogoPromotion = function() {
|
|
return _maybeFetchActiveBogoPromotion.apply(this, arguments);
|
|
};
|
|
function isUserEligibleBasedOnCurrentOrPreviousSubs({experimentEnabled, premiumSubscription, mostRecentSubscription, previousPremiumSubscription}) { // fn#58319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:260, offset: 0x016c4c5d, size: 522 bytes, params: 2, frame: 17
|
|
var r0;
|
|
var r1;
|
|
var status;
|
|
var value;
|
|
var endedAt;
|
|
var hasPremiumAtLeast;
|
|
var TIER_2;
|
|
var hasPremiumAtLeast2;
|
|
var subtract;
|
|
var isBefore;
|
|
var hasPremiumAtLeast3;
|
|
var hasPremiumAtLeast4;
|
|
var currentUser;
|
|
var value3;
|
|
var hasActiveTrial;
|
|
var value4;
|
|
var defaultImport;
|
|
var isPremiumExactly;
|
|
var TIER_0;
|
|
var isPremiumExactly2;
|
|
var isAndroid2;
|
|
var paymentGateway;
|
|
var GOOGLE;
|
|
var isMobile;
|
|
var entitlementStoreBinding;
|
|
var isFractionalPremiumActive;
|
|
if (experimentEnabled) {
|
|
if (mostRecentSubscription != null) {
|
|
status = mostRecentSubscription.status;
|
|
value = environment;
|
|
reducibleJoin7: while (true) {
|
|
if (status !== SubscriptionStatusTypes.ENDED) {
|
|
break reducibleJoin7;
|
|
}
|
|
endedAt = mostRecentSubscription.endedAt;
|
|
hasPremiumAtLeast = mostRecentSubscription.hasPremiumAtLeast;
|
|
TIER_2 = PremiumTypes.TIER_2;
|
|
hasPremiumAtLeast2 = Reflect.apply(hasPremiumAtLeast, mostRecentSubscription, [TIER_2]);
|
|
if (endedAt == null) {
|
|
break reducibleJoin7;
|
|
}
|
|
if (hasPremiumAtLeast2) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)();
|
|
subtract = value.subtract;
|
|
value = Reflect.apply(subtract, value, [10, 'days']);
|
|
isBefore = value.isBefore;
|
|
if (Reflect.apply(isBefore, value, [endedAt])) {
|
|
return false;
|
|
}
|
|
break reducibleJoin7;
|
|
}
|
|
break reducibleJoin7;
|
|
}
|
|
}
|
|
if (previousPremiumSubscription != null) {
|
|
status = previousPremiumSubscription.status;
|
|
value = environment;
|
|
reducibleJoin12: while (true) {
|
|
if (status !== SubscriptionStatusTypes.ENDED) {
|
|
break reducibleJoin12;
|
|
}
|
|
endedAt = previousPremiumSubscription.endedAt;
|
|
hasPremiumAtLeast = previousPremiumSubscription.hasPremiumAtLeast;
|
|
TIER_2 = PremiumTypes.TIER_2;
|
|
hasPremiumAtLeast3 = Reflect.apply(hasPremiumAtLeast, previousPremiumSubscription, [TIER_2]);
|
|
if (endedAt == null) {
|
|
break reducibleJoin12;
|
|
}
|
|
if (hasPremiumAtLeast3) {
|
|
value = (importDefault(3738) /* metro dependency 3738 */)();
|
|
subtract = value.subtract;
|
|
value = Reflect.apply(subtract, value, [10, 'days']);
|
|
isBefore = value.isBefore;
|
|
if (Reflect.apply(isBefore, value, [endedAt])) {
|
|
return false;
|
|
}
|
|
break reducibleJoin12;
|
|
}
|
|
break reducibleJoin12;
|
|
}
|
|
}
|
|
if (premiumSubscription != null) {
|
|
hasPremiumAtLeast = premiumSubscription.hasPremiumAtLeast;
|
|
value = environment;
|
|
hasPremiumAtLeast4 = Reflect.apply(hasPremiumAtLeast, premiumSubscription, [PremiumTypes.TIER_2]);
|
|
currentUser = UserStore.getCurrentUser();
|
|
value3 = premiumSubscription == null;
|
|
reducibleJoin15: while (true) {
|
|
if (value3) {
|
|
r0 = value3;
|
|
break reducibleJoin15;
|
|
}
|
|
hasActiveTrial = premiumSubscription.hasActiveTrial;
|
|
value4 = !hasActiveTrial;
|
|
r0 = value4;
|
|
break reducibleJoin15;
|
|
}
|
|
reducibleJoin17: while (true) {
|
|
if (r0) {
|
|
r1 = !r0;
|
|
break reducibleJoin17;
|
|
}
|
|
defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
|
|
isPremiumExactly = defaultImport.isPremiumExactly;
|
|
TIER_0 = PremiumTypes.TIER_0;
|
|
isPremiumExactly2 = Reflect.apply(isPremiumExactly, defaultImport, [currentUser, TIER_0]);
|
|
r1 = isPremiumExactly2;
|
|
break reducibleJoin17;
|
|
}
|
|
isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
|
|
reducibleJoin19: while (true) {
|
|
if (isAndroid2) {
|
|
paymentGateway = premiumSubscription.paymentGateway;
|
|
GOOGLE = PaymentGateways.GOOGLE;
|
|
value = paymentGateway !== GOOGLE;
|
|
r0 = value;
|
|
break reducibleJoin19;
|
|
}
|
|
r0 = isAndroid2;
|
|
break reducibleJoin19;
|
|
}
|
|
reducibleJoin22: while (true) {
|
|
reducibleJoin25: while (true) {
|
|
if (hasPremiumAtLeast4) {
|
|
break reducibleJoin25;
|
|
}
|
|
if (r1) {
|
|
break reducibleJoin25;
|
|
}
|
|
if (r0) {
|
|
break reducibleJoin25;
|
|
}
|
|
break reducibleJoin22;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
value = environment;
|
|
isMobile = (require(4140) /* metro dependency 4140: PlatformUtils */).isMobile;
|
|
reducibleJoin24: while (true) {
|
|
if (isMobile) {
|
|
entitlementStoreBinding = EntitlementStore;
|
|
isFractionalPremiumActive = entitlementStoreBinding.isFractionalPremiumActive;
|
|
value = !Reflect.apply(isFractionalPremiumActive, entitlementStoreBinding, []);
|
|
r0 = value;
|
|
break reducibleJoin24;
|
|
}
|
|
r0 = !isMobile;
|
|
break reducibleJoin24;
|
|
}
|
|
return r0;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function _isEligibleForBOGOPromotion() { // fn#58321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:1082, offset: 0x016c4e67, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun58323).apply(this, arguments);
|
|
async function _fun58323() { // fn#58323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:1159, offset: 0x016c4ea9, size: 575 bytes, params: 1, frame: 22
|
|
var hasFetchedMostRecentPremiumTypeSubscription2;
|
|
var currentUser;
|
|
var value19;
|
|
var value22;
|
|
var mostRecentPremiumTypeSubscription;
|
|
var object;
|
|
let value = a0;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const value4 = undefined;
|
|
let r7 = !(value !== value4) || value;
|
|
await value4;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let binding = env2_4;
|
|
const currentUser2 = binding.getCurrentUser();
|
|
let r2 = currentUser2 != null && currentUser2.isClaimed();
|
|
binding = env2_0;
|
|
const binding2 = env2_2;
|
|
const isPaymentsBlocked = binding(binding2[12]).getIsPaymentsBlocked();
|
|
const bogoPromotionGateEnabled = binding(binding2[14]).getBogoPromotionGateEnabled('bogo eligibility async check');
|
|
const bogoMarketingMaterialsEnabled = binding(binding2[19]).getBogoMarketingMaterialsEnabled('bogo marketing eligibility async check');
|
|
const isMobile = binding(binding2[11]).isMobile;
|
|
const r22 = isMobile ? env2_0(env2_2[10]).isAndroid() : !isMobile;
|
|
if (r2) {
|
|
if (isPaymentsBlocked) {
|
|
return false;
|
|
}
|
|
if (bogoPromotionGateEnabled) {
|
|
if (r7) {
|
|
if (bogoMarketingMaterialsEnabled) {
|
|
if (r22) {
|
|
binding = env2_6;
|
|
if (binding.hasFetchedOffer()) {
|
|
binding = env2_6;
|
|
if (binding.hasAnyUnexpiredOffer()) {
|
|
return false;
|
|
}
|
|
binding = env2_6;
|
|
if (binding.hasAnyUnexpiredDiscountOffer()) {
|
|
return false;
|
|
}
|
|
binding = env2_5;
|
|
hasFetchedMostRecentPremiumTypeSubscription2 = binding.hasFetchedMostRecentPremiumTypeSubscription();
|
|
if (hasFetchedMostRecentPremiumTypeSubscription2) {
|
|
r2 = !hasFetchedMostRecentPremiumTypeSubscription2;
|
|
r7 = value4;
|
|
} else {
|
|
currentUser = env2_4.getCurrentUser();
|
|
r2 = currentUser != null;
|
|
r7 = currentUser;
|
|
}
|
|
r2 = r2 && r7.hasPurchasedFlag(env2_9.PREMIUM_TIER_2);
|
|
if (r2) {
|
|
binding = env2_0;
|
|
value19 = binding(env2_2[20]);
|
|
await value19.fetchMostRecentSubscription();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
hasFetchedMostRecentPremiumTypeSubscription2 = binding.hasFetchedMostRecentPremiumTypeSubscription();
|
|
if (hasFetchedMostRecentPremiumTypeSubscription2) {
|
|
r2 = !hasFetchedMostRecentPremiumTypeSubscription2;
|
|
r7 = value4;
|
|
} else {
|
|
currentUser = env2_4.getCurrentUser();
|
|
r2 = currentUser != null;
|
|
r7 = currentUser;
|
|
}
|
|
r2 = r2 && r7.hasPurchasedFlag(env2_9.PREMIUM_TIER_2);
|
|
if (r2) {
|
|
binding = env2_0;
|
|
value19 = binding(env2_2[20]);
|
|
await value19.fetchMostRecentSubscription();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
if (r22) {
|
|
binding = env2_6;
|
|
if (binding.hasFetchedOffer()) {
|
|
binding = env2_6;
|
|
if (binding.hasAnyUnexpiredOffer()) {
|
|
return false;
|
|
}
|
|
binding = env2_6;
|
|
if (binding.hasAnyUnexpiredDiscountOffer()) {
|
|
return false;
|
|
}
|
|
binding = env2_5;
|
|
hasFetchedMostRecentPremiumTypeSubscription2 = binding.hasFetchedMostRecentPremiumTypeSubscription();
|
|
if (hasFetchedMostRecentPremiumTypeSubscription2) {
|
|
r2 = !hasFetchedMostRecentPremiumTypeSubscription2;
|
|
r7 = value4;
|
|
} else {
|
|
currentUser = env2_4.getCurrentUser();
|
|
r2 = currentUser != null;
|
|
r7 = currentUser;
|
|
}
|
|
r2 = r2 && r7.hasPurchasedFlag(env2_9.PREMIUM_TIER_2);
|
|
if (r2) {
|
|
binding = env2_0;
|
|
value19 = binding(env2_2[20]);
|
|
await value19.fetchMostRecentSubscription();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
hasFetchedMostRecentPremiumTypeSubscription2 = binding.hasFetchedMostRecentPremiumTypeSubscription();
|
|
if (hasFetchedMostRecentPremiumTypeSubscription2) {
|
|
r2 = !hasFetchedMostRecentPremiumTypeSubscription2;
|
|
r7 = value4;
|
|
} else {
|
|
currentUser = env2_4.getCurrentUser();
|
|
r2 = currentUser != null;
|
|
r7 = currentUser;
|
|
}
|
|
r2 = r2 && r7.hasPurchasedFlag(env2_9.PREMIUM_TIER_2);
|
|
if (r2) {
|
|
binding = env2_0;
|
|
value19 = binding(env2_2[20]);
|
|
await value19.fetchMostRecentSubscription();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_5;
|
|
if (binding.hasFetchedSubscriptions()) {
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
binding = env2_0;
|
|
value22 = binding(env2_2[20]);
|
|
await value22.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
mostRecentPremiumTypeSubscription = binding.getMostRecentPremiumTypeSubscription();
|
|
binding = env2_13;
|
|
object = {experimentEnabled: bogoPromotionGateEnabled};
|
|
object.premiumSubscription = env2_5.getPremiumTypeSubscription();
|
|
object.mostRecentSubscription = mostRecentPremiumTypeSubscription;
|
|
object.previousPremiumSubscription = env2_5.getPreviousPremiumTypeSubscription();
|
|
return binding(object);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
function _maybeFetchActiveBogoPromotion() { // fn#58324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:2111, offset: 0x016c50e8, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun58326).apply(this, arguments);
|
|
function* _fun58326() { // fn#58326, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:2194, offset: 0x016c5121, size: 175 bytes, params: 1, frame: 16
|
|
var bogoPromotion;
|
|
var Date;
|
|
var endDate;
|
|
var value5;
|
|
var date;
|
|
var value7;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
yield env2_14(false);
|
|
var value3 = undefined;
|
|
if (false) {
|
|
return value3;
|
|
}
|
|
if (value3) {
|
|
bogoPromotion = env2_8.bogoPromotion;
|
|
if (bogoPromotion == null) {
|
|
value = env2_0(env2_2[21]);
|
|
yield value.fetchActiveBogoPromotion();
|
|
value = undefined;
|
|
return undefined;
|
|
}
|
|
Date = global.Date;
|
|
endDate = bogoPromotion.endDate;
|
|
value5 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
value7 = (date instanceof Object ? date : value5).valueOf();
|
|
Date = global.Date;
|
|
if (value7 >= Date.now()) {
|
|
return undefined;
|
|
}
|
|
value = env2_0(env2_2[21]);
|
|
yield value.fetchActiveBogoPromotion();
|
|
value = undefined;
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function useIsEligibleForBogoPromotion() { // fn#58327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7438:2607, offset: 0x016c51d0, size: 519 bytes, params: 1, frame: 28
|
|
var r1;
|
|
var r0;
|
|
let value = a0;
|
|
const value2 = undefined;
|
|
const r9 = !(value !== value2) || value;
|
|
const value3 = (BlockedPaymentsCountryExperimentModule).useIsPaymentsBlocked();
|
|
const useBogoPromotion = PromotionsHooksModule.useBogoPromotion;
|
|
const promotion = Reflect.apply(useBogoPromotion, PromotionsHooksModule, []).promotion;
|
|
const value4 = (BogoPromotionExperimentModule).useBogoPromotionGateEnabled('bogo eligibility hook');
|
|
const {mostRecentSubscription, premiumSubscription,
|
|
previousPremiumSubscription} = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStoresObject([SubscriptionStore],
|
|
function() {
|
|
var object = {};
|
|
object.mostRecentSubscription = SubscriptionStore.getMostRecentPremiumTypeSubscription();
|
|
object.premiumSubscription = SubscriptionStore.getPremiumTypeSubscription();
|
|
object.previousPremiumSubscription = SubscriptionStore.getPreviousPremiumTypeSubscription();
|
|
return object;
|
|
});
|
|
const value6 = (UsePremiumTrialOfferNativeModule).usePremiumTrialOffer();
|
|
const value7 = (UsePremiumDiscountOfferAndroidModule).usePremiumDiscountOffer();
|
|
let Date = global.Date;
|
|
let r2 = (promotion == null ? value2 : promotion.endDate) ?? 0;
|
|
const value9 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
const date = new Date(r2);
|
|
const value11 = (date instanceof Object ? date : value9).valueOf();
|
|
Date = global.Date;
|
|
const value12 = Date.now();
|
|
const value13 = value12 > value11;
|
|
(importDefault(7292) /* metro dependency 7292: useScheduledForcedUpdate */)({delay: value13 ? -1 : value11 - value12});
|
|
const isMobile = (PlatformUtilsModule).isMobile;
|
|
r2 = isMobile ? (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() : !isMobile;
|
|
const isUserEligibleBasedOnCurrentOrPreviousSubs2 = isUserEligibleBasedOnCurrentOrPreviousSubs({experimentEnabled: value4,
|
|
premiumSubscription: premiumSubscription, mostRecentSubscription: mostRecentSubscription,
|
|
previousPremiumSubscription: previousPremiumSubscription});
|
|
value = require(7293) /* metro dependency 7293: BOGOPromotionMarketingMaterialsExperiments */;
|
|
value = value.useBogoMarketingMaterialsEnabled('bogo marketing eligibility hook');
|
|
if (value13) {
|
|
r0 = !value13;
|
|
} else {
|
|
if (r9) {
|
|
r1 = value;
|
|
} else {
|
|
r2 = r2 && isUserEligibleBasedOnCurrentOrPreviousSubs2;
|
|
r2 = r2 && value6 == null;
|
|
r2 = r2 && promotion != null;
|
|
r2 = r2 && !value3;
|
|
r2 = r2 && value7 == null;
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun58318, 7260, [5, 1878, 3808, 7064, 5181, 7261, 1880, 661, 3738, 3802, 477, 4140, 7035, 7285, 7291,
|
|
632, 7062, 7258, 7292, 7293, 4223, 7289,
|
|
2]) /* metro module 7260, dependencies: [5, 1878, 3808, 7064, 5181, 7261, 1880, 661, 3738, 3802, 477, 4140, 7035, 7285, 7291, 632, 7062, 7258, 7292, 7293, 4223, 7289, 2] */;
|