Files
discord-decomp/modules/collectibles/utils/CollectiblesUtils.tsx
T
2026-11-01 12:12:55 +02:00

83 lines
2.4 KiB
TypeScript

// Metro module 5846 (f5847).
import { ApplicationStreamPresets } from "../../go_live/StreamSettingsConstants";
import { MediaEngineContextTypes } from "../../../_bundle/Module4286";
import { ShopVariantsReturnStyle } from "../../../_bundle/Module5847";
import useFractionalPremiumInfo from "../../billing/hooks/useFractionalPremiumInfo";
import { dateFormat } from "../../../utils/DateUtils";
export function constructGoLiveSource(a0, a1, a2) {
const r1 = {
qualityOptions: {
preset: ApplicationStreamPresets.PRESET_CUSTOM,
resolution: a0,
frameRate: a1
},
context: MediaEngineContextTypes.STREAM
};
if (a2 != null) {
if (a2.desktopSource != null) {
r1.desktopSettings = {
sourceId: a2.desktopSource.id,
sound: true
};
}
if (a2.cameraSource != null) {
r1.cameraSettings = {
videoDeviceGuid: a2.cameraSource.videoDeviceGuid,
audioDeviceGuid: a2.cameraSource.audioDeviceGuid
};
}
}
return r1;
}
export function buildFetchCollectiblesOptionsQuery(a0, a1) {
const r3 = {};
if (a1 != null) {
r3.tab = a1;
}
if (a0 != null) {
if (a0.noCache === true) {
r3.no_cache = true;
}
if (a0.includeUnpublished === true) {
r3.include_unpublished = true;
}
if (a0.includeBundles === true) {
r3.include_bundles = true;
}
if (a0.includeDynamicBlocks === true) {
r3.include_dynamic_blocks = true;
}
if (a0.countryCode != null && a0.countryCode !== "") {
r3.country_code = a0.countryCode;
}
if (a0.paymentGateway !== null) {
r3.payment_gateway = a0.paymentGateway;
}
if (a0.variantsReturnStyle === ShopVariantsReturnStyle.VARIANTS_GROUP) {
r3.variants_return_style = ShopVariantsReturnStyle.VARIANTS_GROUP;
}
if (a0.shopHomeConfig != null) {
r3.shop_home_config = a0.shopHomeConfig;
}
if (a0.skipNumCategories != null) {
r3.skip_num_categories = a0.skipNumCategories;
}
}
return r3;
}
export function getOptimizedProfileEffectThumbnailUrl(a0) {
if (a0 != null) {
return `${a0}?width=100&height=195`;
}
}
export function useFetchFractionalPremiumInfo() {
const fractionalPremiumInfo = useFractionalPremiumInfo({
forceFetch: true
});
return {
isLoading: !fractionalPremiumInfo.fetched,
isFractionalPremiumActive: fractionalPremiumInfo.isFractionalPremiumActive,
expiresAt: dateFormat(fractionalPremiumInfo.endsAt, "L")
};
}