Files
discord-decomp/sources/modules/premium/native/NoticeStore.tsx
T
2026-07-27 16:20:00 +03:00

332 lines
13 KiB
TypeScript

/* Metro module 12566; source: modules/premium/native/NoticeStore.tsx; dependencies: [6, 7, 15, 17, 18, 7064, 1880, 661, 587, 3738, 566, 694, 2] */
function _fun96239(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:6, offset: 0x021588d9, size: 532 bytes, params: 8, frame: 21
const env0_0 = require;
const _arrayLikeToArray_96245 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const clearDismissUntil = function(a0) {
var Storage = require(dependencyMap[8]).Storage;
Storage.remove(dismissUntilStorageKey(a0));
};
const closure = CONNECTION_OPEN_96250;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const userOfferStore = importDefault(7064) /* metro dependency 7064: UserOfferStore */;
const env0_9 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumSubscriptionSKUs;
const NoticeTypes = (require(661) /* metro dependency 661: Constants */).NoticeTypes;
let PREMIUM_TIER_2_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING;
object = [PREMIUM_TIER_2_TRIAL_ENDING];
let PREMIUM_TIER_0_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING;
object[1] = PREMIUM_TIER_0_TRIAL_ENDING;
object = {};
PREMIUM_TIER_0_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING;
object[PREMIUM_TIER_0_TRIAL_ENDING] = 'hidePremiumTier0TrialEndingReminder';
PREMIUM_TIER_2_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING;
object[PREMIUM_TIER_2_TRIAL_ENDING] = 'hidePremiumTier2TrialEndingReminder';
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
let value = _fun96251(Store);
value.displayName = 'NoticeStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: closure,
CURRENT_USER_UPDATE: closure, PREMIUM_PAYMENT_SUBSCRIBE_SUCCESS: closure,
BILLING_SUBSCRIPTION_UPDATE_SUCCESS: closure, BILLING_MOST_RECENT_SUBSCRIPTION_FETCH_SUCCESS: closure,
BILLING_SUBSCRIPTION_FETCH_SUCCESS: closure, LOGOUT: LOGOUT_96255, NOTICE_DISMISS: NOTICE_DISMISS});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/NoticeStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_96240() { // fn#96240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:218, offset: 0x02158aed, size: 98 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_96240_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_96243(a0, a1) { // fn#96243, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:411, offset: 0x02158b4f, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun96244;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_96245(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_96245(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_96245(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun96244;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function dismissUntilStorageKey(a0) { // fn#96246, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:1540, offset: 0x02158cc3, size: 26 bytes, params: 2, frame: 2
return env0_13[a0] + '-untilAtLeast';
}
function dismissNotice(a0, a1) { // fn#96248, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:1684, offset: 0x02158d15, size: 160 bytes, params: 3, frame: 17
var property;
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
if (a0 != null) {
property = env0_13[a0];
if (property != null) {
Storage.set(property, true);
}
if (a1 == null) {
clearDismissUntil(a0);
} else if (property != null) {
Storage.set(dismissUntilStorageKey(a0), a1.format('YYYY-MM-DDTHH:mm:ss.SSSZ'));
} else {
clearDismissUntil(a0);
}
}
}
function isNoticeDismissed(a0) { // fn#96249, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:1931, offset: 0x02158db5, size: 224 bytes, params: 2, frame: 17
var r2;
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
var value7;
let value = null;
if (value == a0) {
return false;
}
const property = env0_13[a0];
if (value != property) {
var value3 = Storage.get(dismissUntilStorageKey(a0));
r2 = value != value3 ? (importDefault(3738) /* metro dependency 3738 */)(value3) : value;
if (value != r2) {
return r2.isAfter((importDefault(3738) /* metro dependency 3738 */)());
}
}
let r1 = value != property && property !== '';
if (r1) {
value7 = Storage.get(property);
value = value != value7;
r1 = value && value7;
}
return r1;
}
function BILLING_MOST_RECENT_SUBSCRIPTION_FETCH_SUCCESS_96250() { // fn#96250, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:2231, offset: 0x02158e95, size: 237 bytes, params: 1, frame: 18
var r2;
var value4;
var PREMIUM_TIER_2_TRIAL_ENDING;
var PREMIUM_TIER_0_TRIAL_ENDING;
var getAlmostExpiringTrialOffersForReminder;
var TIER_0;
var length;
var isNoticeDismissedBinding;
var TIER_2;
var value5;
const value2 = _createForOfIteratorHelperLoose_96243(env0_12);
const value3 = value2();
let done = value3.done;
if (!done) {
r2 = value3;
reducibleLoop1: while (true) {
value4 = r2.value;
PREMIUM_TIER_2_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING;
if (value4 === PREMIUM_TIER_2_TRIAL_ENDING) {
getAlmostExpiringTrialOffersForReminder = UserOfferStore.getAlmostExpiringTrialOffersForReminder;
TIER_2 = PremiumSubscriptionSKUs.TIER_2;
length = Reflect.apply(getAlmostExpiringTrialOffersForReminder, UserOfferStore, [[TIER_2]]).length;
reducibleJoin9: while (true) {
if (length > 0) {
isNoticeDismissedBinding = isNoticeDismissed;
PREMIUM_TIER_2_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING;
if (isNoticeDismissedBinding(PREMIUM_TIER_2_TRIAL_ENDING)) {
break reducibleJoin9;
}
env0_11 = value4;
break reducibleLoop1;
}
break reducibleJoin9;
}
} else {
PREMIUM_TIER_0_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING;
reducibleJoin9: while (true) {
if (value4 !== PREMIUM_TIER_0_TRIAL_ENDING) {
break reducibleJoin9;
}
getAlmostExpiringTrialOffersForReminder = UserOfferStore.getAlmostExpiringTrialOffersForReminder;
TIER_0 = PremiumSubscriptionSKUs.TIER_0;
length = Reflect.apply(getAlmostExpiringTrialOffersForReminder, UserOfferStore, [[TIER_0]]).length;
if (length > 0) {
isNoticeDismissedBinding = isNoticeDismissed;
PREMIUM_TIER_0_TRIAL_ENDING = NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING;
if (isNoticeDismissedBinding(PREMIUM_TIER_0_TRIAL_ENDING)) {
break reducibleJoin9;
}
env0_11 = value4;
break reducibleLoop1;
}
break reducibleJoin9;
}
}
value5 = value2();
done = value5.done;
if (done) {
break reducibleLoop1;
}
r2 = value5;
continue reducibleLoop1;
}
}
}
function _fun96251(a0) { // fn#96251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:2686, offset: 0x02158f82, size: 97 bytes, params: 2, frame: 16
const closure = NoticeStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'initialize', value: function() {
this.syncWith([UserOfferStore], CONNECTION_OPEN_96250);
this.waitFor(UserOfferStore);
}}, {key: 'getNoticeType', value: value_96254}]);
}
function LOGOUT_96255() { // fn#96255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:3423, offset: 0x02159018, size: 116 bytes, params: 1, frame: 18
var r4;
var value4;
var property;
var Storage;
var value5;
const value2 = _createForOfIteratorHelperLoose_96243(env0_12);
const value3 = value2();
let done = value3.done;
if (!done) {
r4 = value3;
while (true) {
value4 = r4.value;
property = env0_13[value4];
if (property != null) {
Storage = (require(587) /* metro dependency 587: Storage */).Storage;
Storage.remove(property);
}
clearDismissUntil(value4);
value5 = value2();
done = value5.done;
if (done) {
break;
}
r4 = value5;
continue;
}
}
}
function NOTICE_DISMISS(a0) { // fn#96256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12756:3640, offset: 0x0215908c, size: 50 bytes, params: 2, frame: 14
if (env0_11 != null) {
dismissNotice(env0_11, a0.untilAtLeast);
CONNECTION_OPEN_96250();
}
}