163 lines
5.8 KiB
TypeScript
163 lines
5.8 KiB
TypeScript
// Metro module 8716 (f8717).
|
|
import { PriceSetAssignmentPurchaseTypes } from "../../../Constants";
|
|
import { formatPrice } from "../../../utils/PriceUtils";
|
|
import { isGooglePlayBillingSupported } from "../../device/BillingPlatformUtils";
|
|
import IAPStore_android from "../../../stores/native/IAPStore.android";
|
|
import * as _CollectiblesUtils from "../CollectiblesUtils";
|
|
import PremiumUtils from "../../../utils/PremiumUtils";
|
|
import { getIsVariantProduct } from "../utils/CollectiblesProductUtils";
|
|
import { OrbBadges } from "../../virtual_currency/types";
|
|
import Module8718 from "../../../_bundle/Module8718";
|
|
function $mk81200($env) {
|
|
return (a0) => {
|
|
let r29;
|
|
const r4 = $env;
|
|
const r7 = r4[0];
|
|
const r6 = r4[2];
|
|
if (r7(r6[6]).getIsVariantProduct(a0)) {
|
|
r29 = a0.variants.every($mk81200(r4));
|
|
} else {
|
|
const r15 = r4[1];
|
|
const r9 = r15(r6[3]);
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
const product = r9.getProduct(googleSkuIds == null ? void 0 : googleSkuIds[r4[3].MOBILE]);
|
|
const r21 = r15(r6[3]);
|
|
const googleSkuIds2 = a0.googleSkuIds;
|
|
const product2 = r21.getProduct(googleSkuIds2 == null ? void 0 : googleSkuIds2[r4[3].MOBILE_PREMIUM_TIER_2]);
|
|
r29 = product != null && product2 != null;
|
|
}
|
|
return r29;
|
|
};
|
|
}
|
|
let env5682 = {};
|
|
const hasAtLeastOneGPlaySynced = function hasAtLeastOneGPlaySynced(a0) {
|
|
return a0.products.filter((a0) => {
|
|
let r29;
|
|
const r4 = env5682;
|
|
if (getIsVariantProduct(a0)) {
|
|
r29 = a0.variants.every($mk81200(r4));
|
|
} else {
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
const product = IAPStore_android.getProduct(googleSkuIds == null ? void 0 : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE]);
|
|
const googleSkuIds2 = a0.googleSkuIds;
|
|
const product2 = IAPStore_android.getProduct(googleSkuIds2 == null ? void 0 : googleSkuIds2[PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2]);
|
|
r29 = product != null && product2 != null;
|
|
}
|
|
return r29;
|
|
}).length > 0;
|
|
};
|
|
export function getFormattedPriceForCollectiblesProduct(a0, a1, a2) {
|
|
let r8, r10, r21, MOBILE_PREMIUM_TIER_2, PriceSetAssignmentPurchaseTypes2;
|
|
if (a2) {
|
|
if (a1) {
|
|
MOBILE_PREMIUM_TIER_2 = PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2;
|
|
PriceSetAssignmentPurchaseTypes2 = PriceSetAssignmentPurchaseTypes;
|
|
} else {
|
|
MOBILE_PREMIUM_TIER_2 = PriceSetAssignmentPurchaseTypes.MOBILE;
|
|
PriceSetAssignmentPurchaseTypes2 = PriceSetAssignmentPurchaseTypes;
|
|
}
|
|
r8 = PriceSetAssignmentPurchaseTypes2;
|
|
r10 = MOBILE_PREMIUM_TIER_2;
|
|
} else if (a1) {
|
|
r10 = PriceSetAssignmentPurchaseTypes.PREMIUM_TIER_2;
|
|
r8 = PriceSetAssignmentPurchaseTypes;
|
|
} else {
|
|
r10 = PriceSetAssignmentPurchaseTypes.DEFAULT;
|
|
r8 = PriceSetAssignmentPurchaseTypes;
|
|
}
|
|
L18: {
|
|
if (isGooglePlayBillingSupported()) {
|
|
if (r10 !== r8.MOBILE) {
|
|
const MOBILE_PREMIUM_TIER_22 = r8.MOBILE_PREMIUM_TIER_2;
|
|
r21 = null;
|
|
if (r10 !== MOBILE_PREMIUM_TIER_22) {
|
|
break L18;
|
|
}
|
|
}
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
const product = IAPStore_android.getProduct(googleSkuIds == null ? void 0 : googleSkuIds[r10]);
|
|
r21 = product != null ? {
|
|
amount: product.price,
|
|
currency: product.currencyCode,
|
|
priceString: product.priceString,
|
|
tax: 0,
|
|
taxInclusive: false
|
|
} : void 0;
|
|
} else {
|
|
r21 = _CollectiblesUtils.extractPriceByPurchaseTypes(a0, r10);
|
|
}
|
|
}
|
|
return r21 == null ? null : r21.priceString != null ? r21.priceString : formatPrice(r21.amount, r21.currency);
|
|
}
|
|
export function extractPriceByPurchaseTypes(a0, a1) {
|
|
if (isGooglePlayBillingSupported()) {
|
|
if (a1 !== PriceSetAssignmentPurchaseTypes.MOBILE && a1 !== PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2) {
|
|
return null;
|
|
}
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
const product = IAPStore_android.getProduct(googleSkuIds == null ? void 0 : googleSkuIds[a1]);
|
|
return product != null ? {
|
|
amount: product.price,
|
|
currency: product.currencyCode,
|
|
priceString: product.priceString,
|
|
tax: 0,
|
|
taxInclusive: false
|
|
} : void 0;
|
|
}
|
|
return _CollectiblesUtils.extractPriceByPurchaseTypes(a0, a1);
|
|
}
|
|
export function getCollectibleGoogleSkuId(a0, a1) {
|
|
if (a1 == null) {
|
|
return null;
|
|
}
|
|
const r12 = PremiumUtils.canUseShopDiscounts(a1) ? PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2 : PriceSetAssignmentPurchaseTypes.MOBILE;
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
let r15 = googleSkuIds == null ? void 0 : googleSkuIds[r12];
|
|
if (r15 == null) {
|
|
r15 = null;
|
|
}
|
|
return r15;
|
|
}
|
|
export function isGPlaySynced(a0) {
|
|
const r3 = env5682;
|
|
if (getIsVariantProduct(a0)) {
|
|
return a0.variants.every($mk81200(r3));
|
|
}
|
|
const googleSkuIds = a0.googleSkuIds;
|
|
const product = IAPStore_android.getProduct(googleSkuIds == null ? void 0 : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE]);
|
|
const googleSkuIds2 = a0.googleSkuIds;
|
|
const product2 = IAPStore_android.getProduct(googleSkuIds2 == null ? void 0 : googleSkuIds2[PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2]);
|
|
return product != null && product2 != null;
|
|
}
|
|
export function filterGPlaySyncedCategories(a0) {
|
|
if (a0 == null) {
|
|
return [];
|
|
}
|
|
const r20 = [];
|
|
for (const item of a0.values()) {
|
|
if (hasAtLeastOneGPlaySynced(item)) {
|
|
r20.push(item);
|
|
}
|
|
}
|
|
return r20;
|
|
}
|
|
export function filterHiddenCategories(a0) {
|
|
return a0.filter((item) => {
|
|
let r8 = item.unpublishedAt == null || item.unpublishedAt > new Date();
|
|
const r2 = item.products.length > 0;
|
|
if (r8) {
|
|
r8 = r2;
|
|
}
|
|
return r8;
|
|
});
|
|
}
|
|
export function createOrbProfileBadge() {
|
|
return {
|
|
id: OrbBadges.ORB_PROFILE_BADGE,
|
|
icon: OrbBadges.ORB_PROFILE_BADGE,
|
|
iconSrc: Module8718,
|
|
description: "",
|
|
isPreviewMode: true
|
|
};
|
|
}
|