255 lines
6.8 KiB
TypeScript
255 lines
6.8 KiB
TypeScript
// Metro module 5809 (f5810).
|
|
import _slicedToArray from "../../../_bundle/_slicedToArray";
|
|
import { isProfileEffectRecord } from "../records/ProfileEffectRecord";
|
|
import { CurrencyCodes, PriceSetAssignmentPurchaseTypes } from "../../../Constants";
|
|
import { CollectiblesItemType } from "../../../_bundle/Module1901";
|
|
let $mk77177 = function() {
|
|
return (a0) => a0.currency === CurrencyCodes.DISCORD_ORB;
|
|
}, $mk77178 = function() {
|
|
return (a0) => a0.currency !== CurrencyCodes.DISCORD_ORB;
|
|
};
|
|
export function getProductOrbPrice(a0) {
|
|
const r12 = a0.product.prices[a0.hasShopDiscount ? PriceSetAssignmentPurchaseTypes.PREMIUM_TIER_2 : PriceSetAssignmentPurchaseTypes.DEFAULT];
|
|
const r4 = r12 == null;
|
|
let r13 = void 0;
|
|
if (!r4) {
|
|
const countryPrices = r12.countryPrices;
|
|
const r15 = countryPrices == null;
|
|
r13 = void 0;
|
|
if (!r15) {
|
|
const prices = countryPrices.prices;
|
|
r13 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r13 == null) {
|
|
r13 = [];
|
|
}
|
|
let r21 = r13.find($mk77177());
|
|
if (r21 == null) {
|
|
r21 = null;
|
|
}
|
|
return r21;
|
|
}
|
|
export function getProductFiatPrice(a0) {
|
|
const r12 = a0.product.prices[a0.hasShopDiscount ? PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2 : PriceSetAssignmentPurchaseTypes.MOBILE];
|
|
const r4 = r12 == null;
|
|
let r13 = void 0;
|
|
if (!r4) {
|
|
const countryPrices = r12.countryPrices;
|
|
const r15 = countryPrices == null;
|
|
r13 = void 0;
|
|
if (!r15) {
|
|
const prices = countryPrices.prices;
|
|
r13 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r13 == null) {
|
|
r13 = [];
|
|
}
|
|
let r21 = r13.find($mk77178());
|
|
if (r21 == null) {
|
|
r21 = null;
|
|
}
|
|
return r21;
|
|
}
|
|
export function getHasOrbPrice(a0) {
|
|
const r11 = a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT];
|
|
const r4 = r11 == null;
|
|
let r12 = void 0;
|
|
if (!r4) {
|
|
const countryPrices = r11.countryPrices;
|
|
const r14 = countryPrices == null;
|
|
r12 = void 0;
|
|
if (!r14) {
|
|
const prices = countryPrices.prices;
|
|
r12 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r12 == null) {
|
|
r12 = [];
|
|
}
|
|
let r19 = r12.find($mk77177());
|
|
if (r19 == null) {
|
|
r19 = null;
|
|
}
|
|
return r19 != null;
|
|
}
|
|
export function getHasNonOrbPrice(a0) {
|
|
const r11 = a0.prices[PriceSetAssignmentPurchaseTypes.MOBILE];
|
|
const r4 = r11 == null;
|
|
let r12 = void 0;
|
|
if (!r4) {
|
|
const countryPrices = r11.countryPrices;
|
|
const r14 = countryPrices == null;
|
|
r12 = void 0;
|
|
if (!r14) {
|
|
const prices = countryPrices.prices;
|
|
r12 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r12 == null) {
|
|
r12 = [];
|
|
}
|
|
let r19 = r12.find($mk77178());
|
|
if (r19 == null) {
|
|
r19 = null;
|
|
}
|
|
return r19 != null;
|
|
}
|
|
export function isOrbsExclusiveProduct(a0) {
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const r12 = a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT];
|
|
const r3 = r12 == null;
|
|
let r11 = void 0;
|
|
if (!r3) {
|
|
const countryPrices = r12.countryPrices;
|
|
const r14 = countryPrices == null;
|
|
r11 = void 0;
|
|
if (!r14) {
|
|
const prices = countryPrices.prices;
|
|
r11 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r11 == null) {
|
|
r11 = [];
|
|
}
|
|
let r20 = r11.find($mk77177());
|
|
if (r20 == null) {
|
|
r20 = null;
|
|
}
|
|
let r21 = r20 != null;
|
|
const r24 = a0.prices[PriceSetAssignmentPurchaseTypes.MOBILE];
|
|
const r5 = r24 == null;
|
|
let r25 = void 0;
|
|
if (!r5) {
|
|
const countryPrices2 = r24.countryPrices;
|
|
const r27 = countryPrices2 == null;
|
|
r25 = void 0;
|
|
if (!r27) {
|
|
const prices2 = countryPrices2.prices;
|
|
r25 = prices2 == null ? void 0 : prices2.slice(0, 2);
|
|
}
|
|
}
|
|
if (r25 == null) {
|
|
r25 = [];
|
|
}
|
|
let r35 = r25.find($mk77178());
|
|
if (r35 == null) {
|
|
r35 = null;
|
|
}
|
|
const r36 = r35 != null;
|
|
if (r21) {
|
|
r21 = !r36;
|
|
}
|
|
return r21;
|
|
}
|
|
export function isDynamicProduct(a0) {
|
|
let r3 = a0 != null;
|
|
if (r3) {
|
|
const r1 = a0 == null;
|
|
let r7 = null;
|
|
if (!r1) {
|
|
if (a0.type === CollectiblesItemType.VARIANTS_GROUP) {
|
|
const r2 = a0.variants == null;
|
|
r7 = null;
|
|
if (!r2) {
|
|
const length = a0.variants.length;
|
|
r7 = null;
|
|
if (length !== 0) {
|
|
const r20 = a0.variants[0];
|
|
r7 = r20 == null ? null : _slicedToArray(r20.items, 1)[0].type;
|
|
}
|
|
}
|
|
} else {
|
|
r7 = a0.type;
|
|
}
|
|
}
|
|
r3 = r7 === CollectiblesItemType.PROFILE_EFFECT && a0.items.some((item) => isProfileEffectRecord(item) && item.effects.some((effect) => effect.randomizedSources != null && effect.randomizedSources.length > 0));
|
|
}
|
|
return r3;
|
|
}
|
|
export function getProductsWithOrbsPrice(a0) {
|
|
return a0.filter((item) => {
|
|
const r12 = item.prices[PriceSetAssignmentPurchaseTypes.DEFAULT];
|
|
const r3 = r12 == null;
|
|
let r11 = void 0;
|
|
if (!r3) {
|
|
const countryPrices = r12.countryPrices;
|
|
const r14 = countryPrices == null;
|
|
r11 = void 0;
|
|
if (!r14) {
|
|
const prices = countryPrices.prices;
|
|
r11 = prices == null ? void 0 : prices.slice(0, 2);
|
|
}
|
|
}
|
|
if (r11 == null) {
|
|
r11 = [];
|
|
}
|
|
let r20 = r11.find($mk77177());
|
|
if (r20 == null) {
|
|
r20 = null;
|
|
}
|
|
let r21 = r20 != null;
|
|
const r24 = item.prices[PriceSetAssignmentPurchaseTypes.MOBILE];
|
|
const r5 = r24 == null;
|
|
let r25 = void 0;
|
|
if (!r5) {
|
|
const countryPrices2 = r24.countryPrices;
|
|
const r27 = countryPrices2 == null;
|
|
r25 = void 0;
|
|
if (!r27) {
|
|
const prices2 = countryPrices2.prices;
|
|
r25 = prices2 == null ? void 0 : prices2.slice(0, 2);
|
|
}
|
|
}
|
|
if (r25 == null) {
|
|
r25 = [];
|
|
}
|
|
let r35 = r25.find($mk77178());
|
|
if (r35 == null) {
|
|
r35 = null;
|
|
}
|
|
const r36 = r35 != null;
|
|
if (r21) {
|
|
r21 = r36;
|
|
}
|
|
return r21;
|
|
});
|
|
}
|
|
export function getIsVariantProduct(a0) {
|
|
return a0.type === CollectiblesItemType.VARIANTS_GROUP && a0.variants != null && a0.variants.length !== 0;
|
|
}
|
|
export function getProductSkuIds(a0) {
|
|
return a0.type === CollectiblesItemType.VARIANTS_GROUP && a0.variants != null && a0.variants.length !== 0 ? a0.variants.map((variant) => variant.skuId) : [a0.skuId];
|
|
}
|
|
export function getSelectedProduct(a0, a1) {
|
|
const r12 = a0.type === CollectiblesItemType.VARIANTS_GROUP && a0.variants != null && a0.variants.length !== 0;
|
|
let r16 = a0;
|
|
if (r12) {
|
|
r16 = a0;
|
|
if (a1 != null) {
|
|
let r20 = a0.variants[a1];
|
|
if (r20 == null) {
|
|
r20 = a0;
|
|
}
|
|
r16 = r20;
|
|
}
|
|
}
|
|
return r16;
|
|
}
|
|
export function getProductType(a0) {
|
|
if (a0 == null) {
|
|
return null;
|
|
}
|
|
if (a0.type === CollectiblesItemType.VARIANTS_GROUP) {
|
|
if (a0.variants != null && a0.variants.length !== 0) {
|
|
const r18 = a0.variants[0];
|
|
return r18 == null ? null : _slicedToArray(r18.items, 1)[0].type;
|
|
}
|
|
return null;
|
|
}
|
|
return a0.type;
|
|
}
|