decord/alpha/source/records/LibraryApplicationRecord.tsx

172 lines
5.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7114
// Function ID: 7115
// Name: LibraryApplicationRecord
2026-10-12 06:59:38 +00:00
// Dependencies: [1405, 5440, 7111, 1085, 4702, 1403, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7114 (LibraryApplicationRecord)
2026-10-09 10:00:15 +00:00
import FlagUtilsAll from "FlagUtils" /* 1403 */;
2026-10-10 08:08:14 +00:00
import _modDef4702 from "module_4702" /* 4702 */;
2026-10-09 10:00:15 +00:00
import Record from "Record" /* 1405 */;
2026-10-10 08:08:14 +00:00
import ApplicationStore from "ApplicationStore" /* 5440 */;
2026-10-12 06:59:38 +00:00
import EntitlementRecord from "EntitlementRecord" /* 7111 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let hasOwnProperty;
let metroImportDefault;
let metroRequire;
({ LibraryApplicationFlags: hasOwnProperty, Distributors: metroRequire, SKUTypes: metroImportDefault } = Constants);
class LibraryApplicationRecord extends Record {
constructor(isTestMode) {
const tmp = new LibraryApplicationRecord(new.target, this, isTestMode);
({ id: tmp.id, createdAt: tmp.createdAt, flags: tmp.flags, branchId: tmp.branchId, entitlements: tmp.entitlements, branch: tmp.branch, sku: tmp.sku } = isTestMode);
tmp.isTestMode = isTestMode.isTestMode || false;
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
static createFromServer(id) {
let entitlements;
let entitlementsResult;
let mapped;
let obj2;
let prop;
const obj = { id: id.application.id, branchId: id.branch_id, entitlements: mapped, branch: null, flags: null, createdAt: null, sku: obj2 };
const tmp2 = LibraryApplicationRecord;
if (null != id.entitlements) {
entitlements = id.entitlements;
mapped = entitlements.map((item) => EntitlementRecord.createFromServer(item));
} else {
mapped = [];
}
({ branch: obj.branch, flags: obj.flags, created_at: obj.createdAt } = id);
obj2 = { id: id.sku.id, type: id.sku.type, premium: id.sku.premium, preorderReleaseAt: entitlementsResult, preorderApproximateReleaseDate: prop };
entitlementsResult = null;
if (null != id.sku.preorder_release_at) {
2026-10-10 08:08:14 +00:00
entitlements = _modDef4702;
2026-10-03 08:58:59 +00:00
entitlementsResult = entitlements(id.sku.preorder_release_at);
}
prop = null;
if (null != id.sku.preorder_approximate_release_date) {
prop = id.sku.preorder_approximate_release_date;
}
if (typeof tmp2 === "function") {
const self = this;
const self2 = this;
const tmp9 = new LibraryApplicationRecord(tmp, entitlements, tmp3);
({ id: tmp9.id, createdAt: tmp9.createdAt, flags: tmp9.flags, branchId: tmp9.branchId, entitlements: tmp9.entitlements, branch: tmp9.branch, sku: tmp9.sku } = obj);
tmp9.isTestMode = obj.isTestMode || false;
return tmp9;
} else {
throw new TypeError("Trying to call a non-function");
}
}
static createForTestMode(id) {
id = id.id;
const id2 = id.branch.id;
const branch = id.branch;
const ENTITLED = hasOwnProperty.ENTITLED;
const created_at = id.branch.created_at;
const obj = { id: id.skuId, type: metroImportDefault.DURABLE_PRIMARY, premium: false };
if (typeof LibraryApplicationRecord === "function") {
const items = [];
const self = this;
const self2 = this;
const tmp4 = new LibraryApplicationRecord(tmp, tmp2, this, id, created_at, ENTITLED, id2, items, branch);
tmp4.id = id;
tmp4.createdAt = created_at;
tmp4.flags = ENTITLED;
tmp4.branchId = id2;
tmp4.entitlements = items;
tmp4.branch = branch;
tmp4.sku = obj;
tmp4.isTestMode = true;
return tmp4;
} else {
throw new TypeError("Trying to call a non-function");
}
}
getFlags() {
return this.flags;
}
hasFlag(arg0) {
const obj = FlagUtilsAll;
return obj.hasFlag(this.flags, arg0);
}
isHidden() {
return this.hasFlag(hasOwnProperty.HIDDEN);
}
isLegacyOverlayEnabled() {
return !this.hasFlag(hasOwnProperty.OVERLAY_DISABLED);
}
isOverlayV3Enabled() {
return !this.hasFlag(hasOwnProperty.OVERLAY_V3_DISABLED);
}
isOverlayEnabled() {
const self = this;
const tmp = this.isLegacyOverlayEnabled() || self.isOverlayV3Enabled();
return tmp;
}
isMasterBranch() {
return this.branchId === this.id;
}
isDiscordApplication() {
return true;
}
isEntitled(currentUser, SKUStore) {
const self = this;
let closure_1 = currentUser;
let closure_0 = SKUStore;
let someResult = this.isTestMode;
if (!someResult) {
const entitlements = this.entitlements;
someResult = entitlements.some((isValid) => isValid.isValid(currentUser, SKUStore, self.branchId));
}
return someResult;
}
isPreorder() {
return null != this.sku.preorderReleaseAt || null != this.sku.preorderApproximateReleaseDate;
}
getDistributor() {
return metroRequire.DISCORD;
}
getBranchName() {
let str = "master";
if (null != this.branch) {
str = this.branch.name;
}
return str;
}
getBranchedName(name) {
const self = this;
if (!this.isMasterBranch()) {
if (null != self.branch) {
const _HermesInternal = HermesInternal;
name = "" + name.name + " (" + self.branch.name + ")";
}
return name;
}
name = name.name;
}
getSkuIdForAnalytics() {
return this.sku.id;
}
getAnalyticsData() {
let name;
const self = this;
const application = ApplicationStore.getApplication(this.id);
let id = null;
if (null != application) {
id = application.id;
}
const obj = { application_id: id, application_name: name, sku_id: self.getSkuIdForAnalytics(), launcher_platform: self.getDistributor() };
name = null;
if (null != application) {
name = application.name;
}
return obj;
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = LibraryApplicationRecord.prototype;
const result = size.fileFinishedImporting("records/LibraryApplicationRecord.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default LibraryApplicationRecord;