117 lines
3.6 KiB
TypeScript
117 lines
3.6 KiB
TypeScript
// Metro module 12774 (f12775).
|
|
import UserOfferStore from "../../../stores/billing/UserOfferStore";
|
|
import { PremiumSubscriptionSKUs } from "../PremiumConstants";
|
|
import { NoticeTypes } from "../../../Constants";
|
|
import { Storage } from "../../../_bundle/Module595";
|
|
import Module3771 from "../../../_bundle/Module3771";
|
|
import Module589 from "../../../_bundle/Module589";
|
|
import Dispatcher from "../../../Dispatcher";
|
|
let c8805_6, c8805_7, c8805_8, isNoticeDismissed, updateNotice;
|
|
const clearDismissUntil = function clearDismissUntil(item) {
|
|
Storage.remove(c8805_8[item] + "-untilAtLeast");
|
|
};
|
|
isNoticeDismissed = function isNoticeDismissed(a0) {
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const r9 = c8805_8[a0];
|
|
if (r9 != null) {
|
|
const r16 = Storage.get(c8805_8[a0] + "-untilAtLeast");
|
|
const r17 = r16 != null ? Module3771(r16) : null;
|
|
if (r17 != null) {
|
|
return r17.isAfter(Module3771());
|
|
}
|
|
}
|
|
let r21 = r9 != null && r9 !== "";
|
|
if (r21) {
|
|
let r30 = Storage.get(r9);
|
|
if (r30 == null) {
|
|
r30 = false;
|
|
}
|
|
r21 = r30;
|
|
}
|
|
return r21;
|
|
};
|
|
updateNotice = function updateNotice() {
|
|
c8805_6 = null;
|
|
for (const item of c8805_7) {
|
|
if (item !== NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING) {
|
|
if (item !== NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING) {
|
|
continue;
|
|
}
|
|
if (!(UserOfferStore.getAlmostExpiringTrialOffersForReminder([PremiumSubscriptionSKUs.TIER_0]).length > 0)) {
|
|
continue;
|
|
}
|
|
if (isNoticeDismissed(NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING)) {
|
|
continue;
|
|
}
|
|
c8805_6 = item;
|
|
break;
|
|
}
|
|
if (!(UserOfferStore.getAlmostExpiringTrialOffersForReminder([PremiumSubscriptionSKUs.TIER_2]).length > 0)) {
|
|
continue;
|
|
}
|
|
if (isNoticeDismissed(NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING)) {
|
|
continue;
|
|
}
|
|
c8805_6 = item;
|
|
break;
|
|
}
|
|
};
|
|
c8805_6 = null;
|
|
c8805_7 = [NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING, NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING];
|
|
const r31 = {};
|
|
r31[NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING] = "hidePremiumTier0TrialEndingReminder";
|
|
r31[NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING] = "hidePremiumTier2TrialEndingReminder";
|
|
c8805_8 = r31;
|
|
class NoticeStore extends Module589.Store {
|
|
static displayName = "NoticeStore";
|
|
initialize() {
|
|
this.syncWith([UserOfferStore], updateNotice);
|
|
this.waitFor(UserOfferStore);
|
|
}
|
|
getNoticeType() {
|
|
return c8805_6;
|
|
}
|
|
}
|
|
const noticeStore = new NoticeStore(Dispatcher, {
|
|
CONNECTION_OPEN: updateNotice,
|
|
CURRENT_USER_UPDATE: updateNotice,
|
|
PREMIUM_PAYMENT_SUBSCRIBE_SUCCESS: updateNotice,
|
|
BILLING_SUBSCRIPTION_UPDATE_SUCCESS: updateNotice,
|
|
BILLING_MOST_RECENT_SUBSCRIPTION_FETCH_SUCCESS: updateNotice,
|
|
BILLING_SUBSCRIPTION_FETCH_SUCCESS: updateNotice,
|
|
LOGOUT: function handleLogout() {
|
|
(function clearStorage() {
|
|
for (const item of c8805_7) {
|
|
const r27 = c8805_8[item];
|
|
if (r27 != null) {
|
|
Storage.remove(r27);
|
|
}
|
|
clearDismissUntil(item);
|
|
}
|
|
})();
|
|
c8805_6 = null;
|
|
},
|
|
NOTICE_DISMISS: function handleNoticeDismiss(a0) {
|
|
if (c8805_6 != null) {
|
|
L8: {
|
|
const untilAtLeast = a0.untilAtLeast;
|
|
if (c8805_6 != null) {
|
|
const r5 = c8805_8[c8805_6];
|
|
if (r5 != null) {
|
|
Storage.set(r5, true);
|
|
}
|
|
if (untilAtLeast != null && r5 != null) {
|
|
Storage.set(c8805_8[c8805_6] + "-untilAtLeast", untilAtLeast.format("YYYY-MM-DDTHH:mm:ss.SSSZ"));
|
|
break L8;
|
|
}
|
|
Storage.remove(c8805_8[c8805_6] + "-untilAtLeast");
|
|
}
|
|
}
|
|
updateNotice();
|
|
}
|
|
}
|
|
});
|
|
export default noticeStore;
|