Files
2026-07-28 01:06:53 +03:00

462 lines
24 KiB
TypeScript

/* Metro module 7261; source: modules/premium/promotions/PromotionsStore.tsx; dependencies: [6, 7, 15, 17, 18, 1348, 7262, 7264, 7263, 566, 694, 2] */
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import UserSettingsProtoStore from '../../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import PromotionRecord from '../../../records/PromotionRecord.tsx'; /* Metro dependency 7262 */
import MarketingComponentRecord from './MarketingComponentRecord.tsx'; /* Metro dependency 7264 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from './constants.tsx'; /* Metro dependency 7263 */
function _fun58330(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#58330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:6, offset: 0x016c5417, size: 625 bytes, params: 8, frame: 21
const env0_0 = require;
const createEmptyPromotionsByType2 = createEmptyPromotionsByType;
const initializeFromUserSettings_58336 = function() {
var r3;
var property = UserSettingsProtoStore.settings.userContent;
var value2 = null;
var value3 = undefined;
r3 = value2 == property || value2 == property.lastDismissedOutboundPromotionStartDate ? value3 : property.lastDismissedOutboundPromotionStartDate.value;
env0_17 = value2 != r3 ? r3 : value2;
return value3;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_10 = {'hasFetchedConsumedInboundPromotionId': false, 'consumedInboundPromotionId': null,
'lastSeenOutboundPromotionStartDate': null};
let env0_16 = createEmptyPromotionsByType2();
let Map = global.Map;
let map = new Map();
let env0_19 = [];
const PersistedStore = (Flux).PersistedStore;
map = _fun58337(PersistedStore);
map.displayName = 'PromotionsStore';
map.persistKey = 'PromotionsPersistedStore';
map.migrations = [function(a0) {
var error;
try {
delete a0.bogoPromotion;
} catch (error) {
}
return a0;
}];
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */,
{ACTIVE_PROMOTIONS_FETCH_SUCCESS: ACTIVE_PROMOTIONS_FETCH_SUCCESS, ACTIVE_PROMOTIONS_FETCH: function() {
env0_14 = true;
}, ACTIVE_PROMOTIONS_FETCH_FAIL: function() {
env0_16 = createEmptyPromotionsByType();
var Map = global.Map;
var value3 = new Map();
env0_14 = false;
}, ACTIVE_PROMOTIONS_CLEAR: function() {
env0_16 = createEmptyPromotionsByType();
var value3 = new global.Map();
env0_11 = null;
env0_14 = false;
env0_15 = global.Date.now();
}, ACTIVE_BOGO_PROMOTION_FETCH_SUCCESS: function({activePromotion}) {
var object = {id: activePromotion.id};
object.startDate = activePromotion.startDate.toISOString();
activePromotion = activePromotion.endDate;
object.endDate = activePromotion.toISOString();
env0_11 = object;
env0_13 = global.Date.now();
env0_12 = false;
}, ACTIVE_BOGO_PROMOTION_FETCH: function() {
env0_12 = true;
}, ACTIVE_BOGO_PROMOTION_FETCH_FAIL: function() {
env0_11 = null;
env0_12 = false;
}, OUTBOUND_PROMOTION_NOTICE_DISMISS: OUTBOUND_PROMOTION_NOTICE_DISMISS,
OUTBOUND_PROMOTIONS_SEEN: OUTBOUND_PROMOTIONS_SEEN,
CLAIMED_OUTBOUND_PROMOTION_CODES_FETCH_SUCCESS: function(a0) {
env0_19 = a0.claimedOutboundPromotionCodes;
env0_20 = true;
}, CLAIMED_OUTBOUND_PROMOTION_CODES_FETCH_FAIL: function() {
env0_19 = [];
env0_20 = true;
}, CLAIMED_OUTBOUND_PROMOTION_CODE_ADD: CLAIMED_OUTBOUND_PROMOTION_CODE_ADD, LOGOUT: LOGOUT_58382,
PREMIUM_MARKETING_PREVIEW: PREMIUM_MARKETING_PREVIEW});
(FileImportTrackerModule).fileFinishedImporting('modules/premium/promotions/PromotionsStore.tsx');
exports.default = map;
function _isNativeReflectConstruct_58331() { // fn#58331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:178, offset: 0x016c5688, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_58331_isNativeReflectConstruct = function() {
return !!result;
})();
}
function createEmptyPromotionsByType() { // fn#58334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:491, offset: 0x016c56e6, size: 244 bytes, params: 1, frame: 15
const {THIRD_PARTY, BOGO, THIRD_PARTY_DIRECT_FULFILLMENT, MARKETING_MOMENT, THIRD_PARTY_INBOUND,
THIRD_PARTY_OUTBOUND, GIFT_PROMOTION,
THIRD_PARTY_OUTBOUND_RECURRING} = (ConstantsModule).PromotionTypes;
return {[THIRD_PARTY]: {}, [BOGO]: {}, [THIRD_PARTY_DIRECT_FULFILLMENT]: {}, [MARKETING_MOMENT]: {},
[THIRD_PARTY_INBOUND]: {}, [THIRD_PARTY_OUTBOUND]: {}, [GIFT_PROMOTION]: {},
[THIRD_PARTY_OUTBOUND_RECURRING]: {}};
}
function getLatestActiveOutboundPromotionStartDate() { // fn#58335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1008, offset: 0x016c57da, size: 161 bytes, params: 1, frame: 17
var r4;
var r5;
var r7;
var r3;
var property;
var value5;
var startDate;
var value6;
var value7;
const Object = global.Object;
const values = Object.values;
const binding = env0_16;
const value = undefined;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND = PromotionTypes.THIRD_PARTY_OUTBOUND;
const value2 = Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND]]);
let length = value2.length;
const value3 = 0;
const value4 = null;
if (value3 < length) {
r4 = value4;
r5 = value3;
while (true) {
property = value2[r5];
value5 = value4 == r4;
if (value5) {
r7 = value5;
} else {
value6 = property.startDate > r4;
r7 = value6;
}
if (!r7) {
continue;
}
startDate = property.startDate;
r4 = startDate;
value7 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
length = value2.length;
if (value7 < length) {
r5 = value7;
continue;
}
r3 = r4;
break;
}
} else {
r3 = value4;
}
const r1 = value4 == r3 ? value : r3.toISOString();
return value4 != r1 ? r1 : value4;
}
function _fun58337(a0) { // fn#58337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1448, offset: 0x016c58c1, size: 617 bytes, params: 2, frame: 16
const PromotionsStore2 = PromotionsStore;
Inherits(PromotionsStore2, a0);
return CreateClass(PromotionsStore2, [{key: 'initialize', value: value_58339}, {key: 'outboundPromotions',
get: get_58340}, {key: 'outboundRecurringPromotions', get: get_58341},
{key: 'lastSeenOutboundPromotionStartDate', get: get_58342}, {key: 'lastDismissedOutboundPromotionStartDate',
get: get_58343}, {key: 'lastFetchedActivePromotions', get: get_58344}, {key: 'isFetchingActivePromotions',
get: get_58345}, {key: 'hasFetchedConsumedInboundPromotionId', get: get_58346},
{key: 'consumedInboundPromotionId', get: get_58347}, {key: 'bogoPromotion', get: get_58348},
{key: 'isFetchingActiveBogoPromotion', get: get_58349}, {key: 'lastFetchedActiveBogoPromotion', get: get_58350},
{key: 'promotionsByType', get: get_58351}, {key: 'getPromotionByTypeAndId', value: value_58352},
{key: 'getPromotionByTypeAndKey', value: value_58353}, {key: 'getState', value: value_58355},
{key: 'getMarketingComponentByType', value: value_58356}, {key: 'getPromotionsByPartner', value: value_58357},
{key: 'getGiftPromotion', value: value_58360}, {key: 'getGiftPromotionRewardSkuIds', value: function() {
var r0;
r0 = this.getGiftPromotion()?.rewardSkuIds;
r0 = r0 ?? [];
return r0;
}}, {key: 'getMarketingMomentPromotion', value: value_58362}, {key: 'getMarketingMomentRewardSkuIds',
value: function() {
var r0;
r0 = this.getMarketingMomentPromotion()?.rewardSkuIds;
r0 = r0 ?? [];
return r0;
}}, {key: 'claimedOutboundPromotionCodes', get: get_58364}, {key: 'claimedOutboundPromotionCodesLoaded',
get: get_58365}]);
function PromotionsStore() { // fn#58338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1460, offset: 0x0123c182, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, PromotionsStore);
const value3 = env1_5(PromotionsStore);
return env1_4(this, _isNativeReflectConstruct_58331() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_58339(a0) { // fn#58339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1753, offset: 0x016c5b2a, size: 69 bytes, params: 2, frame: 14
var value;
if (a0 != null) {
value = environment.__proto__;
env1_10 = a0;
}
this.waitFor(UserSettingsProtoStore);
this.syncWith([UserSettingsProtoStore], initializeFromUserSettings_58336);
}
function get_58340() { // fn#58340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1874, offset: 0x016c5b6f, size: 65 bytes, params: 1, frame: 14
const Object = global.Object;
const values = Object.values;
const binding = env1_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND = PromotionTypes.THIRD_PARTY_OUTBOUND;
return Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND]]);
}
function get_58341() { // fn#58341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:1995, offset: 0x016c5bb0, size: 65 bytes, params: 1, frame: 14
const Object = global.Object;
const values = Object.values;
const binding = env1_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND_RECURRING = PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING;
return Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND_RECURRING]]);
}
function get_58342() { // fn#58342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:2133, offset: 0x016c5bf1, size: 15 bytes, params: 1, frame: 1
return env1_10.lastSeenOutboundPromotionStartDate;
}
function get_58343() { // fn#58343, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1
return env1_17;
}
function get_58344() { // fn#58344, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
return env1_15;
}
function get_58345() { // fn#58345, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
function get_58346() { // fn#58346, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:2432, offset: 0x016c5c00, size: 15 bytes, params: 1, frame: 1
return env1_10.hasFetchedConsumedInboundPromotionId;
}
function get_58347() { // fn#58347, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:2529, offset: 0x016c5c0f, size: 15 bytes, params: 1, frame: 1
return env1_10.consumedInboundPromotionId;
}
function get_58348() { // fn#58348, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
function get_58349() { // fn#58349, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
function get_58350() { // fn#58350, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
return env1_13;
}
function get_58351() { // fn#58351, offset: 0x00df0e94, size: 9 bytes, params: 1, frame: 1
return env1_16;
}
function value_58352(a0, a1) { // fn#58352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:2839, offset: 0x016c5c1e, size: 34 bytes, params: 3, frame: 3
const value = environment.__proto__;
return env1_16[a0]?.[a1];
}
function value_58353(a0, a1) { // fn#58353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:2933, offset: 0x016c5c40, size: 59 bytes, params: 3, frame: 13
var environment;
const env0_0 = a1;
const Object = global.Object;
const values = Object.values;
const value = environment.__proto__;
return Reflect.apply(values, Object, [env1_16[a0]]).find(function({promotionKey}) {
return promotionKey === require;
});
}
function value_58355() { // fn#58355, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1
return env1_10;
}
function value_58356(a0) { // fn#58356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3091, offset: 0x016c5c91, size: 34 bytes, params: 2, frame: 11
let value = environment.__proto__;
value = env1_18.get(a0);
const value2 = null;
return value2 != value ? value : value2;
}
function value_58357(a0) { // fn#58357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3180, offset: 0x016c5cb3, size: 165 bytes, params: 2, frame: 20
var environment;
const env0_0 = a0;
const object = {};
let Object = global.Object;
let values = Object.values;
const value = environment.__proto__;
let binding = env1_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND = PromotionTypes.THIRD_PARTY_OUTBOUND;
object.oneTime = Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND]]).filter(_fun58358);
Object = global.Object;
values = Object.values;
binding = env1_16;
const THIRD_PARTY_OUTBOUND_RECURRING = PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING;
object.recurring = Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND_RECURRING]]).filter(_fun58359);
return object;
function _fun58358({partnerId}) { // fn#58358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3277, offset: 0x016c5d58, size: 22 bytes, params: 2, frame: 2
return partnerId === env0_0;
}
function _fun58359({partnerId}) { // fn#58359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3388, offset: 0x016c5d58, size: 22 bytes, params: 2, frame: 2
return partnerId === env0_0;
}
}
function value_58360() { // fn#58360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3442, offset: 0x016c5d6e, size: 86 bytes, params: 1, frame: 13
let value = environment.__proto__;
const binding = env1_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const GIFT_PROMOTION = PromotionTypes.GIFT_PROMOTION;
const property = binding[GIFT_PROMOTION];
const Object = global.Object;
value = Object.keys(property);
return value.length === 0 ? null : property[value[0]];
}
function value_58362() { // fn#58362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:3734, offset: 0x016c5dec, size: 132 bytes, params: 1, frame: 13
let value = environment.__proto__;
const binding = env1_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const MARKETING_MOMENT = PromotionTypes.MARKETING_MOMENT;
let property = binding[MARKETING_MOMENT];
const Object = global.Object;
value = Object.keys(property);
if (value.length === 0) {
return null;
}
property = property[value[0]];
const endDate = property.endDate;
const Date = global.Date;
let date = new Date();
date = null;
return endDate < date ? date : property;
}
function get_58364() { // fn#58364, offset: 0x00d406a2, size: 9 bytes, params: 1, frame: 1
return env1_19;
}
function get_58365() { // fn#58365, offset: 0x00e4253a, size: 9 bytes, params: 1, frame: 1
return env1_20;
}
}
function ACTIVE_PROMOTIONS_FETCH_SUCCESS({promotions, consumedInboundPromotionId}) { // fn#58367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:4393, offset: 0x016c5eab, size: 143 bytes, params: 2, frame: 15
env0_16 = createEmptyPromotionsByType();
const Map = global.Map;
const map = new Map();
promotions.forEach(_fun58368);
const Date = global.Date;
env0_15 = Date.now();
if (!env0_10.hasFetchedConsumedInboundPromotionId) {
env0_10.hasFetchedConsumedInboundPromotionId = true;
env0_10.consumedInboundPromotionId = consumedInboundPromotionId;
}
function _fun58368(a0) { // fn#58368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:4535, offset: 0x016c5f3a, size: 77 bytes, params: 2, frame: 12
env1_16[a0.promotion_type][a0.id] = PromotionRecord.createFromServer(a0);
const marketing_components = a0.marketing_components;
if (marketing_components != null) {
marketing_components.forEach(_fun58369);
}
function _fun58369(a0) { // fn#58369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:4642, offset: 0x016c5f87, size: 46 bytes, params: 2, frame: 15
const binding = env2_18;
const set = binding.set;
const component_type = a0.component_type;
const marketingComponentRecordBinding = MarketingComponentRecord;
Reflect.apply(set, binding, [component_type, marketingComponentRecordBinding.createFromServer(a0)]);
}
}
}
function OUTBOUND_PROMOTION_NOTICE_DISMISS() { // fn#58376, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:5567, offset: 0x016c60b7, size: 98 bytes, params: 1, frame: 15
const Object = global.Object;
const values = Object.values;
const binding = env0_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND = PromotionTypes.THIRD_PARTY_OUTBOUND;
if (Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND]]).length === 0) {
return false;
}
if (getLatestActiveOutboundPromotionStartDate() == null) {
}
}
function OUTBOUND_PROMOTIONS_SEEN() { // fn#58377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:5791, offset: 0x016c6119, size: 108 bytes, params: 1, frame: 15
const Object = global.Object;
const values = Object.values;
const binding = env0_16;
const PromotionTypes = (ConstantsModule).PromotionTypes;
const THIRD_PARTY_OUTBOUND = PromotionTypes.THIRD_PARTY_OUTBOUND;
if (Reflect.apply(values, Object, [binding[THIRD_PARTY_OUTBOUND]]).length === 0) {
return false;
}
const latestActiveOutboundPromotionStartDate = getLatestActiveOutboundPromotionStartDate();
if (latestActiveOutboundPromotionStartDate != null) {
env0_10.lastSeenOutboundPromotionStartDate = latestActiveOutboundPromotionStartDate;
}
}
function CLAIMED_OUTBOUND_PROMOTION_CODE_ADD({claimedOutboundPromotionCode}) { // fn#58380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:6317, offset: 0x016c61b4, size: 82 bytes, params: 2, frame: 15
const binding = env0_19;
if (binding.some(function(a0) {
return a0.promotion.id === claimedOutboundPromotionCode.promotion.id;
})) {
return false;
}
const binding2 = env0_19;
const items2 = [];
const value2 = arraySpread(items2, binding2, 0, binding);
items2[value2] = claimedOutboundPromotionCode;
value2 + 1;
}
function LOGOUT_58382() { // fn#58382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:6478, offset: 0x016c622c, size: 87 bytes, params: 1, frame: 12
env0_10 = {'hasFetchedConsumedInboundPromotionId': false, 'consumedInboundPromotionId': null,
'lastSeenOutboundPromotionStartDate': null};
env0_16 = createEmptyPromotionsByType();
env0_18.clear();
env0_19 = [];
}
function PREMIUM_MARKETING_PREVIEW({data}) { // fn#58383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7439:6728, offset: 0x016c6283, size: 51 bytes, params: 2, frame: 13
const fromServer = MarketingComponentRecord.createFromServer(data);
const binding = env0_18;
binding.set(fromServer.componentType, fromServer);
}
}
global.__d(_fun58330, 7261, [6, 7, 15, 17, 18, 1348, 7262, 7264, 7263, 566, 694,
2]) /* metro module 7261, dependencies: [6, 7, 15, 17, 18, 1348, 7262, 7264, 7263, 566, 694, 2] */;