Files
discord-decomp/sources/modules/skus/utils/transformSKUTenantMetadata.tsx
T
2026-07-28 01:06:53 +03:00

167 lines
8.6 KiB
TypeScript

/* Metro module 4276; source: modules/skus/utils/transformSKUTenantMetadata.tsx; dependencies: [1904, 2] */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as CollectiblesItemTypeModule from '../../../external/discord_common/js/shared/shared-constants/CollectiblesItemType.tsx'; /* Metro dependency 1904 */
function _fun36253(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#36253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:6, offset: 0x01086b24, size: 148 bytes, params: 8, frame: 18
const env0_0 = require;
const transformCollectiblesItemAssetsFromServer = function(a0) {
if (a0 != null) {
return {staticImagePath: a0.static_image_path, animatedImagePath: a0.animated_image_path,
videoPath: a0.video_path};
}
};
const transformCollectiblesVariantMetadataFromServer = function(a0) {
if (a0 != null) {
return {role: a0.role, baseVariantSkuId: a0.base_variant_sku_id, baseVariantName: a0.base_variant_name,
value: a0.value, label: a0.label, collapseUnder: a0.collapse_under};
}
};
const transformSlayerSKUTenantMetadataFromServer = function(a0) {
var object;
if (a0 != null) {
object = {};
object.carouselItems = a0.carousel_items.map(_fun36260);
object.expiresAt = a0.expires_at != null ? new global.Date() : undefined;
object.cardImageAssetId = a0.card_image_asset_id;
object.cardBackgroundImageAssetId = a0.card_background_image_asset_id;
return object;
}
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/skus/utils/transformSKUTenantMetadata.tsx');
exports.default = transformSKUTenantMetadata;
function transformProfileEffectKeyFrameFromServer({src, loop, height, width, duration, start, loopDelay, position, zIndex, randomizedSources}) { // fn#36255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:215, offset: 0x01086bf6, size: 159 bytes, params: 2, frame: 15
const object = {};
object.src = src;
object.loop = loop;
object.height = height;
object.width = width;
const value = 0;
object.duration = duration ?? value;
object.start = start ?? value;
object.loopDelay = loopDelay;
object.position = position;
object.zIndex = zIndex;
object.randomizedSources = randomizedSources?.map(function({src}) {
return {src: src};
});
return object;
}
function transformCollectiblesItemFromServer(a0) { // fn#36257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:543, offset: 0x01086ca7, size: 516 bytes, params: 2, frame: 16
var type;
var value2;
const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType;
var object;
var effects;
if (a0 != null) {
type = a0.type;
value2 = undefined;
if (CollectiblesItemType.AVATAR_DECORATION === type) {
object = {};
object.id = a0.id;
object.type = a0.type;
object.asset = a0.asset;
object.assets = transformCollectiblesItemAssetsFromServer(a0.assets);
object.label = a0.label;
return object;
}
if (CollectiblesItemType.NAMEPLATE === type) {
object = {};
object.id = a0.id;
object.type = a0.type;
object.asset = a0.asset;
object.assets = transformCollectiblesItemAssetsFromServer(a0.assets);
object.label = a0.label;
object.palette = a0.palette;
return object;
}
if (CollectiblesItemType.PROFILE_EFFECT === type) {
effects = a0.effects;
return {id: a0.id, type: a0.type, title: a0.title, description: a0.description,
accessibilityLabel: a0.accessibilityLabel, animationType: a0.animationType,
staticFrameSrc: a0.staticFrameSrc,
thumbnailPreviewSrc: a0.thumbnailPreviewSrc, reducedMotionSrc: a0.reducedMotionSrc,
effects: effects == null ? value2 : effects.map(transformProfileEffectKeyFrameFromServer)};
}
if (CollectiblesItemType.PROFILE_FRAME === type) {
return {id: a0.id, type: a0.type, label: a0.label, layers: a0.layers, innerWidth: a0.inner_width,
overflowTop: a0.overflow_top, overflowBottom: a0.overflow_bottom,
overflowHorizontal: a0.overflow_horizontal};
}
return value2;
}
}
function transformSlayerSKUTenantMetadataFromServer(a0) { // fn#36259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:1819, offset: 0x01086efe, size: 125 bytes, params: 2, frame: 14
var object;
if (a0 != null) {
object = {};
object.carouselItems = a0.carousel_items.map(function(a0) {
return {thumbnailAssetId: a0.thumbnail_asset_id, assetId: a0.asset_id,
backgroundAssetId: a0.background_asset_id,
youtubeVideoId: a0.youtube_video_id, label: a0.label, labelIconAssetId: a0.label_icon_asset_id,
title: a0.title,
description: a0.description};
});
object.expiresAt = a0.expires_at != null ? new global.Date() : undefined;
object.cardImageAssetId = a0.card_image_asset_id;
object.cardBackgroundImageAssetId = a0.card_background_image_asset_id;
return object;
}
}
function transformCollectiblesSKUTenantMetadataFromServer(a0) { // fn#36261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:2320, offset: 0x01086fd8, size: 181 bytes, params: 2, frame: 16
var r3;
var object;
var transformCollectiblesItemFromServerBinding;
var item;
var value2;
var Date;
var value3;
var date;
if (a0 != null) {
object = {};
object.type = a0.type;
transformCollectiblesItemFromServerBinding = transformCollectiblesItemFromServer;
item = a0.item;
value2 = undefined;
object.item = transformCollectiblesItemFromServerBinding(item);
object.categorySkuId = a0.category_sku_id;
object.premiumType = a0.premium_type;
object.expiresSecondsAfterClaim = a0.expires_seconds_after_claim;
if (a0.expires_at != null) {
Date = global.Date;
value3 = 1000 * a0.expires_at;
date = new Date();
} else {
r3 = value2;
}
object.expiresAt = r3;
object.variant = transformCollectiblesVariantMetadataFromServer(a0.variant);
object.optionSelectorDisplayValue = a0.option_selector_display_value;
return object;
}
}
function transformSKUTenantMetadata(a0) { // fn#36262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:2905, offset: 0x0108708d, size: 64 bytes, params: 2, frame: 14
var object;
if (a0 != null) {
object = {};
object.socialLayer = transformSlayerSKUTenantMetadataFromServer(a0.social_layer);
object.collectibles = transformCollectiblesSKUTenantMetadataFromServer(a0.collectibles);
return object;
}
}
}
function _fun36260({thumbnail_asset_id, asset_id, background_asset_id, youtube_video_id, label, label_icon_asset_id, title, description}) { // fn#36260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4448:1928, offset: 0x01086f7b, size: 93 bytes, params: 2, frame: 3
return {thumbnailAssetId: thumbnail_asset_id, assetId: asset_id, backgroundAssetId: background_asset_id,
youtubeVideoId: youtube_video_id, label: label, labelIconAssetId: label_icon_asset_id, title: title,
description: description};
}
global.__d(_fun36253, 4276, [1904, 2]) /* metro module 4276, dependencies: [1904, 2] */;