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

102 lines
5.4 KiB
TypeScript

/* Metro module 10344; source: modules/wishlists/WishlistUtils.tsx; dependencies: [57, 10025, 10037, 10038, 661, 6833, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import CollectiblesWishlistItemRecord from './records/CollectiblesWishlistItemRecord.tsx'; /* Metro dependency 10025 */
import PremiumWishlistItemRecord from './records/PremiumWishlistItemRecord.tsx'; /* Metro dependency 10037 */
import SKUWishlistItemRecord from './records/SKUWishlistItemRecord.tsx'; /* Metro dependency 10038 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as CollectiblesWishlistItemRecordModule from './records/CollectiblesWishlistItemRecord.tsx'; /* Metro dependency 10025 */
import * as PremiumWishlistItemRecordModule from './records/PremiumWishlistItemRecord.tsx'; /* Metro dependency 10037 */
import * as SKUWishlistItemRecordModule from './records/SKUWishlistItemRecord.tsx'; /* Metro dependency 10038 */
function _fun80188(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#80188, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10530:6, offset: 0x01e707a0, size: 269 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/wishlists/WishlistUtils.tsx');
exports.wishlistItemFromSKU = wishlistItemFromSKU;
exports.isEligibleWishlistItemOnMobile = isEligibleWishlistItemOnMobile;
exports.buildReorderedWishlistData = buildReorderedWishlistData;
function wishlistItemFromSKU(a0) { // fn#80189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10530:368, offset: 0x01e708ad, size: 119 bytes, params: 2, frame: 13
const productLine = a0.productLine;
const PREMIUM = SKUProductLines.PREMIUM;
return productLine === PREMIUM ? PremiumWishlistItemRecord.fromSKU(a0) : a0.productLine === SKUProductLines.COLLECTIBLES ? CollectiblesWishlistItemRecord.fromSKU(a0) : a0.productLine !== SKUProductLines.SOCIAL_LAYER_GAME_ITEM ? null : SKUWishlistItemRecord.fromSKU(a0);
}
function isEligibleWishlistItemOnMobile(a0, {isWishlistOwner, isSocialLayerStorefrontMobilePurchasingEnabled}) { // fn#80190, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10530:583, offset: 0x01e70924, size: 141 bytes, params: 3, frame: 16
var r0;
var r2;
var r1;
var value;
if (isSKUWishlistItemRecord(a0)) {
if (a0.sku.productLine === SKUProductLines.SOCIAL_LAYER_GAME_ITEM) {
if (isSocialLayerStorefrontMobilePurchasingEnabled) {
if (isWishlistOwner) {
r2 = isWishlistOwner;
} else {
value = require(6833) /* metro dependency 6833: StorefrontUtils */;
value = value.isSlayerSkuAvailableOnThisPlatform(a0.sku);
r2 = value;
}
r1 = r2;
} else {
r1 = !!isSocialLayerStorefrontMobilePurchasingEnabled;
}
r0 = r1;
} else {
r0 = isCollectiblesWishlistItemRecord(a0) || isPremiumWishlistItemRecord(a0);
}
} else {
r0 = isCollectiblesWishlistItemRecord(a0) || isPremiumWishlistItemRecord(a0);
}
return r0;
}
function buildReorderedWishlistData(a0, a1, a2, a3) { // fn#80191, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10530:854, offset: 0x01e709b1, size: 261 bytes, params: 5, frame: 21
var r10;
var skuId;
var r2;
var r1;
var r5;
var property;
var value;
var value2;
var value3;
var value4;
if (a2 < a3) {
property = a1[a3];
value = null;
value3 = undefined;
skuId = value == property ? value3 : property.skuId;
r5 = value != skuId ? skuId : value;
property = a1[a3 + 1];
value4 = value == property;
skuId = value4 ? value3 : property.skuId;
r1 = value != skuId ? skuId : value;
r2 = r5;
r10 = value4;
} else {
property = a1[a3 - 1];
value = null;
value2 = undefined;
skuId = value == property ? value2 : property.skuId;
r2 = value != skuId ? skuId : value;
property = a1[a3];
skuId = value == property ? value2 : property.skuId;
r1 = value != skuId ? skuId : value;
}
const items2 = [];
arraySpread(items2, a1, 0, r10);
items2.splice(a3, 0, Module00057(items2.splice(a2, 1), 1)[0]);
const object = {};
object.newWishlistData = a0.set('items', items2);
object.previousSkuId = r2;
object.nextSkuId = r1;
return object;
}
}
global.__d(_fun80188, 10344, [57, 10025, 10037, 10038, 661, 6833,
2]) /* metro module 10344, dependencies: [57, 10025, 10037, 10038, 661, 6833, 2] */;