70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
// Metro module 13727 (f13728).
|
|
import { useMemo } from "react";
|
|
import CollectiblesCategoryStore from "../../CollectiblesCategoryStore";
|
|
import CollectiblesPurchaseStore from "../../CollectiblesPurchaseStore";
|
|
import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/defaultAreStatesEqual";
|
|
import { useIsProfileFramesEarlyAccessPhase } from "../../hooks/useCanPurchaseFrames";
|
|
import { getProfileFrames, isPremiumCollectiblesPurchase, isPremiumCollectiblesProduct } from "../../CollectiblesUtils";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
let c9542_6 = {
|
|
PURCHASE: "purchase",
|
|
PREMIUM_PURCHASE: "premium_purchase",
|
|
PREVIEW: "preview"
|
|
};
|
|
let c9542_7 = {
|
|
skuId: "None"
|
|
};
|
|
let c9542_8 = {
|
|
skuId: "Shop"
|
|
};
|
|
export default function useProfileFrameSections() {
|
|
let c20676_1, c20676_2, isProfileFramesEarlyAccessPhase;
|
|
const stateFromStores = useStateFromStores([CollectiblesPurchaseStore], () => CollectiblesPurchaseStore.purchases);
|
|
const [r22, r23] = useStateFromStoresArray([CollectiblesCategoryStore], () => [CollectiblesCategoryStore.categories, CollectiblesCategoryStore.products]);
|
|
c20676_1 = r22;
|
|
c20676_2 = r23;
|
|
isProfileFramesEarlyAccessPhase = useIsProfileFramesEarlyAccessPhase("useProfileFrameSections");
|
|
return useMemo(() => {
|
|
const r23 = getProfileFrames(stateFromStores, c20676_1).reduce((acc, item) => {
|
|
const r9 = stateFromStores.get(item.skuId);
|
|
if (r9 != null ? isPremiumCollectiblesPurchase(r9) : isPremiumCollectiblesProduct(c20676_2.get(item.skuId))) {
|
|
acc.premium_purchase.push(item);
|
|
} else if (r9 != null) {
|
|
acc.purchase.push(item);
|
|
} else {
|
|
acc.preview.push(item);
|
|
}
|
|
return acc;
|
|
}, {
|
|
purchase: [],
|
|
premium_purchase: [],
|
|
preview: []
|
|
});
|
|
let header = intl.string(t.TiLCgw);
|
|
const r46 = [{
|
|
section: c9542_6.PURCHASE,
|
|
items: [c9542_7, c9542_8, ...r23.purchase],
|
|
height: 12,
|
|
header: intl.string(t["9eZ4aO"])
|
|
}, {
|
|
section: c9542_6.PREMIUM_PURCHASE,
|
|
items: r23.premium_purchase,
|
|
height: 12,
|
|
header
|
|
}, ,];
|
|
if (!isProfileFramesEarlyAccessPhase) {
|
|
header = intl.string(t["1vbbee"]);
|
|
}
|
|
r46[2] = {
|
|
section: c9542_6.PREVIEW,
|
|
items: r23.preview,
|
|
height: 12,
|
|
header
|
|
};
|
|
return r46.filter((item) => item.items.length > 0);
|
|
}, [r22, r23, stateFromStores, isProfileFramesEarlyAccessPhase]);
|
|
};
|
|
export { c9542_6 as Section };
|
|
export { c9542_7 as NONE_ITEM };
|
|
export { c9542_8 as SHOP_ITEM };
|