decord/source/modules/premium/promotions/PromotionsStore.tsx

470 lines
14 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 6207
2026-07-27 11:26:19 +00:00
// Function ID: 55681
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-25 08:10:48 +00:00
// Dependencies: [6, 7, 15, 17, 18, 1316, 6208, 6210, 6209, 566, 686, 2]
2026-07-20 16:05:17 +00:00
2026-07-25 08:10:48 +00:00
// Module 6207 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_3 from "_isNativeReflectConstruct";
import _possibleConstructorReturn from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _inherits from "_inherits";
import closure_7 from "_isNativeReflectConstruct";
import closure_8 from "_isNativeReflectConstruct";
import closure_9 from "_isNativeReflectConstruct";
const require = arg1;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
function createEmptyPromotionsByType() {
return { [closure_0(closure_1[8]).PromotionTypes.THIRD_PARTY]: {}, [closure_0(closure_1[8]).PromotionTypes.BOGO]: {}, [closure_0(closure_1[8]).PromotionTypes.THIRD_PARTY_DIRECT_FULFILLMENT]: {}, [closure_0(closure_1[8]).PromotionTypes.MARKETING_MOMENT]: {}, [closure_0(closure_1[8]).PromotionTypes.THIRD_PARTY_INBOUND]: {}, [closure_0(closure_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND]: {}, [closure_0(closure_1[8]).PromotionTypes.GIFT_PROMOTION]: {}, [closure_0(closure_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING]: {} };
}
function getLatestActiveOutboundPromotionStartDate() {
2026-07-25 08:10:48 +00:00
const values = Object.values(dependencyMap[require(undefined, 6209) /* CountryListMode */.PromotionTypes.THIRD_PARTY_OUTBOUND]);
2026-07-20 16:05:17 +00:00
let num = 0;
let startDate = null;
let tmp2 = null;
if (0 < values.length) {
do {
let tmp3 = values[num];
let tmp4 = null == startDate || tmp3.startDate > startDate;
if (tmp4) {
startDate = tmp3.startDate;
}
num = num + 1;
tmp2 = startDate;
} while (num < values.length);
}
let toISOStringResult;
if (null != tmp2) {
toISOStringResult = tmp2.toISOString();
}
let tmp6 = null;
if (null != toISOStringResult) {
tmp6 = toISOStringResult;
}
return tmp6;
}
function initializeFromUserSettings() {
const userContent = settings.settings.userContent;
let value;
if (null != userContent) {
if (null != userContent.lastDismissedOutboundPromotionStartDate) {
value = iter.value;
}
}
let tmp2 = null;
if (null != value) {
tmp2 = value;
}
2026-07-23 10:11:24 +00:00
let c18 = tmp2;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let closure_10 = { hasFetchedConsumedInboundPromotionId: false, consumedInboundPromotionId: null, lastSeenOutboundPromotionStartDate: null };
let c11 = null;
let c12 = false;
let c13 = null;
let c14 = false;
let c15 = null;
let c16 = null;
2026-07-20 16:05:17 +00:00
let closure_17 = createEmptyPromotionsByType();
2026-07-23 10:11:24 +00:00
let c18 = null;
let map = new Map();
2026-07-20 16:05:17 +00:00
let closure_20 = [];
2026-07-23 10:11:24 +00:00
let c21 = false;
let tmp3 = ((PersistedStore) => {
2026-07-20 16:05:17 +00:00
class PromotionsStore {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_2(this, PromotionsStore);
obj = outer1_5(PromotionsStore);
tmp2 = outer1_4;
if (outer1_22()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_5;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_5(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback2(PromotionsStore, PersistedStore);
let obj = {
key: "initialize",
value(arg0) {
const self = this;
2026-07-23 10:11:24 +00:00
if (null != arg0) {
const outer1_10 = arg0;
}
self.waitFor(outer1_7);
const items = [outer1_7];
self.syncWith(items, outer1_25);
2026-07-20 16:05:17 +00:00
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , , , , , , , , , , , , , , , , , , , , , , , , , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "outboundPromotions",
get() {
2026-07-23 10:11:24 +00:00
return Object.values(outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND]);
2026-07-20 16:05:17 +00:00
}
};
items[1] = obj;
obj = {
key: "outboundRecurringPromotions",
get() {
2026-07-23 10:11:24 +00:00
return Object.values(outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING]);
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
items[3] = {
key: "lastSeenOutboundPromotionStartDate",
get() {
2026-07-23 10:11:24 +00:00
return outer1_10.lastSeenOutboundPromotionStartDate;
2026-07-20 16:05:17 +00:00
}
};
items[4] = {
key: "lastDismissedOutboundPromotionStartDate",
get() {
2026-07-23 10:11:24 +00:00
return outer1_18;
2026-07-20 16:05:17 +00:00
}
};
items[5] = {
key: "lastFetchedActivePromotions",
get() {
2026-07-23 10:11:24 +00:00
return outer1_15;
2026-07-20 16:05:17 +00:00
}
};
items[6] = {
key: "lastFetchedActivePromotionsLocale",
get() {
2026-07-23 10:11:24 +00:00
return outer1_16;
2026-07-20 16:05:17 +00:00
}
};
items[7] = {
key: "isFetchingActivePromotions",
get() {
2026-07-23 10:11:24 +00:00
return outer1_14;
2026-07-20 16:05:17 +00:00
}
};
items[8] = {
key: "hasFetchedConsumedInboundPromotionId",
get() {
2026-07-23 10:11:24 +00:00
return outer1_10.hasFetchedConsumedInboundPromotionId;
2026-07-20 16:05:17 +00:00
}
};
items[9] = {
key: "consumedInboundPromotionId",
get() {
2026-07-23 10:11:24 +00:00
return outer1_10.consumedInboundPromotionId;
2026-07-20 16:05:17 +00:00
}
};
items[10] = {
key: "bogoPromotion",
get() {
2026-07-23 10:11:24 +00:00
return outer1_11;
2026-07-20 16:05:17 +00:00
}
};
items[11] = {
key: "isFetchingActiveBogoPromotion",
get() {
2026-07-23 10:11:24 +00:00
return outer1_12;
2026-07-20 16:05:17 +00:00
}
};
items[12] = {
key: "lastFetchedActiveBogoPromotion",
get() {
2026-07-23 10:11:24 +00:00
return outer1_13;
2026-07-20 16:05:17 +00:00
}
};
items[13] = {
key: "promotionsByType",
get() {
2026-07-23 10:11:24 +00:00
return outer1_17;
2026-07-20 16:05:17 +00:00
}
};
items[14] = {
key: "getPromotionByTypeAndId",
value(arg0, arg1) {
let tmp2;
2026-07-23 10:11:24 +00:00
if (null != outer1_17[arg0]) {
2026-07-20 16:05:17 +00:00
tmp2 = tmp[arg1];
}
return tmp2;
}
};
items[15] = {
key: "getPromotionByTypeAndKey",
value(arg0, arg1) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
const values = Object.values(outer1_17[arg0]);
return values.find((promotionKey) => promotionKey.promotionKey === closure_0);
2026-07-20 16:05:17 +00:00
}
};
items[16] = {
key: "getState",
value() {
2026-07-23 10:11:24 +00:00
return outer1_10;
2026-07-20 16:05:17 +00:00
}
};
items[17] = {
key: "getMarketingComponentByType",
value(arg0) {
2026-07-23 10:11:24 +00:00
const value = outer1_19.get(arg0);
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != value) {
tmp2 = value;
}
return tmp2;
}
};
items[18] = {
key: "hasPromotion",
value(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
let values = Object.values(outer1_17);
2026-07-20 16:05:17 +00:00
return values.some((arg0) => {
const values = Object.values(arg0);
2026-07-23 10:11:24 +00:00
return values.some((promotionKey) => promotionKey.promotionKey === outer1_0);
2026-07-20 16:05:17 +00:00
});
}
};
items[19] = {
key: "getPromotionsByPartner",
value(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const obj = {};
2026-07-23 10:11:24 +00:00
let values = Object.values(outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND]);
obj.oneTime = values.filter((partnerId) => partnerId.partnerId === closure_0);
values = Object.values(outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING]);
obj.recurring = values.filter((partnerId) => partnerId.partnerId === closure_0);
2026-07-20 16:05:17 +00:00
return obj;
}
};
items[20] = {
key: "getGiftPromotion",
value() {
2026-07-23 10:11:24 +00:00
const tmp = outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.GIFT_PROMOTION];
2026-07-20 16:05:17 +00:00
const keys = Object.keys(tmp);
let tmp2 = null;
if (0 !== keys.length) {
tmp2 = tmp[keys[0]];
}
return tmp2;
}
};
items[21] = {
key: "getGiftPromotionRewardSkuIds",
value() {
const giftPromotion = this.getGiftPromotion();
let rewardSkuIds;
if (null != giftPromotion) {
rewardSkuIds = giftPromotion.rewardSkuIds;
}
if (null == rewardSkuIds) {
rewardSkuIds = [];
}
return rewardSkuIds;
}
};
items[22] = {
key: "getMarketingMomentPromotion",
value() {
2026-07-23 10:11:24 +00:00
const tmp = outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.MARKETING_MOMENT];
2026-07-20 16:05:17 +00:00
const keys = Object.keys(tmp);
if (0 === keys.length) {
return null;
} else {
const _Date = Date;
const date = new Date();
let tmp7 = null;
if (tmp[keys[0]].endDate >= date) {
tmp7 = tmp2;
}
return tmp7;
}
}
};
items[23] = {
key: "getMarketingMomentRewardSkuIds",
value() {
const marketingMomentPromotion = this.getMarketingMomentPromotion();
let rewardSkuIds;
if (null != marketingMomentPromotion) {
rewardSkuIds = marketingMomentPromotion.rewardSkuIds;
}
if (null == rewardSkuIds) {
rewardSkuIds = [];
}
return rewardSkuIds;
}
};
items[24] = {
key: "getActiveBogoRewardPromotion",
value() {
2026-07-23 10:11:24 +00:00
const date = new Date();
const values = Object.values(outer1_17[PromotionsStore(undefined, outer1_1[8]).PromotionTypes.MARKETING_MOMENT]);
2026-07-20 16:05:17 +00:00
const found = values.find((hasBogoReward) => {
hasBogoReward = hasBogoReward.hasBogoReward;
if (hasBogoReward) {
hasBogoReward = hasBogoReward.endDate >= date;
}
return hasBogoReward;
});
let tmp3 = null;
if (null != found) {
tmp3 = found;
}
return tmp3;
}
};
items[25] = {
key: "claimedOutboundPromotionCodes",
get() {
2026-07-23 10:11:24 +00:00
return outer1_20;
2026-07-20 16:05:17 +00:00
}
};
items[26] = {
key: "claimedOutboundPromotionCodesLoaded",
get() {
2026-07-23 10:11:24 +00:00
return outer1_21;
2026-07-20 16:05:17 +00:00
}
};
return callback(PromotionsStore, items);
2026-07-23 10:11:24 +00:00
})(require("initialize").PersistedStore);
2026-07-20 16:05:17 +00:00
tmp3.displayName = "PromotionsStore";
tmp3.persistKey = "PromotionsPersistedStore";
2026-07-23 10:11:24 +00:00
let items = [
2026-07-20 16:05:17 +00:00
(arg0) => {
2026-07-23 10:11:24 +00:00
delete tmp.bogoPromotion;
2026-07-20 16:05:17 +00:00
}
];
tmp3.migrations = items;
2026-07-23 10:11:24 +00:00
tmp3 = new tmp3(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
ACTIVE_PROMOTIONS_FETCH_SUCCESS: function handleActivePromotionsFetchSuccess(promotions) {
promotions = promotions.promotions;
let closure_17 = createEmptyPromotionsByType();
const map = new Map();
2026-07-23 10:11:24 +00:00
let item = promotions.forEach((id) => {
table[id.promotion_type][id.id] = outer1_8.createFromServer(id);
2026-07-20 16:05:17 +00:00
const marketing_components = id.marketing_components;
if (null != marketing_components) {
const item = marketing_components.forEach((component_type) => {
2026-07-23 10:11:24 +00:00
const result = map.set(component_type.component_type, outer2_9.createFromServer(component_type));
2026-07-20 16:05:17 +00:00
});
}
});
let closure_15 = Date.now();
2026-07-23 10:11:24 +00:00
let c14 = false;
2026-07-20 16:05:17 +00:00
if (!obj.hasFetchedConsumedInboundPromotionId) {
obj.hasFetchedConsumedInboundPromotionId = true;
obj.consumedInboundPromotionId = promotions.consumedInboundPromotionId;
}
},
ACTIVE_PROMOTIONS_FETCH: function handleActivePromotionsFetchStart(locale) {
2026-07-23 10:11:24 +00:00
let c14 = true;
2026-07-20 16:05:17 +00:00
locale = locale.locale;
},
ACTIVE_PROMOTIONS_FETCH_FAIL: function handleActivePromotionsFetchFail() {
let closure_17 = createEmptyPromotionsByType();
const map = new Map();
2026-07-23 10:11:24 +00:00
let c14 = false;
2026-07-20 16:05:17 +00:00
},
ACTIVE_PROMOTIONS_CLEAR: function handleActivePromotionsClear() {
let closure_17 = createEmptyPromotionsByType();
const map = new Map();
2026-07-23 10:11:24 +00:00
let c11 = null;
let c14 = false;
2026-07-20 16:05:17 +00:00
let closure_15 = Date.now();
},
ACTIVE_BOGO_PROMOTION_FETCH_SUCCESS: function handleActiveBogoPromotionFetchSuccess(activePromotion) {
let endDate;
let startDate;
activePromotion = activePromotion.activePromotion;
2026-07-23 10:11:24 +00:00
const obj = { id: activePromotion.id, startDate: startDate.toISOString(), endDate: endDate.toISOString() };
2026-07-20 16:05:17 +00:00
({ startDate, endDate } = activePromotion);
let closure_13 = Date.now();
2026-07-23 10:11:24 +00:00
let c12 = false;
2026-07-20 16:05:17 +00:00
},
ACTIVE_BOGO_PROMOTION_FETCH: function handleActiveBogoPromotionFetchStart() {
2026-07-23 10:11:24 +00:00
let c12 = true;
2026-07-20 16:05:17 +00:00
},
ACTIVE_BOGO_PROMOTION_FETCH_FAIL: function handleActiveBogoPromotionFetchFail() {
2026-07-23 10:11:24 +00:00
let c11 = null;
let c12 = false;
2026-07-20 16:05:17 +00:00
},
OUTBOUND_PROMOTION_NOTICE_DISMISS: function handleDismissOutboundPromotionNotice() {
2026-07-25 08:10:48 +00:00
if (0 === Object.values(dependencyMap[require(undefined, 6209) /* CountryListMode */.PromotionTypes.THIRD_PARTY_OUTBOUND]).length) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const tmp2 = getLatestActiveOutboundPromotionStartDate();
if (null != tmp2) {
2026-07-23 10:11:24 +00:00
let c18 = tmp2;
2026-07-20 16:05:17 +00:00
}
}
},
OUTBOUND_PROMOTIONS_SEEN: function handleOutboundPromotionsSeen() {
2026-07-25 08:10:48 +00:00
if (0 === Object.values(dependencyMap[require(undefined, 6209) /* CountryListMode */.PromotionTypes.THIRD_PARTY_OUTBOUND]).length) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const tmp2 = getLatestActiveOutboundPromotionStartDate();
if (null != tmp2) {
2026-07-23 10:11:24 +00:00
let c18 = tmp2;
2026-07-20 16:05:17 +00:00
closure_10.lastSeenOutboundPromotionStartDate = tmp2;
}
}
},
CLAIMED_OUTBOUND_PROMOTION_CODES_FETCH_SUCCESS: function handleClaimedOutboundPromotionCodesFetchSuccess(claimedOutboundPromotionCodes) {
let closure_20 = claimedOutboundPromotionCodes.claimedOutboundPromotionCodes;
2026-07-23 10:11:24 +00:00
let c21 = true;
2026-07-20 16:05:17 +00:00
},
CLAIMED_OUTBOUND_PROMOTION_CODES_FETCH_FAIL: function handleClaimedOutboundPromotionCodesFetchFail() {
let closure_20 = [];
2026-07-23 10:11:24 +00:00
let c21 = true;
2026-07-20 16:05:17 +00:00
},
CLAIMED_OUTBOUND_PROMOTION_CODE_ADD: function handleClaimedOutboundPromotionCodeAdd(claimedOutboundPromotionCode) {
claimedOutboundPromotionCode = claimedOutboundPromotionCode.claimedOutboundPromotionCode;
2026-07-23 10:11:24 +00:00
if (items.some((promotion) => promotion.promotion.id === claimedOutboundPromotionCode.promotion.id)) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-07-23 10:11:24 +00:00
items = [];
const arraySpreadResult = HermesBuiltin.arraySpread(items, 0);
2026-07-20 16:05:17 +00:00
items[arraySpreadResult] = claimedOutboundPromotionCode;
const sum = arraySpreadResult + 1;
}
},
LOGOUT: function handleLogout() {
2026-07-23 10:11:24 +00:00
let closure_10 = { hasFetchedConsumedInboundPromotionId: false, consumedInboundPromotionId: null, lastSeenOutboundPromotionStartDate: null };
let c14 = false;
let c15 = null;
let c12 = false;
let c13 = null;
2026-07-20 16:05:17 +00:00
let closure_17 = createEmptyPromotionsByType();
2026-07-23 10:11:24 +00:00
let c11 = null;
2026-07-20 16:05:17 +00:00
map.clear();
let closure_20 = [];
2026-07-23 10:11:24 +00:00
let c21 = false;
2026-07-20 16:05:17 +00:00
},
PREMIUM_MARKETING_PREVIEW: function handlePremiumMarketingPreview(data) {
data = data.data;
const fromServer = closure_9.createFromServer(data);
const result = map.set(fromServer.componentType, fromServer);
if (null != data.promotion) {
2026-07-23 10:11:24 +00:00
dependencyMap[data.promotion.promotion_type][data.promotion.id] = closure_8.createFromServer(data.promotion);
2026-07-20 16:05:17 +00:00
}
}
});
2026-07-23 10:11:24 +00:00
let result = require("_possibleConstructorReturn").fileFinishedImporting("modules/premium/promotions/PromotionsStore.tsx");
2026-07-20 16:05:17 +00:00
export default tmp3;