This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,399 @@
// Metro module 5662 (f5663).
import ApplicationStore from "../applications/ApplicationStore";
import { WishlistRecommendationReason } from "../wishlists/records/WishlistRecommendationRecord";
import ApplicationRecord from "../../records/ApplicationRecord";
import GuildStore from "../../stores/GuildStore";
import SocialLayerStorefrontStore from "./SocialLayerStorefrontStore";
import { STOREFRONT_MARKETING_GUILD_ID, STOREFRONT_MARKETING_GUILD_ID_TEST, getChannelsGameShopPrefix } from "./SocialLayerStorefrontConstants";
import { GuildFeatures, PriceSetAssignmentPurchaseTypes, Routes, SKUProductLines } from "../../Constants";
import { CollectibleShopTab } from "../collectibles/CollectiblesShopConstants";
import { CurrencyCodes } from "../../_bundle/Module505";
import { SUPPORTS_WEBP, getAssetURL } from "../../utils/StoreUtils";
import Module12 from "../../_bundle/Module12";
import { transformStorefrontPricesServer } from "../storefront/StorefrontUtils";
import URLUtils from "../../utils/URLUtils";
import { parse } from "../../_bundle/keysSorter";
import { useStateFromStores } from "../../_bundle/Module589";
import { useGetOrFetchApplication } from "../applications/useGetOrFetchApplications";
let c3500_17, hasSocialLayerStorefront, transformSlayerStorefrontPromotionServer, getSKUShareURL;
const getPrice = function getPrice(sku, a1) {
const r18 = sku.prices[a1] != null && sku.prices[a1].countryPrices.prices.length > 0 ? sku.prices[a1].countryPrices : sku.prices[PriceSetAssignmentPurchaseTypes.DEFAULT] != null ? sku.prices[PriceSetAssignmentPurchaseTypes.DEFAULT].countryPrices.prices.length > 0 ? sku.prices[PriceSetAssignmentPurchaseTypes.DEFAULT].countryPrices : null : null;
return r18 != null ? r18.prices[0] : sku.price != null ? sku.price : null;
};
hasSocialLayerStorefront = function hasSocialLayerStorefront(guild) {
if (SocialLayerStorefrontStore.getStorefrontGuildIds().has(guild.id)) {
return true;
}
if ("type" in guild) {
return false;
}
let r16 = SocialLayerStorefrontStore.getApplicationIdFromGuildId(guild.id);
if (r16 == null) {
r16 = (guild == null ? void 0 : guild.gameApplicationIds?.length) === 1 ? guild.gameApplicationIds[0] : void 0;
}
const storefrontApplicationIds = SocialLayerStorefrontStore.getStorefrontApplicationIds();
const r24 = r16 == null || !storefrontApplicationIds.has(r16);
let r27 = !r24;
if (r24) {
const features = guild.features;
let r30 = features == null ? void 0 : features.has(GuildFeatures.SOCIAL_LAYER_STOREFRONT);
if (r30 == null) {
r30 = false;
}
r27 = r30;
}
return r27;
};
transformSlayerStorefrontPromotionServer = function transformSlayerStorefrontPromotionServer(a0) {
let ends_at = a0.ends_at;
if (ends_at == null) {
ends_at = null;
}
let flavor = a0.flavor;
if (flavor == null) {
flavor = "default";
}
const pdp = a0.pdp;
const pdp2 = pdp == null ? null : {
label: pdp.label,
tooltip: pdp.tooltip,
icon: pdp.icon
};
const storefront = a0.storefront != null ? {
headerText: a0.storefront.header_text
} : null;
const checkout = a0.checkout;
const checkout2 = checkout == null ? null : {
label: checkout.label,
tooltip: checkout.tooltip,
icon: checkout.icon
};
const vc_stream = a0.vc_stream;
return {
id: a0.id,
endsAt: ends_at,
flavor,
pdp: pdp2,
storefront,
checkout: checkout2,
vcStream: vc_stream == null ? null : {
label: vc_stream.label,
tooltip: vc_stream.tooltip,
icon: vc_stream.icon
}
};
};
getSKUShareURL = function getSKUShareURL(a0, a1) {
let r47;
if (a0 != null) {
const { pathname, search } = location;
const applicationId = a1.applicationId;
const r26 = parse(search);
const { tab, applicationId: applicationId2 } = r26;
r26.skuId;
r47 = pathname.indexOf(Routes.COLLECTIBLES_SHOP) >= 0 && (tab === CollectibleShopTab.GAME_SHOPS && applicationId2 === applicationId && true) ? `${location.protocol}${window.GLOBAL_ENV.WEBAPP_ENDPOINT}${Routes.COLLECTIBLES_SHOP_GAME_SHOP(a1.applicationId, void 0, a1.id, a1.slug)}` : `${location.protocol}${window.GLOBAL_ENV.WEBAPP_ENDPOINT}${Routes.GAME_SHOP(a0, a1.id, a1.slug)}`;
} else {
r47 = `${location.protocol}${window.GLOBAL_ENV.WEBAPP_ENDPOINT}${Routes.COLLECTIBLES_SHOP_GAME_SHOP(a1.applicationId, void 0, a1.id, a1.slug)}`;
}
return r47;
};
const r47 = SUPPORTS_WEBP ? "webp" : "jpg";
export function getCountryPrices(a0, a1) {
return a0.prices[a1] != null && a0.prices[a1].countryPrices.prices.length > 0 ? a0.prices[a1].countryPrices : a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT] != null ? a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT].countryPrices.prices.length > 0 ? a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT].countryPrices : null : null;
}
export function isOnCollectiblesShopGameShopPage(a0, a1, a2, a3) {
const r15 = parse(a1);
const { tab, applicationId, skuId } = r15;
return a0.indexOf(Routes.COLLECTIBLES_SHOP) >= 0 && (tab === CollectibleShopTab.GAME_SHOPS && applicationId === a2 && (a3 == null || skuId === a3));
}
c3500_17 = r47;
export { c3500_17 as LARGE_ASSET_FORMAT };
export function hasPrice(a0) {
return a0.price != null || a0.prices[PriceSetAssignmentPurchaseTypes.DEFAULT] != null;
}
export { getPrice };
export function isGiftPriceDifferent(a0) {
let r9 = getPrice(a0, PriceSetAssignmentPurchaseTypes.DEFAULT);
if (r9 == null) {
r9 = {
amount: 0,
currency: CurrencyCodes.USD
};
}
let r12 = getPrice(a0, PriceSetAssignmentPurchaseTypes.GIFT);
if (r12 == null) {
r12 = {
amount: 0,
currency: CurrencyCodes.USD
};
}
return r9.currency !== r12.currency || r9.amount !== r12.amount;
}
export function getOrderedStorefrontSkuIds(a0) {
const set = new Set();
const r31 = [];
loop1: for (const r36 of a0.pages) {
const r37 = r36;
for (const skuId of r36.skuIds) {
if (!set.has(skuId)) {
set.add(skuId);
r31.push(skuId);
}
}
let sections = r37.sections;
if (sections == null) {
sections = [];
}
for (const item of sections) {
for (const skuId2 of item.skuIds) {
if (!set.has(skuId2)) {
set.add(skuId2);
r31.push(skuId2);
}
}
}
continue loop1;
}
return r31;
}
export function isGameItemSKU(a0) {
return a0 != null && a0.productLine === SKUProductLines.SOCIAL_LAYER_GAME_ITEM;
}
export function getMarketingGuildId() {
const guild = GuildStore.getGuild(STOREFRONT_MARKETING_GUILD_ID_TEST);
return guild != null && guild.features.has(GuildFeatures.SOCIAL_LAYER_STOREFRONT) ? guild.id : STOREFRONT_MARKETING_GUILD_ID;
}
export { hasSocialLayerStorefront };
export function transformStorefrontMetadataServer(a0) {
let logo_asset_id = a0.logo_asset_id;
if (logo_asset_id == null) {
logo_asset_id = null;
}
let light_theme_logo_asset_id = a0.light_theme_logo_asset_id;
if (light_theme_logo_asset_id == null) {
light_theme_logo_asset_id = null;
}
return {
logoAssetId: logo_asset_id,
lightThemeLogoAssetId: light_theme_logo_asset_id
};
}
export function transformSlayerApplicationStorefrontSummaryServer(a0) {
const published_at = a0.published_at;
const r1 = published_at == null;
let publishedAt = null;
if (!r1) {
const date = new Date(published_at);
publishedAt = Number.isNaN(date.getTime()) ? null : date;
}
let logo_asset_id = a0.logo_asset_id;
if (logo_asset_id == null) {
logo_asset_id = null;
}
let light_theme_logo_asset_id = a0.light_theme_logo_asset_id;
if (light_theme_logo_asset_id == null) {
light_theme_logo_asset_id = null;
}
return {
id: a0.id,
publishedAt,
title: a0.title,
logoAssetId: logo_asset_id,
lightThemeLogoAssetId: light_theme_logo_asset_id
};
}
export function transformSlayerApplicationStorefrontServer(a0) {
const published_at = a0.published_at;
const r0 = published_at == null;
let publishedAt = null;
if (!r0) {
const date = new Date(published_at);
publishedAt = Number.isNaN(date.getTime()) ? null : date;
}
const r3 = {
id: a0.id,
publishedAt,
applicationId: a0.application_id,
title: a0.title,
logoAssetId: a0.logo_asset_id,
lightThemeLogoAssetId: a0.light_theme_logo_asset_id,
pages: a0.pages.map((page) => ({
title: page.title,
leaderboard: page.leaderboard != null ? {
title: page.leaderboard.title,
description: page.leaderboard.description,
backgroundImageAssetId: page.leaderboard.background_image_asset_id
} : void 0,
skuIds: page.sku_ids,
sections: page.sections != null ? page.sections.map((section) => ({
title: section.title,
skuIds: section.sku_ids
})) : void 0
})),
assets: Module12.keyBy(a0.assets, "id"),
application: a0.application != null ? ApplicationRecord.createFromServer(a0.application) : void 0,
storefrontPricing: a0.storefront_pricing != null ? transformStorefrontPricesServer(a0.storefront_pricing) : void 0,
promotions: null
};
let promotions = a0.promotions;
if (promotions == null) {
promotions = {};
}
r3.promotions = Module12.mapValues(promotions, transformSlayerStorefrontPromotionServer);
return r3;
}
export function getPrimaryCarouselItemInfo(a0, a1, r4 = {}) {
let r41;
const size = r4.size;
const r12 = size !== void 0 ? size : 512;
if (a1 != null) {
const r3 = a0 == null;
let r5 = void 0;
if (!r3) {
const tenantMetadata = a0.tenantMetadata;
r5 = tenantMetadata == null ? void 0 : tenantMetadata.socialLayer?.carouselItems;
}
if (r5 != null && a0.tenantMetadata.socialLayer.carouselItems.length !== 0) {
const r30 = a0.tenantMetadata.socialLayer.carouselItems[0];
if (r30.labelIconAssetId == null) {
r41 = {
primaryIconAsset: void 0,
primaryIconLabel: void 0
};
} else {
let primaryIconAsset = URLUtils.toURLSafe(getAssetURL(a1, r30.labelIconAssetId, r12, "webp"));
if (primaryIconAsset == null) {
primaryIconAsset = void 0;
}
r41 = {
primaryIconAsset,
primaryIconLabel: r30.label
};
}
return r41;
}
}
return {
primaryIconAsset: void 0,
primaryIconLabel: void 0
};
}
export function getGameItemThumbnailUrl(a0, r2 = {}) {
const size = r2.size;
const r9 = size !== void 0 ? size : 512;
if (a0 != null && a0.thumbnailAssetId != null) {
return URLUtils.toURLSafe(getAssetURL(a0.applicationId, a0.thumbnailAssetId, r9, "webp"));
}
}
export function getCardImageURL(a0, r3 = {}) {
const size = r3.size;
const r10 = size !== void 0 ? size : 512;
const applicationId = a0?.applicationId;
const r17 = a0 == null;
let r8 = void 0;
if (!r17) {
const tenantMetadata = a0.tenantMetadata;
r8 = tenantMetadata == null ? void 0 : tenantMetadata.socialLayer?.cardImageAssetId;
}
if (r8 == null) {
r8 = a0?.thumbnailAssetId;
}
if (r8 != null && applicationId != null) {
return URLUtils.toURLSafe(getAssetURL(applicationId, r8, r10, "webp"));
}
}
export function getCardBackgroundImageURL(a0, r3 = {}) {
const size = r3.size;
const r10 = size !== void 0 ? size : 1024;
const r2 = a0 == null;
let r17 = void 0;
if (!r2) {
const tenantMetadata = a0.tenantMetadata;
r17 = tenantMetadata == null ? void 0 : tenantMetadata.socialLayer?.cardBackgroundImageAssetId;
}
if (r17 != null && a0?.applicationId != null) {
return URLUtils.toURLSafe(getAssetURL(a0.applicationId, a0.tenantMetadata.socialLayer.cardBackgroundImageAssetId, r10, c3500_17));
}
}
export { getSKUShareURL };
export function getForwardedSKUShareURL(a0, a1) {
return `${getSKUShareURL(a0, a1)}
`;
}
export function canSeeGameShop(a0) {
const guild = GuildStore.getGuild(a0);
return guild != null && hasSocialLayerStorefront(guild);
}
export function getHasWishlistOrPopularRecommendations(a0, c14985_0, c14985_1) {
return a0.length === 0 ? {
hasWishlist: false,
hasPopular: false
} : {
hasWishlist: a0.some((a0) => {
let r4 = c14985_0[a0.id];
if (r4 == null) {
r4 = {};
}
return Object.entries(r4).some((item) => {
const [r22, r23] = item;
return r23 === WishlistRecommendationReason.WISHLIST && c14985_1.has(r22);
});
}),
hasPopular: a0.some((item) => {
const r5 = c14985_0[item.id];
return r5 == null || Object.entries(r5).every((item) => {
const [r22, r23] = item;
return r23 === WishlistRecommendationReason.RECOMMENDATION && c14985_1.has(r22) || !c14985_1.has(r22);
});
})
};
}
export function isOnSocialLayerStorefrontPage(a0, a1, a2, a3) {
const r14 = parse(a1);
const { tab, applicationId } = r14;
r14.skuId;
return a0.indexOf(Routes.COLLECTIBLES_SHOP) >= 0 && (tab === CollectibleShopTab.GAME_SHOPS && applicationId === a2 && true) || a3 != null && a0.indexOf(getChannelsGameShopPrefix(a3)) >= 0;
}
export function isOnSocialLayerStorefrontSkuPage({ pathname, search, pageIndex = 0, applicationId, guildId, skuId }) {
const r20 = parse(search);
const { tab, applicationId: applicationId2, skuId: skuId2 } = r20;
return pathname.indexOf(Routes.COLLECTIBLES_SHOP) >= 0 && (tab === CollectibleShopTab.GAME_SHOPS && applicationId2 === applicationId && (skuId == null || skuId2 === skuId)) || guildId != null && pathname.includes(Routes.CHANNELS_GAME_SHOP(guildId, pageIndex, skuId));
}
export function useGetSocialLayerStorefrontGuildIdAndApplication(a0) {
const stateFromStores = useStateFromStores([SocialLayerStorefrontStore], () => SocialLayerStorefrontStore.getGuildIdFromApplicationId(a0));
const getOrFetchApplication = useGetOrFetchApplication(a0);
let guildId = stateFromStores;
if (guildId == null) {
guildId = getOrFetchApplication?.guildId;
}
return {
guildId,
application: getOrFetchApplication
};
}
export function getSocialLayerStorefrontApplicationId(a0) {
let r8 = SocialLayerStorefrontStore.getApplicationIdFromGuildId(a0);
const guild = GuildStore.getGuild(a0);
if (r8 == null) {
r8 = (guild == null ? void 0 : guild.gameApplicationIds?.length) === 1 ? guild.gameApplicationIds[0] : void 0;
}
return r8;
}
export function useGetSocialLayerStorefrontApplicationId(a0) {
let r15 = useStateFromStores([SocialLayerStorefrontStore], () => SocialLayerStorefrontStore.getApplicationIdFromGuildId(a0));
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0), [a0]);
if (r15 == null) {
r15 = (stateFromStores == null ? void 0 : stateFromStores.gameApplicationIds?.length) === 1 ? stateFromStores.gameApplicationIds[0] : void 0;
}
return r15;
}
export function getSocialLayerStorefrontGuildId(a0) {
if (a0 != null) {
let r6 = SocialLayerStorefrontStore.getGuildIdFromApplicationId(a0);
if (r6 == null) {
r6 = ApplicationStore.getApplication(a0)?.guildId;
}
return r6;
}
}
@@ -0,0 +1,774 @@
// Metro module 6688 (f6689).
import StorefrontPromotionOverrideStore from "../storefront/StorefrontPromotionOverrideStore";
import SocialLayerStorefrontStore from "./SocialLayerStorefrontStore";
import { Endpoints } from "../../Constants";
import Durations from "../../utils/Durations";
import Dispatcher from "../../Dispatcher";
import { getSocialLayerStorefrontApplicationId, transformSlayerApplicationStorefrontServer, transformStorefrontMetadataServer, transformSlayerApplicationStorefrontSummaryServer } from "./SlayerStorefrontUtils";
import { isTestModeForApplication, isAnyApplicationInTestMode } from "../game_store/TestModeUtils";
import { HTTP } from "../../_bundle/sendRequest";
import { isNullOrEmpty } from "../../utils/StringUtils";
import Backoff from "../../_bundle/Backoff";
let c4287_7, c4287_8, c4287_9, c4287_10, c4287_11, _fetchSocialLayerStorefrontSkuWithUrl, c4287_16, c4287_17, c4287_18, getOrCreateBackoff, c4287_20, c4287_21, setSocialLayerStorefrontPreview;
const _fetchSocialLayerStorefront = async function _fetchSocialLayerStorefront(c25949_0, c25949_1, c25949_2) {
let store_listings;
let c25949_7 = 0;
let c29813_2, c29813_0, c29813_1, c29813_3, c29813_4, c29813_5, c29813_6, c29813_7, c29813_8, c29813_9, c29813_10, c29813_11, c29813_12, c29813_13, c29813_14, c29813_15, c29813_16, c29813_17;
L57: {
try {
c29813_2 = void 0;
c29813_0 = c25949_0;
c29813_1 = c25949_1;
let r46 = c25949_2;
if (r46 === void 0) {
r46 = {};
}
c29813_2 = r46;
c29813_3 = void 0;
c29813_4 = void 0;
c29813_5 = void 0;
c29813_6 = void 0;
c29813_7 = void 0;
c29813_8 = void 0;
c29813_9 = void 0;
c29813_10 = void 0;
c29813_11 = void 0;
c29813_12 = void 0;
c29813_13 = void 0;
c29813_14 = void 0;
c29813_15 = void 0;
c29813_16 = void 0;
c29813_17 = void 0;
await void 0;
c29813_3 = c29813_2.eager;
c29813_4 = c29813_3 !== void 0 && c29813_3;
c29813_5 = c29813_2.forceFetch;
c29813_6 = c29813_5 !== void 0 && c29813_5;
c29813_7 = SocialLayerStorefrontStore.getStorefrontFetchState(c29813_0);
c29813_8 = c29813_7?.state === "loading";
c29813_9 = c29813_7?.state === "error" && c29813_7.fetchedAt != null && Date.now() - c29813_7.fetchedAt < c4287_7;
c29813_10 = c29813_7?.state === "fetched" && c29813_7.fetchedAt != null && Date.now() - c29813_7.fetchedAt < c4287_8;
if (!(!c29813_8 && (!c29813_9 && !c29813_10)) && !c29813_6) {
break L57;
}
c25949_7 = 1;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_LOAD",
guildOrApplicationId: c29813_0
});
c29813_11 = c29813_0.type === "application" ? c29813_0.applicationId : getSocialLayerStorefrontApplicationId(c29813_0.guildId);
c29813_12 = {};
if (c29813_11 != null && isTestModeForApplication(c29813_11)) {
c29813_12.test_mode = true;
}
c29813_13 = StorefrontPromotionOverrideStore.getPromotionIdOverride();
if (c29813_13 != null) {
c29813_12.promotion_id_override = c29813_13;
}
c29813_14 = c29813_0.type === "guild" && c29813_11 == null && isAnyApplicationInTestMode();
c29813_15 = await HTTP.get({
url: c29813_1,
query: c29813_12,
rejectWithError: true,
retries: 3
});
c29813_16 = c29813_15.body;
c29813_17 = transformSlayerApplicationStorefrontServer(c29813_16);
if (c29813_17.storefrontPricing != null) {
Dispatcher.dispatch({
type: "SKUS_PRICING_FETCH_SUCCESS",
priceId: {
type: "application",
applicationId: c29813_17.applicationId
},
data: c29813_17.storefrontPricing
});
}
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_LOAD_SUCCESS",
guildOrApplicationId: c29813_0,
storefront: c29813_17
});
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_METADATA_LOAD_SUCCESS",
applicationId: c29813_17.applicationId,
storefrontMetadata: transformStorefrontMetadataServer(c29813_16)
});
const store_listings3 = c29813_15.body.store_listings;
store_listings = store_listings3;
if (store_listings3 == null) {
store_listings = [];
}
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_SUCCESS",
storeListings: store_listings
});
if (c29813_14 && isTestModeForApplication(c29813_17.applicationId)) {
await (0, _fetchSocialLayerStorefront)(c29813_0, c29813_1, {
forceFetch: true
});
c25949_7 = 0;
} else {
c25949_7 = 0;
}
} catch ($e) {
let r8 = $e;
if (c25949_7 !== 0) {
while (true) {
try {
c25949_7 = 0;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_LOAD_FAILURE",
guildOrApplicationId: c29813_0,
eager: c29813_4
});
break L57;
} catch ($e) {
r8 = $e;
if (c25949_7 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
_fetchSocialLayerStorefrontSkuWithUrl = async function _fetchSocialLayerStorefrontSkuWithUrl(c25950_0, c25950_1, c25950_2) {
let c25950_3, c25950_4, c25950_5;
let c25950_6 = 0;
const r14 = void 0;
L29: {
try {
let env29814;
c25950_4 = r14;
const r37 = env29814 = {};
c25950_3 = r37;
env29814[2] = void 0;
env29814[0] = c25950_0;
env29814[1] = c25950_1;
let r39 = c25950_2;
if (r39 === void 0) {
r39 = {};
}
env29814[2] = r39;
env29814[3] = void 0;
env29814[4] = void 0;
env29814[5] = void 0;
env29814[6] = void 0;
env29814[7] = void 0;
env29814[8] = void 0;
env29814[9] = void 0;
env29814[10] = void 0;
env29814[11] = void 0;
await void 0;
env29814[3] = env29814[2].withGoogleSkuIds;
env29814[4] = env29814[3] !== void 0 && env29814[3];
env29814[5] = env29814[2].countryCode;
env29814[6] = env29814[2].paymentGateway;
c25950_6 = 1;
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_START",
skuId: env29814[0]
});
env29814[7] = {};
if (env29814[4]) {
env29814[7].with_google_sku_ids = true;
}
if (!isNullOrEmpty(env29814[5])) {
env29814[7].country_code = env29814[5];
}
if (env29814[6] != null) {
env29814[7].payment_gateway = env29814[6];
}
env29814[8] = StorefrontPromotionOverrideStore.getPromotionIdOverride();
if (env29814[8] != null) {
env29814[7].promotion_id_override = env29814[8];
}
env29814[9] = await HTTP.get({
url: env29814[1],
query: env29814[7],
rejectWithError: true
});
if (env29814[9].body != null && env29814[9].ok) {
env29814[10] = env29814[9].body.store_listing;
env29814[11] = env29814[9].body.storefront_metadata;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_PARTIAL_LOAD_SUCCESS",
assets: Object.fromEntries(env29814[9].body.assets.map((asset) => [asset.id, asset]))
});
if (env29814[11] != null) {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_METADATA_LOAD_SUCCESS",
applicationId: env29814[10].sku.application_id,
storefrontMetadata: transformStorefrontMetadataServer(env29814[11])
});
}
Dispatcher.dispatch({
type: "STORE_LISTING_FETCH_SUCCESS",
storeListing: env29814[10]
});
c25950_6 = 0;
break L29;
}
throw new Error("Failed to fetch social layer storefront SKU");
} catch ($e) {
const r35 = $e;
let r8 = r35;
c25950_5 = r35;
if (c25950_6 !== 0) {
while (true) {
try {
c25950_6 = 0;
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_FAIL",
skuId: env29814[0]
});
break L29;
} catch (r202) {
r8 = r202;
c25950_5 = r202;
if (c25950_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
getOrCreateBackoff = function getOrCreateBackoff(a0, a1) {
let r11 = a0.get(a1);
if (r11 == null) {
const backoff = new Backoff(c4287_17, c4287_18);
a0.set(a1, backoff);
r11 = backoff;
}
return r11;
};
setSocialLayerStorefrontPreview = function setSocialLayerStorefrontPreview(a0, a1) {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_SET_PREVIEW",
applicationId: a0,
storefrontId: a1
});
};
c4287_7 = 30 * Durations.Millis.SECOND;
c4287_8 = 30 * Durations.Millis.MINUTE;
c4287_9 = 60 * Durations.Millis.MINUTE;
c4287_10 = 30 * Durations.Millis.SECOND;
c4287_11 = 5 * Durations.Millis.SECOND;
c4287_16 = 5 * Durations.Millis.MINUTE;
c4287_17 = 30 * Durations.Millis.SECOND;
c4287_18 = 5 * Durations.Millis.MINUTE;
c4287_20 = new Map();
c4287_21 = new Map();
export { _fetchSocialLayerStorefront };
export function fetchSocialLayerStorefrontForApplication(a0, r4 = {}) {
return _fetchSocialLayerStorefront({
type: "application",
applicationId: a0
}, Endpoints.SOCIAL_LAYER_STOREFRONT_BY_APPLICATION_ID(a0), r4);
}
export function fetchSocialLayerStorefront(a0, r4 = {}) {
return _fetchSocialLayerStorefront({
type: "guild",
guildId: a0
}, Endpoints.SOCIAL_LAYER_APPLICATION_STOREFRONT(a0), r4);
}
export function fetchSocialLayerStorefrontSkuForApplication(a0, a1, r4 = {}) {
return _fetchSocialLayerStorefrontSkuWithUrl(a1, Endpoints.SOCIAL_LAYER_APPLICATION_STOREFRONT_SKU_BY_APPLICATION_ID(a0, a1), r4);
}
export function fetchSocialLayerStorefrontSku(a0, a1, r4 = {}) {
return _fetchSocialLayerStorefrontSkuWithUrl(a1, Endpoints.SOCIAL_LAYER_APPLICATION_STOREFRONT_SKU(a0, a1), r4);
}
export function setSocialLayerStorefrontState(a0, a1, a2) {
Dispatcher.dispatch({
type: "SET_SOCIAL_LAYER_STOREFRONT_STATE",
applicationId: a0,
pageIndex: a1,
skuId: a2
});
}
export async function fetchSocialLayerStorefrontEntries(applicationId) {
let c25951_4 = 0;
let c29815_0, c29815_1, c29815_2;
L23: {
L22: {
try {
c29815_0 = applicationId;
c29815_1 = void 0;
c29815_2 = void 0;
const storefrontEntries = SocialLayerStorefrontStore.getStorefrontEntries(applicationId);
if (storefrontEntries?.state === "loading") {
break L23;
}
const orCreateBackoff = getOrCreateBackoff(c4287_20, applicationId);
c29815_1 = orCreateBackoff;
if (storefrontEntries?.state === "error" && Date.now() - storefrontEntries.fetchedAt < orCreateBackoff.current) {
break L23;
}
if (storefrontEntries?.state === "fetched" && Date.now() - storefrontEntries.fetchedAt < c4287_16) {
break L23;
}
c25951_4 = 1;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD",
applicationId
});
c29815_2 = (await HTTP.get({
url: Endpoints.SOCIAL_LAYER_STOREFRONTS_ALL(applicationId),
rejectWithError: true,
retries: 3
})).body;
c29815_1.succeed();
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD_SUCCESS",
applicationId: c29815_0,
entries: c29815_2.map(transformSlayerApplicationStorefrontSummaryServer)
});
c25951_4 = 0;
} catch ($e) {
let r8 = $e;
if (c25951_4 !== 0) {
while (true) {
try {
c25951_4 = 0;
c29815_1.fail();
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD_FAILURE",
applicationId: c29815_0
});
break L22;
} catch ($e) {
r8 = $e;
if (c25951_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
export async function fetchSocialLayerStorefrontById(c25952_0, storefrontId) {
let store_listings2;
let c25952_6 = 0;
let c29816_0, c29816_1, c29816_2, c29816_3, c29816_4, c29816_5;
L33: {
L32: {
try {
c29816_0 = c25952_0;
c29816_1 = storefrontId;
c29816_2 = void 0;
c29816_3 = void 0;
c29816_4 = void 0;
c29816_5 = void 0;
const storefrontById = SocialLayerStorefrontStore.getStorefrontById(storefrontId);
if (storefrontById?.state === "loading") {
break L33;
}
const orCreateBackoff = getOrCreateBackoff(c4287_21, storefrontId);
c29816_2 = orCreateBackoff;
if (storefrontById?.state === "error" && storefrontById.fetchedAt != null && Date.now() - storefrontById.fetchedAt < orCreateBackoff.current) {
break L33;
}
if (storefrontById?.state === "fetched" && storefrontById.fetchedAt != null && Date.now() - storefrontById.fetchedAt < c4287_8) {
break L33;
}
c25952_6 = 1;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD",
storefrontId
});
const query = {};
if (isTestModeForApplication(c25952_0)) {
query.test_mode = true;
}
const promotionIdOverride = StorefrontPromotionOverrideStore.getPromotionIdOverride();
if (promotionIdOverride != null) {
query.promotion_id_override = promotionIdOverride;
}
c29816_3 = await HTTP.get({
url: Endpoints.SOCIAL_LAYER_STOREFRONT_BY_ID(c25952_0, storefrontId),
query,
rejectWithError: true,
retries: 3
});
c29816_4 = c29816_3.body;
c29816_5 = transformSlayerApplicationStorefrontServer(c29816_4);
if (c29816_5.storefrontPricing != null) {
Dispatcher.dispatch({
type: "SKUS_PRICING_FETCH_SUCCESS",
priceId: {
type: "application",
applicationId: c29816_5.applicationId
},
data: c29816_5.storefrontPricing
});
}
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD_SUCCESS",
storefrontId: c29816_1,
storefront: c29816_5
});
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_METADATA_LOAD_SUCCESS",
applicationId: c29816_5.applicationId,
storefrontMetadata: transformStorefrontMetadataServer(c29816_4)
});
const store_listings3 = c29816_3.body.store_listings;
store_listings2 = store_listings3;
if (store_listings3 == null) {
store_listings2 = [];
}
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_SUCCESS",
storeListings: store_listings2
});
c29816_2.succeed();
c25952_6 = 0;
} catch ($e) {
let r8 = $e;
if (c25952_6 !== 0) {
while (true) {
try {
c25952_6 = 0;
c29816_2.fail();
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD_FAILURE",
storefrontId: c29816_1
});
if (SocialLayerStorefrontStore.getPreviewStorefrontId(c29816_0) !== c29816_1) {
break L32;
}
(0, setSocialLayerStorefrontPreview)(c29816_0, null);
break L32;
} catch ($e) {
r8 = $e;
if (c25952_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
export { setSocialLayerStorefrontPreview };
export async function fetchSocialLayerStorefrontAnnouncement(guildId) {
let c25953_4 = 0;
let c29817_0, c29817_1, c29817_2;
L13: {
try {
c29817_0 = guildId;
c29817_1 = void 0;
c29817_2 = void 0;
c25953_4 = 1;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_START",
guildId
});
c29817_1 = (await HTTP.get({
url: Endpoints.SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT(guildId),
rejectWithError: true
})).body;
c29817_2 = c29817_1.type === "guild-discord-announcement" ? {
type: "guild-discord-announcement",
id: c29817_1.id,
applicationId: c29817_1.application_id,
applicationName: c29817_1.application_name,
assetFullyQualifiedURL: c29817_1.asset_fully_qualified_url,
videoAssetFullyQualifiedURL: c29817_1.video_asset_fully_qualified_url,
popoverTitle: c29817_1.popover_title,
popoverBody: c29817_1.popover_body,
popoverCta: c29817_1.popover_cta
} : {
type: "guild-application-announcement",
id: c29817_1.id,
applicationId: c29817_1.application_id,
applicationName: c29817_1.application_name,
assetId: c29817_1.asset_id,
backgroundImageAssetId: c29817_1.background_image_asset_id
};
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_SUCCESS",
guildId: c29817_0,
announcement: c29817_2
});
c25953_4 = 0;
} catch ($e) {
let r8 = $e;
if (c25953_4 !== 0) {
while (true) {
try {
c25953_4 = 0;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_FAILURE",
guildId: c29817_0
});
break L13;
} catch ($e) {
r8 = $e;
if (c25953_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function fetchSocialLayerStorefrontConfig() {
let c25954_0, c25954_1, c25954_2;
let c25954_3 = 0;
const r12 = void 0;
L26: {
L25: {
try {
let env29818;
c25954_2 = r12;
const r31 = env29818 = {};
c25954_1 = r31;
env29818[0] = void 0;
env29818[1] = void 0;
env29818[2] = void 0;
env29818[3] = void 0;
env29818[4] = void 0;
const configFetchState = SocialLayerStorefrontStore.getConfigFetchState();
if (configFetchState.state === "loading") {
break L26;
}
if (configFetchState.state === "success" && Date.now() - configFetchState.fetchedAt < c4287_9) {
break L26;
}
if (configFetchState.state === "error" && Date.now() - configFetchState.fetchedAt < c4287_10) {
break L26;
}
c25954_3 = 1;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_START"
});
env29818[0] = (await HTTP.get({
url: Endpoints.SOCIAL_LAYER_STOREFRONT_CONFIG,
rejectWithError: true
})).body;
env29818[1] = null;
if (env29818[0].promotion_end_datetime != null) {
env29818[2] = new Date(env29818[0].promotion_end_datetime);
if (!Number.isNaN(env29818[2].getTime())) {
env29818[1] = env29818[2];
}
}
const storefronts = env29818[0].storefronts;
const r94 = storefronts == null ? void 0 : storefronts.map((storefront) => {
const r11 = storefront.promotion_end_datetime != null ? new Date(storefront.promotion_end_datetime) : null;
const promotionEndDatetime = r11 == null || Number.isNaN(r11.getTime()) ? null : r11;
let excluded_platforms = storefront.excluded_platforms;
if (excluded_platforms == null) {
excluded_platforms = [];
}
return {
guildId: storefront.guild_id,
applicationId: storefront.application_id,
gameId: storefront.game_id,
collectiblesShopNavigationEnabled: storefront.collectibles_shop_navigation_enabled === true,
excludedPlatforms: excluded_platforms,
disableMobileAccountLinking: storefront.disable_mobile_account_linking === true,
promotionEndDatetime,
allowOrbsSpending: storefront.allow_orbs_spending === true
};
});
c25954_0 = r94;
if (r94 == null) {
c25954_0 = [];
}
env29818[3] = c25954_0;
env29818[4] = null;
if (env29818[0].announcement_modal_config != null) {
env29818[4] = {
version: env29818[0].announcement_modal_config.version,
applicationId: env29818[0].announcement_modal_config.application_id
};
}
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_SUCCESS",
config: {
promotionalSkuIds: env29818[0].promotional_sku_ids,
promotionEndDatetime: env29818[1],
storefronts: env29818[3],
announcementModalConfig: env29818[4]
}
});
c25954_3 = 0;
} catch ($e) {
let r30 = $e;
if (c25954_3 !== 0) {
while (true) {
try {
c25954_3 = 0;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_FAILURE"
});
break L25;
} catch ($e) {
r30 = $e;
if (c25954_3 === 0) {
break;
}
}
}
}
throw r30;
}
}
return void 0;
}
}
export function fetchSocialLayerSKUPurchaseEligibility(a0, a1) {
const skuId = a1;
const sKUEligibility = SocialLayerStorefrontStore.getSKUEligibility(a1);
if (sKUEligibility !== "checking" && sKUEligibility !== "eligible" && sKUEligibility !== "ineligible") {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_START",
skuId: a1
});
setTimeout(() => {
if (SocialLayerStorefrontStore.getSKUEligibility(skuId) === "checking") {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_FAILURE",
skuId,
reason: "interaction_deadline"
});
}
}, c4287_11);
HTTP.post({
url: Endpoints.SOCIAL_LAYER_APPLICATION_STOREFRONT_SKU_ELIGIBILITY(a0, a1),
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_CREATE",
skuId,
interactionId: result.body.interaction_id
});
}).catch((error) => {
Dispatcher.dispatch({
type: "SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_FAILURE",
skuId,
httpStatus: error?.status
});
});
}
}
export async function fetchSocialLayerStorefrontLaunchAnnouncement() {
let body, light_theme_logo_url, dark_theme_logo_url, background_url, titles, subtitle, features, button_text, c25955_8, c25955_9, c25955_10;
let c25955_11 = 0;
const r12 = void 0;
L30: {
try {
let env29819;
c25955_9 = r12;
const r27 = env29819 = {};
c25955_8 = r27;
env29819[0] = void 0;
env29819[1] = void 0;
c25955_11 = 1;
const body2 = (await HTTP.get({
url: Endpoints.SOCIAL_LAYER_STOREFRONT_LAUNCH_ANNOUNCEMENT,
rejectWithError: true
})).body;
body = body2;
if (body2 == null) {
body = null;
}
env29819[0] = body;
env29819[1] = null;
if (env29819[0] != null) {
const light_theme_logo_url2 = env29819[0].light_theme_logo_url;
light_theme_logo_url = light_theme_logo_url2;
if (light_theme_logo_url2 == null) {
light_theme_logo_url = null;
}
const dark_theme_logo_url2 = env29819[0].dark_theme_logo_url;
dark_theme_logo_url = dark_theme_logo_url2;
if (dark_theme_logo_url2 == null) {
dark_theme_logo_url = null;
}
const background_url2 = env29819[0].background_url;
background_url = background_url2;
if (background_url2 == null) {
background_url = null;
}
const titles2 = env29819[0].titles;
titles = titles2;
if (titles2 == null) {
titles = null;
}
subtitle = env29819[0].subtitle;
if (subtitle == null) {
subtitle = null;
}
const features2 = env29819[0].features;
features = features2 == null ? void 0 : features2.map((item) => ({
assetUrl: item.asset_url,
title: item.title,
subtitle: item.subtitle
}));
if (features == null) {
features = null;
}
const button_text2 = env29819[0].button_text;
button_text = button_text2;
if (button_text2 == null) {
button_text = null;
}
env29819[1] = {
applicationId: env29819[0].application_id,
lightThemeLogoUrl: light_theme_logo_url,
darkThemeLogoUrl: dark_theme_logo_url,
backgroundUrl: background_url,
titles,
subtitle,
features,
buttonText: button_text
};
}
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_LAUNCH_ANNOUNCEMENT_FETCH_SUCCESS",
config: env29819[1]
});
c25955_11 = 0;
} catch ($e) {
const r25 = $e;
let r8 = r25;
c25955_10 = r25;
if (c25955_11 !== 0) {
while (true) {
try {
c25955_11 = 0;
Dispatcher.dispatch({
type: "SOCIAL_LAYER_STOREFRONT_LAUNCH_ANNOUNCEMENT_FETCH_FAILURE"
});
break L30;
} catch (r104) {
r8 = r104;
c25955_10 = r104;
if (c25955_11 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
@@ -0,0 +1,35 @@
// Metro module 9756 (f9757).
const r11 = {
CARD: "card",
BUY_BUTTON: "buy_button",
GIFT_BUTTON: "gift_button",
WISHLIST_BUTTON: "wishlist_button",
FORWARD_BUTTON: "forward_button",
VIEW_DETAILS_BUTTON: "view_details_button",
BUY_WITH_ORBS_BUTTON: "buy_with_orbs_button"
};
const r16 = {
BUY_BUTTON: "buy_button",
GIFT_BUTTON: "gift_button",
WISHLIST_BUTTON: "wishlist_button",
COPY_LINK_BUTTON: "copy_link_button",
VISIT_SHOP: "visit_shop",
CAROUSEL_ITEM: "carousel_item",
CAROUSEL_NEXT: "carousel_next",
CAROUSEL_PREV: "carousel_prev",
MUTE_BUTTON: "mute_button",
FORWARD_BUTTON: "forward_button",
BUY_WITH_ORBS_BUTTON: "buy_with_orbs_button",
EARN_MORE_ORBS_BUTTON: "earn_more_orbs_button",
NITRO_UPSELL_BUTTON: "nitro_upsell_button"
};
const r25 = {
COPY_LINK_BUTTON: "copy_link_button"
};
const r26 = {
LEARN_MORE: "learn_more"
};
export { r11 as SlayerShopCardCTAType };
export { r16 as SlayerShopPDPCTAType };
export { r25 as SlayerStorefrontForwardModalCTAType };
export { r26 as SlayerStorefrontPageElementCTAType };
@@ -0,0 +1,13 @@
// Metro module 12794 (f12795).
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import { fetchSocialLayerStorefrontConfig } from "./SocialLayerStorefrontActionCreators";
class SocialLayerStorefrontConfigManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: this.onPostConnectionOpen.bind(this)
};
onPostConnectionOpen() {
fetchSocialLayerStorefrontConfig();
}
}
const socialLayerStorefrontConfigManager = new SocialLayerStorefrontConfigManager();
export default socialLayerStorefrontConfigManager;
@@ -0,0 +1,18 @@
// Metro module 5665 (f5666).
import { Environments } from "../user/UserStoreConstants";
const r19 = window.GLOBAL_ENV.RELEASE_CHANNEL === Environments.STAGING ? "1438570979889512448" : "1193841000108531764";
const r24 = window.GLOBAL_ENV.RELEASE_CHANNEL === Environments.STAGING ? null : "1400977487940292751";
let c3503_0 = /^\/(?:channels\/\d+\/)?game-shop(?:\/|$)/;
export { r19 as STOREFRONT_MARKETING_GUILD_ID };
export { r24 as STOREFRONT_MARKETING_GUILD_ID_TEST };
export const SOCIAL_LAYER_CLAIM_PURCHASED_ITEM_MODAL_TYPE = "Social Layer Claim Purchased Item Modal";
export const SOCIAL_LAYER_GIFT_CODE_CLAIM_MODAL_TYPE = "Social Layer Gift Code Claim Modal";
export const SOCIAL_LAYER_STOREFRONT_PRODUCT_DETAILS_MODAL_TYPE = "Social Layer Storefront Product Details Modal";
export const MARVEL_RIVALS_APPLICATION_ID = "1346069614634864772";
export const SOCIAL_LAYER_DAYS_TO_CLAIM_ITEM = 14;
export function getChannelsGameShopPrefix(a0) {
return `/channels/${a0}/game-shop`;
}
export function isGameShopPath(a0) {
return c3503_0.test(a0);
}
@@ -0,0 +1,599 @@
// Metro module 5664 (f5665).
import LocaleStore from "../user_settings/LocaleStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let locale, c3502_3, c3502_4, c3502_5, c3502_6, c3502_7, c3502_8, c3502_9, c3502_10, c3502_11, c3502_12, c3502_13, c3502_14, c3502_15, c3502_16, c3502_17, c3502_18, c3502_19, c3502_20, c3502_21, config;
const handleUserSettingsStoreUpdate = function handleUserSettingsStoreUpdate() {
if (locale === LocaleStore.locale) {
return false;
}
locale = LocaleStore.locale;
c3502_3 = {};
c3502_4 = {};
c3502_5 = {};
c3502_6 = {};
c3502_7 = {};
c3502_8 = {};
c3502_9 = {};
c3502_10 = {};
};
c3502_3 = {};
c3502_4 = {};
c3502_5 = {};
c3502_6 = {};
c3502_7 = {};
c3502_8 = {};
c3502_9 = {};
c3502_10 = {};
c3502_11 = {};
c3502_12 = {};
c3502_13 = {};
c3502_14 = new Set();
c3502_15 = {
state: "idle"
};
c3502_16 = new Set();
c3502_17 = {};
c3502_18 = {};
c3502_19 = {};
c3502_20 = {};
c3502_21 = new Set();
config = null;
class SocialLayerStorefrontStore extends Module589.Store {
static displayName = "SocialLayerStorefrontStore";
initialize() {
this.waitFor(AuthenticationStore, LocaleStore);
this.syncWith([LocaleStore], handleUserSettingsStoreUpdate);
locale = LocaleStore.locale;
}
getStorefrontData(a0) {
return c3502_4[a0];
}
getStorefrontDataForApplicationId(a0) {
return c3502_5[a0];
}
getStorefrontFetchState(a0) {
const r7 = a0.type === "guild" ? a0.guildId : c3502_18[a0.applicationId];
const r9 = a0.type === "guild" ? c3502_17[a0.guildId] : a0.applicationId;
return r7 != null ? c3502_4[r7] : r9 != null ? c3502_5[r9] : void 0;
}
getSkuAssets() {
return c3502_9;
}
getStorefrontMetadata(a0) {
return c3502_10[a0];
}
getStorefrontEntries(a0) {
return c3502_6[a0];
}
getStorefrontById(a0) {
return c3502_7[a0];
}
getPreviewStorefrontId(a0) {
let r4 = c3502_8[a0];
if (r4 == null) {
r4 = null;
}
return r4;
}
getStorefrontState(a0) {
if (a0 != null) {
return c3502_3[a0];
}
}
getAnnouncement(a0) {
return c3502_11[a0];
}
getConfig() {
return c3502_15.state === "success" ? c3502_15.config : null;
}
getConfigForApplicationId(a0) {
return c3502_20[a0];
}
getApplicationIdFromDetectableId(a0) {
return c3502_19[a0];
}
getDetectableIdsToApplicationIds() {
return c3502_19;
}
getGuildIdFromApplicationId(a0) {
return a0 != null ? c3502_18[a0] : void 0;
}
getApplicationIdFromGuildId(a0) {
return a0 != null ? c3502_17[a0] : void 0;
}
getConfigFetchState() {
return c3502_15;
}
getStorefrontApplicationIds() {
return c3502_16;
}
getStorefrontGuildIds() {
return c3502_21;
}
getSKUEligibility(a0) {
return c3502_12[a0]?.state;
}
getSKUEligibilityEntry(a0) {
return c3502_12[a0];
}
getNormalizedSKUEligibility(a0) {
return c3502_12[a0]?.state !== "ineligible";
}
getAnnouncementModalContentConfig() {
return config;
}
}
const socialLayerStorefrontStore = new SocialLayerStorefrontStore(Dispatcher, {
LOGOUT: function handleLogout() {
c3502_9 = {};
c3502_10 = {};
c3502_12 = {};
c3502_13 = {};
c3502_5 = {};
c3502_4 = {};
c3502_6 = {};
c3502_7 = {};
c3502_8 = {};
c3502_14 = new Set();
c3502_15 = {
state: "idle"
};
c3502_16 = new Set();
c3502_17 = {};
c3502_18 = {};
c3502_19 = {};
c3502_20 = {};
c3502_21 = new Set();
config = null;
},
STOREFRONT_PROMOTION_ID_OVERRIDE_SET: function handleStorefrontPromotionIdOverrideSet() {
c3502_5 = {};
c3502_4 = {};
},
POST_CONNECTION_OPEN: function handlePostConnectionOpen() {
c3502_12 = {};
c3502_13 = {};
c3502_14 = new Set();
},
ENTITLEMENT_CREATE: function handleEntitlementCreate({ entitlement }) {
if (c3502_12[entitlement.sku_id] == null) {
return false;
}
const r9 = {
...c3502_12
};
c3502_12 = r9;
delete r9[entitlement.sku_id];
},
INTERACTION_FAILURE: function handleInteractionFailure({ interactionId }) {
if (interactionId == null) {
return false;
}
const r6 = c3502_13[interactionId];
if (r6 == null) {
if (Object.values(c3502_12).some((item) => item.state === "checking")) {
if (c3502_14.size >= 25) {
c3502_14.delete(c3502_14.values().next().value);
}
c3502_14.add(interactionId);
}
return false;
}
const r10 = {
...c3502_12
};
r10[r6] = {
state: "error",
reason: "interaction_failure"
};
c3502_12 = r10;
delete c3502_13[interactionId];
},
INTERACTION_SUCCESS: function handleInteractionSuccess({ interactionId }) {
if (c3502_13[interactionId] == null) {
return false;
}
delete c3502_13[interactionId];
},
SOCIAL_LAYER_STOREFRONT_LOAD: function handleSocialLayerStorefrontLoad({ guildOrApplicationId }) {
const r6 = guildOrApplicationId.type === "guild" ? guildOrApplicationId.guildId : c3502_18[guildOrApplicationId.applicationId];
const r13 = guildOrApplicationId.type === "guild" ? c3502_17[guildOrApplicationId.guildId] : guildOrApplicationId.applicationId;
const r16 = {
state: "loading"
};
if (r6 != null) {
const r17 = c3502_4;
r17[r6] = {
...r17[r6],
...r16
};
}
if (r13 != null) {
const r22 = c3502_5;
r22[r13] = {
...r22[r13],
...r16
};
}
c3502_4 = {
...c3502_4
};
c3502_5 = {
...c3502_5
};
},
SOCIAL_LAYER_STOREFRONT_LOAD_SUCCESS: function handleSocialLayerStorefrontLoadSuccess({ guildOrApplicationId, storefront }) {
let guildId;
if (guildOrApplicationId.type === "guild") {
guildId = guildOrApplicationId.guildId;
} else {
const r16 = guildOrApplicationId.type === "guild" ? guildOrApplicationId.guildId : c3502_18[guildOrApplicationId.applicationId];
if (guildOrApplicationId.type === "guild") {
c3502_17[guildOrApplicationId.guildId];
guildId = r16;
} else {
guildOrApplicationId.applicationId;
guildId = r16;
}
}
if (guildId != null && c3502_17[guildId] == null) {
c3502_17[guildId] = storefront.applicationId;
c3502_17 = {
...c3502_17
};
}
if (storefront.applicationId != null && guildId != null && c3502_18[storefront.applicationId] == null) {
c3502_18[storefront.applicationId] = guildId;
c3502_18 = {
...c3502_18
};
}
const applicationId = storefront.applicationId;
const r44 = {
state: "fetched",
fetchedAt: Date.now(),
storefront
};
if (guildId != null) {
const r45 = c3502_4;
r45[guildId] = {
...r45[guildId],
...r44
};
}
if (applicationId != null) {
const r52 = c3502_5;
r52[applicationId] = {
...r52[applicationId],
...r44
};
}
c3502_4 = {
...c3502_4
};
c3502_5 = {
...c3502_5
};
if (storefront.assets != null) {
c3502_9 = {
...c3502_9,
...storefront.assets
};
}
},
SOCIAL_LAYER_STOREFRONT_PARTIAL_LOAD_SUCCESS: function handleSocialLayerStorefrontPartialLoadSuccess(a0) {
c3502_9 = {
...c3502_9,
...a0.assets
};
},
SOCIAL_LAYER_STOREFRONT_METADATA_LOAD_SUCCESS: function handleSocialLayerStorefrontMetadataLoadSuccess({ applicationId, storefrontMetadata }) {
const r8 = {
...c3502_10
};
r8[applicationId] = storefrontMetadata;
c3502_10 = r8;
},
SOCIAL_LAYER_STOREFRONT_LOAD_FAILURE: function handleSocialLayerStorefrontLoadFailure({ guildOrApplicationId, eager }) {
const r14 = guildOrApplicationId.type === "guild" ? guildOrApplicationId.guildId : c3502_18[guildOrApplicationId.applicationId];
const r16 = guildOrApplicationId.type === "guild" ? c3502_17[guildOrApplicationId.guildId] : guildOrApplicationId.applicationId;
const r19 = r14 != null ? c3502_4[r14] : r16 != null ? c3502_5[r16] : void 0;
if (r19 == null) {
return false;
}
L30: {
if (eager) {
if (r19.state === "loading" && r19.storefront != null) {
const r62 = {
state: "fetched"
};
if (r14 != null) {
const r63 = c3502_4;
r63[r14] = {
...r63[r14],
...r62
};
}
if (r16 != null) {
const r71 = c3502_5;
r71[r16] = {
...r71[r16],
...r62
};
}
c3502_4 = {
...c3502_4
};
c3502_5 = {
...c3502_5
};
break L30;
}
if (r14 != null) {
delete c3502_4[r14];
}
if (r16 != null) {
delete c3502_5[r16];
}
c3502_4 = {
...c3502_4
};
c3502_5 = {
...c3502_5
};
} else {
const r8 = {
state: "error",
fetchedAt: Date.now(),
storefront: void 0
};
if (r14 != null) {
const r26 = c3502_4;
r26[r14] = {
...r26[r14],
...r8
};
}
if (r16 != null) {
const r31 = c3502_5;
r31[r16] = {
...r31[r16],
...r8
};
}
c3502_4 = {
...c3502_4
};
c3502_5 = {
...c3502_5
};
}
}
},
SET_SOCIAL_LAYER_STOREFRONT_STATE: function handleSetSocialLayerStorefrontState(a0) {
c3502_3[a0.applicationId] = {
activePage: a0.pageIndex,
activeSkuId: a0.skuId
};
c3502_3 = {
...c3502_3
};
},
SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_START: function handleSocialLayerStorefrontAnnouncementFetchStart({ guildId }) {
const r7 = {
...c3502_11
};
c3502_11 = r7;
r7[guildId] = {
state: "loading"
};
},
SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_SUCCESS: function handleSocialLayerStorefrontAnnouncementFetchSuccess({ guildId, announcement }) {
const r8 = {
...c3502_11
};
c3502_11 = r8;
r8[guildId] = {
state: "success",
announcement
};
},
SOCIAL_LAYER_STOREFRONT_ANNOUNCEMENT_FETCH_FAILURE: function handleSocialLayerStorefrontAnnouncementFetchFailure({ guildId }) {
const r7 = {
...c3502_11
};
c3502_11 = r7;
r7[guildId] = {
state: "error"
};
},
SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_START: function handleStorefrontConfigFetchStart() {
c3502_15 = {
state: "loading"
};
},
SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_SUCCESS: function handleStorefrontConfigFetchSuccess({ config: config2 }) {
c3502_15 = {
state: "success",
config: config2,
fetchedAt: Date.now()
};
c3502_16 = new Set(config2.storefronts.map((storefront) => storefront.applicationId));
c3502_21 = new Set(config2.storefronts.filter((storefront) => storefront.guildId != null).map((item) => item.guildId));
c3502_17 = config2.storefronts.reduce((acc, storefront) => {
if (storefront.guildId != null) {
acc[storefront.guildId] = storefront.applicationId;
}
return acc;
}, {});
c3502_18 = config2.storefronts.reduce((acc, storefront) => {
if (storefront.guildId != null) {
acc[storefront.applicationId] = storefront.guildId;
acc[storefront.gameId] = storefront.guildId;
}
return acc;
}, {});
c3502_19 = config2.storefronts.reduce((acc, storefront) => {
acc[storefront.gameId] = storefront.applicationId;
acc[storefront.applicationId] = storefront.applicationId;
return acc;
}, {});
c3502_20 = config2.storefronts.reduce((acc, storefront) => {
acc[storefront.applicationId] = storefront;
return acc;
}, {});
},
SOCIAL_LAYER_STOREFRONT_CONFIG_FETCH_FAILURE: function handleStorefrontConfigFetchFailure() {
c3502_15 = {
state: "error",
fetchedAt: Date.now()
};
},
SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_START: function handleSKUPurchaseEligibilityCheckStart({ skuId }) {
const r7 = {
...c3502_12
};
r7[skuId] = {
state: "checking"
};
c3502_12 = r7;
},
SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_CREATE: function handleSKUPurchaseEligibilityCheckCreate({ skuId, interactionId }) {
let r14 = c3502_12[skuId]?.state === "checking";
if (r14) {
if (c3502_14.has(interactionId)) {
c3502_14.delete(interactionId);
const r22 = {
...c3502_12
};
r22[skuId] = {
state: "error",
reason: "interaction_failure"
};
c3502_12 = r22;
} else {
c3502_13[interactionId] = skuId;
}
r14 = void 0;
}
return r14;
},
SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_CHECK_FAILURE: function handleSKUPurchaseEligibilityCheckFailure({ skuId, reason = "http_error", httpStatus }) {
if (c3502_12[skuId]?.state !== "checking" && reason === "interaction_deadline") {
return false;
}
const r15 = {
...c3502_12
};
r15[skuId] = {
state: "error",
reason,
httpStatus
};
c3502_12 = r15;
},
SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY_RESPONSE: function handleSKUPurchaseEligibilityResponse({ skuId, recipientId, eligible, ineligibleReason }) {
if (AuthenticationStore.getId() !== recipientId) {
return false;
}
const r12 = {
...c3502_12
};
r12[skuId] = eligible ? {
state: "eligible"
} : {
state: "ineligible",
ineligibleReason
};
c3502_12 = r12;
},
SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD: function handleSocialLayerStorefrontEntriesLoad({ applicationId }) {
const r7 = {
...c3502_6
};
r7[applicationId] = {
state: "loading"
};
c3502_6 = r7;
},
SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD_SUCCESS: function handleSocialLayerStorefrontEntriesLoadSuccess({ applicationId, entries }) {
const r9 = {
...c3502_6
};
r9[applicationId] = {
state: "fetched",
entries,
fetchedAt: Date.now()
};
c3502_6 = r9;
},
SOCIAL_LAYER_STOREFRONT_ENTRIES_LOAD_FAILURE: function handleSocialLayerStorefrontEntriesLoadFailure({ applicationId }) {
const r9 = {
...c3502_6
};
r9[applicationId] = {
state: "error",
fetchedAt: Date.now()
};
c3502_6 = r9;
},
SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD: function handleSocialLayerStorefrontByIdLoad({ storefrontId }) {
const r8 = {
...c3502_7
};
r8[storefrontId] = {
...c3502_7[storefrontId],
storefront: null,
state: "loading",
fetchedAt: null
};
c3502_7 = r8;
},
SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD_SUCCESS: function handleSocialLayerStorefrontByIdLoadSuccess({ storefrontId, storefront }) {
const r10 = {
...c3502_7
};
r10[storefrontId] = {
storefront,
state: "fetched",
fetchedAt: Date.now()
};
c3502_7 = r10;
if (storefront.assets != null) {
c3502_9 = {
...c3502_9,
...storefront.assets
};
}
},
SOCIAL_LAYER_STOREFRONT_BY_ID_LOAD_FAILURE: function handleSocialLayerStorefrontByIdLoadFailure({ storefrontId }) {
const r9 = {
...c3502_7
};
r9[storefrontId] = {
storefront: null,
state: "error",
fetchedAt: Date.now()
};
c3502_7 = r9;
},
SOCIAL_LAYER_STOREFRONT_SET_PREVIEW: function handleSocialLayerStorefrontSetPreview({ applicationId, storefrontId }) {
c3502_8 = {
...c3502_8
};
if (storefrontId == null) {
delete c3502_8[applicationId];
} else {
c3502_8[applicationId] = storefrontId;
}
},
SOCIAL_LAYER_STOREFRONT_LAUNCH_ANNOUNCEMENT_FETCH_SUCCESS: function handleLaunchAnnouncementFetchSuccess(a0) {
config = a0.config;
},
SOCIAL_LAYER_STOREFRONT_LAUNCH_ANNOUNCEMENT_FETCH_FAILURE: function handleLaunchAnnouncementFetchFailure() {
config = null;
}
});
export default socialLayerStorefrontStore;
@@ -0,0 +1,28 @@
// Metro module 7888 (f7889).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-04-social-layer-storefront-mobile-purchasing",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export { apexExperiment as SocialLayerStorefrontMobilePurchasingExperiment };
export function useIsEligibleForSocialLayerStorefrontMobilePurchasing(a0) {
return apexExperiment.useConfig({
location: a0.location
}).enabled;
}
export function getIsEligibleForSocialLayerStorefrontMobilePurchasing(a0) {
return apexExperiment.getConfig({
location: a0.location
}).enabled;
}
@@ -0,0 +1,150 @@
// Metro module 8686 (f8687).
import ContentInventoryOutboxStore from "../../content_inventory/ContentInventoryOutboxStore";
import RunningGameStore_native from "../../game_detection/RunningGameStore.native";
import UserProfileStore from "../../user_profile/UserProfileStore";
import GuildStore from "../../../stores/GuildStore";
import PresenceStore from "../../../stores/PresenceStore";
import SocialLayerStorefrontStore from "../SocialLayerStorefrontStore";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
import { isGamingLikeEntry } from "../../content_inventory/ContentInventoryTypes";
import { useSlayerStorefrontDevApplicationIdOverride } from "./useSlayerStorefrontDevApplicationIdOverride";
function $mk81154($env) {
return () => {
let r23;
const r0 = [];
let r2 = $env[0][Symbol.iterator]();
const next = r2.next;
const r3 = $env.$parent;
while (true) {
const r10 = r2 === void 0 ? void 0 : (r23 = next.call(r2)).done ? r2 = void 0 : r23.value;
if (r2 === void 0) {
return r0;
}
try {
for (const item of r3[6].getActivities(r10)) {
if (item.application_id != null) {
const applicationIdFromDetectableId = r3[7].getApplicationIdFromDetectableId(item.application_id);
if (applicationIdFromDetectableId != null) {
r0.push(applicationIdFromDetectableId);
}
}
}
} catch (r47) {
if (r2 !== void 0 && typeof r2.return === "function") {
try {
r2.return();
} catch {}
}
throw r47;
}
}
};
}
let $mk81155 = function() {
return () => {
const r0 = [];
for (const item of RunningGameStore_native.getRunningGames()) {
if (item.id != null && RunningGameStore_native.isDetectionEnabled(item)) {
const applicationIdFromDetectableId = SocialLayerStorefrontStore.getApplicationIdFromDetectableId(item.id);
if (applicationIdFromDetectableId != null) {
r0.push(applicationIdFromDetectableId);
}
}
}
return r0;
};
};
let env5661 = {};
export function useUsersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds({ userIds }) {
return useStateFromStoresArray([ContentInventoryOutboxStore, SocialLayerStorefrontStore], () => {
const r0 = [];
for (const userId of userIds) {
let r32 = ContentInventoryOutboxStore.getUserOutbox(userId)?.entries;
if (r32 == null) {
r32 = [];
}
for (const item of r32) {
if (item != null && isGamingLikeEntry(item)) {
const applicationIdFromDetectableId = SocialLayerStorefrontStore.getApplicationIdFromDetectableId(item.extra.application_id);
if (applicationIdFromDetectableId != null) {
r0.push(applicationIdFromDetectableId);
}
}
}
}
return r0;
}, [userIds]);
}
export function useAreUsersInSocialLayerStorefrontMutualGuildsApplicationIds(a0) {
return useStateFromStoresArray([UserProfileStore, SocialLayerStorefrontStore], () => {
const r0 = [];
for (const item of a0) {
const mutualGuilds = UserProfileStore.getMutualGuilds(item);
if (mutualGuilds != null) {
for (const item2 of mutualGuilds) {
if (SocialLayerStorefrontStore.getStorefrontGuildIds().has(item2.guild.id)) {
const applicationIdFromGuildId = SocialLayerStorefrontStore.getApplicationIdFromGuildId(item2.guild.id);
if (applicationIdFromGuildId != null) {
r0.push(applicationIdFromGuildId);
}
}
}
}
}
return r0;
}, [a0]);
}
export function useUsersPlayingStorefrontEnabledGamesApplicationIds(a0) {
let env16724;
const r4 = env16724 = {
$parent: env5661
};
const userIds2 = a0.userIds;
env16724[0] = userIds2;
const stateFromStoresArray = useStateFromStoresArray([PresenceStore, SocialLayerStorefrontStore], $mk81154(r4), [userIds2]);
const slayerStorefrontDevApplicationIdOverride = useSlayerStorefrontDevApplicationIdOverride();
return slayerStorefrontDevApplicationIdOverride != null ? [...stateFromStoresArray, slayerStorefrontDevApplicationIdOverride] : stateFromStoresArray;
}
export function useAreUsersPlayingStorefrontEnabledGames({ userIds: userIds2 }) {
let env16727;
const r4 = env16727 = {
$parent: env5661
};
env16727[0] = userIds2;
const stateFromStoresArray = useStateFromStoresArray([PresenceStore, SocialLayerStorefrontStore], $mk81154(r4), [userIds2]);
const slayerStorefrontDevApplicationIdOverride = useSlayerStorefrontDevApplicationIdOverride();
return (slayerStorefrontDevApplicationIdOverride != null ? [...stateFromStoresArray, slayerStorefrontDevApplicationIdOverride] : stateFromStoresArray).length > 0;
}
export function useCurrentUserPlayedSocialLayerStorefrontGamesApplicationIds() {
return useStateFromStoresArray([RunningGameStore_native, SocialLayerStorefrontStore], () => {
const r0 = [];
for (const item of RunningGameStore_native.getGamesSeen(false, false)) {
if (item.id != null) {
const applicationIdFromDetectableId = SocialLayerStorefrontStore.getApplicationIdFromDetectableId(item.id);
if (applicationIdFromDetectableId != null) {
r0.push(applicationIdFromDetectableId);
}
}
}
return r0;
});
}
export function useCurrentUserPlayingSocialLayerStorefrontGamesApplicationIds() {
return useStateFromStoresArray([RunningGameStore_native, SocialLayerStorefrontStore], $mk81155(), []);
}
export function useIsCurrentUserPlayingSocialLayerStorefrontGames() {
return useStateFromStoresArray([RunningGameStore_native, SocialLayerStorefrontStore], $mk81155(), []).length > 0;
}
export function useIsCurrentUserInSocialLayerStorefrontGuildsApplicationIds() {
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuildIds());
return useStateFromStoresArray([SocialLayerStorefrontStore], () => {
const r0 = [];
for (const stateFromStore of stateFromStores) {
const applicationIdFromGuildId = SocialLayerStorefrontStore.getApplicationIdFromGuildId(stateFromStore);
if (applicationIdFromGuildId != null) {
r0.push(applicationIdFromGuildId);
}
}
return r0;
}, [stateFromStores]);
}
@@ -0,0 +1,55 @@
// Metro module 8685 (f8686).
import { useMemo } from "react";
import SocialLayerStorefrontStore from "../SocialLayerStorefrontStore";
import useDisplayProfile from "../../user_profile/hooks/useDisplayProfile";
import { useUsersPlayingStorefrontEnabledGamesApplicationIds, useUsersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds, useAreUsersInSocialLayerStorefrontMutualGuildsApplicationIds } from "./SocialLayerStorefrontEligibilityHooks";
import { useStateFromStoresArray } from "../../../_bundle/Module589";
import { BaseGameWidget } from "../../user_profile/UserProfileGameWidgetTypes";
import { ApplicationWidget } from "../../user_profile/UserProfileApplicationWidgetTypes";
import { uniq } from "../../../_bundle/Module12";
export default function useDisplayProfileSocialLayerStorefrontApplicationIds({ userId }) {
let usersPlayingStorefrontEnabledGamesApplicationIds, usersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds, areUsersInSocialLayerStorefrontMutualGuildsApplicationIds, stateFromStoresArray;
usersPlayingStorefrontEnabledGamesApplicationIds = void 0;
usersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds = void 0;
areUsersInSocialLayerStorefrontMutualGuildsApplicationIds = void 0;
stateFromStoresArray = void 0;
const displayProfile = useDisplayProfile(userId);
let c16723_0 = displayProfile;
const memo = useMemo(() => c16723_0?.userId != null ? [c16723_0.userId] : [], [displayProfile]);
usersPlayingStorefrontEnabledGamesApplicationIds = useUsersPlayingStorefrontEnabledGamesApplicationIds({
userIds: memo
});
usersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds = useUsersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds({
userIds: memo
});
areUsersInSocialLayerStorefrontMutualGuildsApplicationIds = useAreUsersInSocialLayerStorefrontMutualGuildsApplicationIds(memo);
stateFromStoresArray = useStateFromStoresArray([SocialLayerStorefrontStore], () => {
if (c16723_0?.widgets == null) {
return [];
}
const set = new Set();
let c26271_0 = set;
let r10 = c16723_0?.widgets;
if (r10 == null) {
r10 = [];
}
for (const item of r10) {
const r40 = item instanceof BaseGameWidget;
if (r40) {
item.games.forEach((game) => {
const applicationIdFromDetectableId = SocialLayerStorefrontStore.getApplicationIdFromDetectableId(game.applicationId);
if (applicationIdFromDetectableId != null) {
c26271_0.add(applicationIdFromDetectableId);
}
});
} else if (item instanceof ApplicationWidget) {
const applicationIdFromDetectableId = SocialLayerStorefrontStore.getApplicationIdFromDetectableId(item.applicationId);
if (applicationIdFromDetectableId != null) {
set.add(applicationIdFromDetectableId);
}
}
}
return Array.from(set).sort();
}, [displayProfile]);
return useMemo(() => c16723_0?.application != null ? [] : uniq([...usersPlayingStorefrontEnabledGamesApplicationIds, ...usersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds, ...areUsersInSocialLayerStorefrontMutualGuildsApplicationIds, ...stateFromStoresArray]), [displayProfile?.application, usersPlayingStorefrontEnabledGamesApplicationIds, usersPlayedSocialLayerStorefrontGamesInOutboxApplicationIds, areUsersInSocialLayerStorefrontMutualGuildsApplicationIds, stateFromStoresArray]);
};
@@ -0,0 +1,9 @@
// Metro module 8688 (f8689).
import { useSlayerStorefrontDevOverrideStore } from "./useSlayerStorefrontDevOverrideStore";
export function useSlayerStorefrontDevApplicationIdOverride() {
let r5 = useSlayerStorefrontDevOverrideStore((a0) => a0.overrideApplicationId);
if (r5 == null) {
r5 = void 0;
}
return r5;
}
@@ -0,0 +1,25 @@
// Metro module 8689 (f8690).
import { create } from "../../../_bundle/Module644";
const r15 = create()((c16730_0) => ({
overrideApplicationId: null,
setOverrideApplicationId: (a0) => c16730_0({
overrideApplicationId: a0
}),
showSelfActivity: false,
setShowSelfActivity: (a0) => c16730_0({
showSelfActivity: a0
}),
recommendationApplicationIds: null,
setRecommendationApplicationIds: (a0) => c16730_0({
recommendationApplicationIds: a0 != null ? a0.split(",") : null
}),
overrideNitroEligibilityForSocialLayerStorefront: false,
setOverrideNitroEligibilityForSocialLayerStorefront: (a0) => c16730_0({
overrideNitroEligibilityForSocialLayerStorefront: a0
}),
isNitroEligibleForSocialLayerStorefront: false,
setIsNitroEligibleForSocialLayerStorefront: (a0) => c16730_0({
isNitroEligibleForSocialLayerStorefront: a0
})
}));
export { r15 as useSlayerStorefrontDevOverrideStore };
@@ -0,0 +1,132 @@
// Metro module 3161 (f3162).
import { loadJsonAsset } from "../../asset_json/native/AssetJsonUtils";
import * as _Module3162 from "../../../_bundle/Module3162";
import * as _Module3163 from "../../../_bundle/Module3163";
import * as _Module3164 from "../../../_bundle/Module3164";
import * as _Module3165 from "../../../_bundle/Module3165";
import * as _Module3166 from "../../../_bundle/Module3166";
import * as _Module3167 from "../../../_bundle/Module3167";
import * as _Module3168 from "../../../_bundle/Module3168";
import * as _Module3169 from "../../../_bundle/Module3169";
import * as _Module3170 from "../../../_bundle/Module3170";
import * as _Module3171 from "../../../_bundle/Module3171";
import * as _Module3172 from "../../../_bundle/Module3172";
import * as _Module3173 from "../../../_bundle/Module3173";
import * as _Module3174 from "../../../_bundle/Module3174";
import * as _Module3175 from "../../../_bundle/Module3175";
import * as _Module3176 from "../../../_bundle/Module3176";
import * as _Module3177 from "../../../_bundle/Module3177";
import * as _Module3178 from "../../../_bundle/Module3178";
import * as _Module3179 from "../../../_bundle/Module3179";
import * as _Module3180 from "../../../_bundle/Module3180";
import * as _Module3181 from "../../../_bundle/Module3181";
import * as _Module3182 from "../../../_bundle/Module3182";
import * as _Module3183 from "../../../_bundle/Module3183";
import * as _Module3184 from "../../../_bundle/Module3184";
import * as _Module3185 from "../../../_bundle/Module3185";
import * as _Module3186 from "../../../_bundle/Module3186";
import * as _Module3187 from "../../../_bundle/Module3187";
import * as _Module3188 from "../../../_bundle/Module3188";
import * as _Module3189 from "../../../_bundle/Module3189";
import * as _Module3190 from "../../../_bundle/Module3190";
import * as _Module3191 from "../../../_bundle/Module3191";
import * as _Module3192 from "../../../_bundle/Module3192";
import { createLoader, makeMessagesProxy } from "../../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module3162).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module3163).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module3164).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module3165).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module3166).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module3167).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module3168).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module3169).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module3170).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module3171).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module3172).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module3173).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module3174).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module3175).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module3176).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module3177).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module3178).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module3179).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module3180).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module3181).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module3182).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module3183).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module3184).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module3185).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module3186).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module3187).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module3188).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module3189).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module3190).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module3191).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module3192).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
@@ -0,0 +1,69 @@
// Metro module 8052 (f8053).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import SlayerStorefrontItemCard from "./SlayerStorefrontItemCard";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import InfoBox, { InfoBoxLooks } from "../../user_settings/authorized_apps/native/InfoBox";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
let useStyles;
const WarningBox = function WarningBox(props) {
let props2;
const { canStartAuthorization, hasAccountLinked, mobileAccountLinkingDisabled, sku, application } = props;
const styles = useStyles();
let r17 = null;
if (!hasAccountLinked) {
const r7 = {
look: InfoBoxLooks.WARNING,
style: styles.warningBox,
children: null
};
if (mobileAccountLinkingDisabled) {
r7.children = intl.formatToPlainString(SlayerStorefront_messages.BMMo2K, {
applicationName: application?.name
});
props2 = r7;
} else if (canStartAuthorization) {
r7.children = intl.formatToPlainString(t["EgCl+Q"], {
skuName: sku.name,
applicationName: application?.name
});
props2 = r7;
} else {
r7.children = intl.format(t["3T0cpx"], {});
props2 = r7;
}
r17 = <InfoBox {...props2} />;
}
return r17;
};
useStyles = createStyles({
container: {
alignItems: "center",
justifyContent: "center",
gap: 16,
marginTop: 20
},
text: {
textAlign: "center",
paddingHorizontal: 32
},
warningBox: {
marginHorizontal: 16
}
});
export default function SlayerStorefrontGiftPreview(props) {
const { sku, application, sender, hasAccountLinked, canStartAuthorization, mobileAccountLinkingDisabled = false } = props;
const styles = useStyles();
return sku == null ? null : <View style={styles.container}>
<SlayerStorefrontItemCard sku={sku} />
<Text variant="heading-md/normal" color="mobile-text-heading-primary" style={styles.text}>
{intl.formatToPlainString(t["2tBYtA"], {
sender,
skuName: sku.name,
applicationName: application?.name
})}
</Text>
<WarningBox canStartAuthorization={canStartAuthorization} hasAccountLinked={hasAccountLinked} mobileAccountLinkingDisabled={mobileAccountLinkingDisabled} sku={sku} application={application} />
</View>;
};
@@ -0,0 +1,76 @@
// Metro module 8053 (f8054).
import { useMemo } from "react";
import { ImageBackground, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { getCardImageURL, getCardBackgroundImageURL } from "../SlayerStorefrontUtils";
import { useDominantColorFromImage } from "../../voice_panel/native/card/DominantColorUtils";
import tinycolor from "../../../_bundle/tinycolor";
import FastImage from "../../../components_native/common/FastImage";
import Module4611 from "../../../_bundle/Module4611";
const useStyles = createStyles({
cardContainer: {
borderRadius: Module712.radii.md,
overflow: "hidden",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 4
},
shadowOpacity: 0.3,
shadowRadius: 8,
elevation: 8
},
cardImageBackground: {
width: "100%",
height: "100%",
alignItems: "center",
justifyContent: "center"
},
cardImage: {
width: "100%",
height: "100%",
resizeMode: "cover"
}
});
export default function SlayerStorefrontItemCard(props) {
let dominantColorFromImage;
const { sku, size: size2 = 220, containerStyle } = props;
dominantColorFromImage = void 0;
const styles = useStyles();
let r14 = size2;
if (typeof r14 !== "object") {
r14 = {
width: size2,
height: size2
};
}
const size = Math.max(r14.width, r14.height);
const memo = useMemo(() => getCardImageURL(sku, {
size
}), [sku, size]);
const memo2 = useMemo(() => getCardBackgroundImageURL(sku, {
size
}), [sku, size]);
dominantColorFromImage = useDominantColorFromImage(memo == null ? void 0 : memo.toString());
const memo3 = useMemo(() => dominantColorFromImage == null ? [Module712.colors.BACKGROUND_SURFACE_HIGH, Module712.colors.BACKGROUND_BASE_LOWEST] : [tinycolor(dominantColorFromImage).brighten(20).saturate(30).setAlpha(0.8).toRgbString(), tinycolor(dominantColorFromImage).saturate(50).setAlpha(0.9).toRgbString()], [dominantColorFromImage]);
return sku == null ? null : memo == null ? null : <View style={[styles.cardContainer, r14, containerStyle]}>
{memo2 != null ? <ImageBackground source={{
uri: memo2.toString()
}} style={styles.cardImageBackground}>
<FastImage source={{
uri: memo.toString()
}} style={styles.cardImage} />
</ImageBackground> : <Module4611 colors={memo3} start={{
x: 0,
y: 0
}} end={{
x: 1,
y: 1
}} style={styles.cardImageBackground}>
<FastImage source={{
uri: memo.toString()
}} style={styles.cardImage} />
</Module4611>}
</View>;
};
@@ -0,0 +1,34 @@
// Metro module 9761 (f9762).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { isAndroid } from "../../../utils/PlatformUtils";
import { ClydeIcon } from "../../../design/components/Icon/native/redesign/generated/ClydeIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
exclusiveBadge: {
flexDirection: "row",
alignItems: "center",
textAlignVertical: "center",
alignSelf: "flex-start",
gap: Module712.space.PX_4,
borderRadius: Module712.radii.round,
paddingHorizontal: Module712.space.PX_8,
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
exclusiveBadgeText: {
textTransform: "uppercase",
fontSize: Module712.space.PX_12,
lineHeight: isAndroid() ? Module712.space.PX_12 : Module712.space.PX_16
}
});
export function ExclusiveBadge() {
const styles = useStyles();
return <View style={styles.exclusiveBadge}>
<ClydeIcon size="xs" color={Module712.colors.WHITE} />
<Text variant="text-xs/bold" color="text-overlay-light" style={styles.exclusiveBadgeText}>
{intl.string(t.RiDMFz)}
</Text>
</View>;
}
@@ -0,0 +1,56 @@
// Metro module 9766 (f9767).
import SKUStore from "../../../stores/game_store/SKUStore";
import { AnalyticEvents, PaymentGateways } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { isIOS } from "../../../utils/PlatformUtils";
import { GiftACOMOrderExperiment } from "../../billing/native/ACOMExperiments";
import useMountEffect from "../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { SOCIAL_LAYER_STOREFRONT_GIFT_MODAL_KEY, closeSocialLayerStorefrontGiftModal } from "./SocialLayerStorefrontNativeActionCreators";
import { isSocialLayerStorefrontGiftingSupported } from "../../device/BillingPlatformUtils";
import UnsupportedFeatureModal from "../../billing/native/UnsupportedFeatureModal";
import { intl, t } from "../../../intl/index.native";
import { NativePaymentContextProvider } from "../../payments/native/NativePaymentContext";
import NativeCheckoutStoreProvider from "../../checkout/native/stores/NativeCheckoutStoreProvider";
import UnifiedGiftModal from "../../checkout/native/gifting/UnifiedGiftModal";
import SocialLayerStorefrontGiftProductDetails from "./SocialLayerStorefrontGiftProductDetails";
import SocialLayerStorefrontGiftPurchaseSection from "./SocialLayerStorefrontGiftPurchaseSection";
export default function SocialLayerStorefrontGiftModal(props) {
let r70;
let analyticsLocations;
const { skuId, analyticsLocations: analyticsLocations2, lockedRecipientUser, onGiftModalDismiss, giftingOrigin } = props;
analyticsLocations = void 0;
const stateFromStores = useStateFromStores([SKUStore], () => SKUStore.get(skuId), [skuId]);
analyticsLocations = useAnalyticsLocations([...analyticsLocations2, AnalyticsLocation.SLAYER_STOREFRONT_NATIVE_GIFT_MODAL]).analyticsLocations;
const paymentGateway = isIOS() ? PaymentGateways.APPLE_ADVANCED_COMMERCE : PaymentGateways.GOOGLE;
let enabled = GiftACOMOrderExperiment.useConfig({
location: "SocialLayerStorefrontGiftModal"
}).enabled;
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
location_stack: analyticsLocations,
type: SOCIAL_LAYER_STOREFRONT_GIFT_MODAL_KEY,
sku_id: skuId,
application_id: stateFromStores?.applicationId
});
});
let r52 = null;
if (stateFromStores != null) {
if (isSocialLayerStorefrontGiftingSupported()) {
if (enabled) {
enabled = paymentGateway === PaymentGateways.APPLE_ADVANCED_COMMERCE;
}
r70 = <NativePaymentContextProvider skuIDs={[]} activeSubscription={null}>
<NativeCheckoutStoreProvider key={skuId} paymentGateway={paymentGateway} orderRequired={enabled} skuIds={[skuId]} isGift activeSubscription={null} onOrderRetryCancellation={closeSocialLayerStorefrontGiftModal}>
<UnifiedGiftModal skuId={skuId} applicationId={stateFromStores.applicationId} analyticsLocations={analyticsLocations} lockedRecipientUser={lockedRecipientUser} onGiftModalDismiss={onGiftModalDismiss} giftingOrigin={giftingOrigin} validateRecipient={() => Promise.resolve(true)} renderProductDetails={() => <SocialLayerStorefrontGiftProductDetails sku={stateFromStores} />} renderPurchaseSection={(a0) => <SocialLayerStorefrontGiftPurchaseSection skuId={skuId} sku={stateFromStores} isPurchaseDisabled={a0.isPurchaseDisabled} giftOptions={a0.giftOptions} giftingOrigin={giftingOrigin} analyticsLocations={analyticsLocations} />} />
</NativeCheckoutStoreProvider>
</NativePaymentContextProvider>;
} else {
r70 = <UnsupportedFeatureModal onDismiss={onGiftModalDismiss} title={intl.string(t["JCFN/y"])} />;
}
r52 = r70;
}
return r52;
};
@@ -0,0 +1,65 @@
// Metro module 9767 (f9768).
import { useMemo } from "react";
import { Image as Image2, View } from "react-native";
import { PriceSetAssignmentPurchaseTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import { useFormattedSKUPrice } from "../../storefront/native/StorefrontNativeUtils.android";
import AvatarUtils from "../../../utils/AvatarUtils";
import SlayerStorefrontItemCard from "./SlayerStorefrontItemCard";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_16,
paddingVertical: Module712.space.PX_16,
borderWidth: 2,
borderColor: Module712.colors.BACKGROUND_BRAND,
borderRadius: Module712.radii.lg,
marginHorizontal: Module712.space.PX_16
},
text: {
flex: 1,
gap: Module712.space.PX_4
},
appInfo: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
appIcon: {
width: 20,
height: 20,
borderRadius: Module712.radii.xs
}
});
export default function SocialLayerStorefrontGiftProductDetails(props) {
const sku = props.sku;
const styles = useStyles();
const getOrFetchApplication = useGetOrFetchApplication(sku.applicationId);
const userPrice = useFormattedSKUPrice({
sku,
priceSetAssignmentPurchaseType: PriceSetAssignmentPurchaseTypes.GIFT
}).userPrice;
const memo = useMemo(() => getOrFetchApplication != null ? AvatarUtils.getApplicationIconURL({
id: getOrFetchApplication.id,
icon: getOrFetchApplication.icon,
size: 20
}) : null, [getOrFetchApplication]);
return <View style={styles.container}>
<SlayerStorefrontItemCard sku={sku} size={55} />
<View style={styles.text}>
{getOrFetchApplication != null && <View style={styles.appInfo}>
{memo != null && <Image2 source={{
uri: memo
}} style={styles.appIcon} />}
<Text variant="text-sm/medium" color="text-muted">{getOrFetchApplication.name}</Text>
</View>}
<Text variant="text-md/semibold">{sku.name}</Text>
</View>
{userPrice != null && <Text variant="text-md/semibold">{userPrice}</Text>}
</View>;
};
@@ -0,0 +1,139 @@
// Metro module 9768 (f9769).
import { useMemo, useState, useRef, useCallback } from "react";
import { View } from "react-native";
import { useNativeCheckoutStore } from "../../checkout/native/NativeCheckoutStore";
import UserStore from "../../../stores/UserStore";
import { AnalyticEvents } from "../../../Constants";
import { GiftingOrigin } from "../../premium/PremiumConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useSafeAreaInsetsKeyboardAware_native from "../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import { useStateFromStores } from "../../../_bundle/Module589";
import useInitialValue from "../../../hooks/useInitialValue";
import { v4 } from "../../../_bundle/Module514";
import { useUnmountEffect } from "../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import useSyncGiftOptionsToOrder from "../../checkout/native/useSyncGiftOptionsToOrder";
import useMobileSocialLayerPurchaseSKU_android from "./hooks/useMobileSocialLayerPurchaseSKU.android";
import { isIOS } from "../../../utils/PlatformUtils";
import Dispatcher from "../../../Dispatcher";
import { openSocialLayerStorefrontProductGiftPurchaseSuccessModal, closeSocialLayerStorefrontGiftModal } from "./SocialLayerStorefrontNativeActionCreators";
import { intl, t } from "../../../intl/index.native";
import { getMobileFinePrintMessageForApplication } from "../utils/SlayerStorefrontDisclaimerUtils";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles((a0) => ({
container: {
paddingBottom: Module712.space.PX_12 + a0,
paddingTop: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
...Module712.shadows.SHADOW_TOP_HIGH
},
legalCopy: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_4
}
}));
export default function SocialLayerStorefrontGiftPurchaseSection(props) {
let load_id, memo, setState, ref, callback, c17472_11;
const { skuId, sku, isPurchaseDisabled, giftOptions, giftingOrigin, analyticsLocations } = props;
load_id = void 0;
memo = void 0;
setState = void 0;
ref = void 0;
callback = void 0;
c17472_11 = void 0;
const styles = useStyles(useSafeAreaInsetsKeyboardAware_native().insets.bottom);
const getOrFetchApplication = useGetOrFetchApplication(sku?.applicationId);
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(giftOptions.recipient_id));
load_id = useInitialValue(() => v4());
memo = useMemo(() => ({
is_gift: true,
location_stack: analyticsLocations,
payment_type: "sku",
sku_id: skuId,
sku_type: sku?.type,
sku_product_line: sku?.productLine,
application_id: sku?.applicationId,
load_id
}), [analyticsLocations, skuId, sku?.type, sku?.productLine, sku?.applicationId, load_id]);
let loading;
[loading, setState] = useState(false);
ref = useRef("not_started");
useUnmountEffect(() => {
if (ref.current === "pending") {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_CANCELED, memo);
}
});
callback = useCallback(() => {
if (ref.current === "pending") {
ref.current = "failed";
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_FAILED, memo);
}
setState(false);
}, [memo]);
const nativeCheckoutStore = useNativeCheckoutStore((a0) => a0.orderRecord);
useSyncGiftOptionsToOrder(nativeCheckoutStore, giftOptions);
c17472_11 = useMobileSocialLayerPurchaseSKU_android({
skuId,
sku,
giftParams: useMemo(() => ({
isGift: true,
options: giftOptions
}), [giftOptions]),
analyticsLoadId: load_id,
analyticsLocations,
orderId: nativeCheckoutStore?.id,
analyticsData: memo,
onPurchaseComplete: () => {
ref.current = "succeeded";
if (isIOS()) {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_SUCCEEDED, memo);
}
setState(false);
if (!(giftOptions.recipient_id == null || giftingOrigin !== GiftingOrigin.USER_PROFILE_WISHLIST && giftingOrigin !== GiftingOrigin.DM_CHANNEL_WISHLIST)) {
Dispatcher.dispatch({
type: "WISHLIST_GIFT_SENT",
skuId,
recipientId: giftOptions.recipient_id
});
}
let orbsReward = sku?.orbsReward;
if (orbsReward == null) {
orbsReward = void 0;
}
openSocialLayerStorefrontProductGiftPurchaseSuccessModal({
skuId,
orbsReward,
recipient: stateFromStores,
analyticsLocations
}).then(closeSocialLayerStorefrontGiftModal);
},
onPurchaseError: callback,
onPurchasePending: () => {}
});
const text = intl.string(t.ouo4FK);
let r106 = getOrFetchApplication;
if (r106 == null) {
r106 = void 0;
}
return <View style={styles.container}>
<View style={styles.legalCopy}>
{getMobileFinePrintMessageForApplication(r106, text, {
shouldAppendDisclaimer: true
}).map((item, index) => <Text key={index} variant="text-xs/normal" color="text-muted">
{item}
</Text>)}
</View>
<Button variant="active" disabled={isPurchaseDisabled} loading={loading} text={text} onPress={() => {
ref.current = "pending";
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STARTED, memo);
setState(true);
c17472_11().catch(callback);
}} />
</View>;
};
@@ -0,0 +1,57 @@
// Metro module 9754 (f9755).
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl } from "../../../intl/index.native";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
import { getIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import { fetchSocialLayerStorefrontConfig } from "../SocialLayerStorefrontActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
let c6464_4 = "social-layer-storefront-product-details-native-modal";
let c6464_5 = "social-layer-storefront-native-gift-modal";
export { c6464_4 as SOCIAL_LAYER_STOREFRONT_PRODUCT_DETAILS_MODAL_KEY };
export const SOCIAL_LAYER_STOREFRONT_GIFT_MODAL_KEY = "social-layer-storefront-native-gift-modal";
export const SOCIAL_LAYER_STOREFRONT_SELF_PURCHASE_SUCCESS_MODAL_KEY = "social-layer-storefront-self-purchase-success-native-modal";
export const SOCIAL_LAYER_STOREFRONT_GIFT_PURCHASE_SUCCESS_MODAL_KEY = "social-layer-storefront-gift-purchase-success-native-modal";
export function openSocialLayerStorefrontUnsupportedOnMobileAlert() {
AlertActionCreators.show({
title: intl.string(SlayerStorefront_messages.XjhkM5),
body: intl.string(SlayerStorefront_messages.NBFa62)
});
}
export function openSocialLayerStorefrontProductDetailsModal(a0) {
if (getIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "social_layer_storefront_product_details_modal"
})) {
fetchSocialLayerStorefrontConfig();
ModalActionCreators.pushLazy(import("./SocialLayerStorefrontProductDetailsModal"), a0, c6464_4, {
presentation: "modal"
});
} else {
AlertActionCreators.show({
title: intl.string(SlayerStorefront_messages.XjhkM5),
body: intl.string(SlayerStorefront_messages.NBFa62)
});
}
}
export function closeSocialLayerStorefrontProductDetailsModal() {
ModalActionCreators.popWithKey(c6464_4);
}
export function openSocialLayerStorefrontGiftModal(a0) {
if (getIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "social_layer_storefront_gift_modal"
})) {
ModalActionCreators.pushLazy(import("./SocialLayerStorefrontGiftModal"), a0, c6464_5);
}
}
export function closeSocialLayerStorefrontGiftModal() {
ModalActionCreators.popWithKey(c6464_5);
}
export function openSocialLayerStorefrontProductSelfPurchaseSuccessModal(c17462_0) {
return AlertActionCreators.openLazy({
importer: () => import("./SocialLayerStorefrontPoductPurchaseSuccessModal").then(({ SocialLayerStorefrontProductSelfPurchaseSuccessModal }) => (a0) => <SocialLayerStorefrontProductSelfPurchaseSuccessModal {...c17462_0} {...a0} />)
});
}
export function openSocialLayerStorefrontProductGiftPurchaseSuccessModal(c17463_0) {
return AlertActionCreators.openLazy({
importer: () => import("./SocialLayerStorefrontPoductPurchaseSuccessModal").then(({ SocialLayerStorefrontProductGiftPurchaseSuccessModal }) => (a0) => <SocialLayerStorefrontProductGiftPurchaseSuccessModal {...c17463_0} {...a0} />)
});
}
@@ -0,0 +1,405 @@
// Metro module 9770 (f9771).
import _toArray from "../../../_bundle/_toArray";
import { useEffect, useMemo, useRef, useCallback } from "react";
import { Image as Image2, ScrollView, View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import SKUStore from "../../../stores/game_store/SKUStore";
import { SOCIAL_LAYER_DAYS_TO_CLAIM_ITEM } from "../SocialLayerStorefrontConstants";
import { AnalyticEvents, Orientation, VerticalGradient } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, withDelay, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { withSpring } from "../../../design/animation/reanimated/spring/spring";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
import { triggerHapticFeedback, HapticFeedbackTypes } from "../../haptics/HapticUtils.native";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getCardBackgroundImageURL, getCardImageURL } from "../SlayerStorefrontUtils";
import { lockOrientation, restoreDefaultOrientation } from "../../device/native/DeviceOrientation";
import Module4611 from "../../../_bundle/Module4611";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { HeaderBackButton } from "../../../_bundle/Module5150";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { intl, t } from "../../../intl/index.native";
import SlayerStorefrontItemCard from "./SlayerStorefrontItemCard";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import useStartAuthorize from "../../application_account_linking/native/useStartAuthorize";
import { useSocialLayerStorefrontMobileAccountLinkingDisabled } from "./hooks/useSocialLayerStorefrontMobileAccountLinkingDisabled";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import useMountEffect from "../../../hooks/useMountEffect";
import { SOCIAL_LAYER_STOREFRONT_SELF_PURCHASE_SUCCESS_MODAL_KEY, SOCIAL_LAYER_STOREFRONT_GIFT_PURCHASE_SUCCESS_MODAL_KEY } from "./SocialLayerStorefrontNativeActionCreators";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
import { ExperimentalGameControllerLinkIcon } from "../../../design/components/Icon/native/redesign/generated/ExperimentalGameControllerLinkIcon";
import UserUtils from "../../../utils/UserUtils";
let useStyles, useStyles2, __initData, __initData2, __initData3, c6477_21;
const PurchaseSuccessModalBase = function PurchaseSuccessModalBase(props) {
let ref, callback;
let sharedValue, sharedValue2;
const { sku, title, body, finePrint } = props;
let ctaLabel = props.ctaLabel;
const { ctaIcon, ctaLoading } = props;
let onCtaPress = props.onCtaPress;
const onClose = props.onClose;
ref = void 0;
callback = void 0;
const styles = useStyles();
const width = useWindowDimensions_native().width;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue = useSharedValue(0);
sharedValue2 = useSharedValue(0);
useEffect(() => {
sharedValue.set(stateFromStores ? 1 : withDelay(200, withSpring(1, {
duration: 500,
dampingRatio: 0.7
})));
sharedValue2.set(stateFromStores ? 1 : withDelay(200, withTiming(1, {
duration: 200
})));
}, [sharedValue, stateFromStores, sharedValue2]);
const r55 = () => ({
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [0.1, 1]),
transform: [{
scale: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [0, 1])
}]
});
r55.__closure = {
interpolate: _ReanimatedRexport.interpolate,
springInput: sharedValue
};
r55.__workletHash = 7750024112371;
r55.__initData = __initData;
const animatedStyle = useAnimatedStyle(r55);
const c = () => ({
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [0, 1]),
transform: [{
scale: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [0.75, 1])
}]
});
c.__closure = {
interpolate: _ReanimatedRexport.interpolate,
springInput: sharedValue
};
c.__workletHash = 3400602564931;
c.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(c);
const l = () => ({
opacity: _ReanimatedRexport.interpolate(sharedValue2.get(), [0, 1], [0.5, 0])
});
l.__closure = {
interpolate: _ReanimatedRexport.interpolate,
linearInput: sharedValue2
};
l.__workletHash = 4092396015860;
l.__initData = __initData3;
const animatedStyle3 = useAnimatedStyle(l);
const memo3 = useMemo(() => {
let r10 = getCardBackgroundImageURL(sku);
if (r10 == null) {
r10 = getCardImageURL(sku);
}
return r10 == null ? void 0 : r10.toString();
}, [sku]);
const memo4 = useMemo(() => ({
width
}), [width]);
ref = useRef(c6477_21);
callback = useCallback(() => {
const r8 = _toArray(ref.current);
const r12 = r8[0];
const current = r8.slice(1);
if (r12 != null && current.length === 0) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_HEAVY);
} else if (current.length >= c6477_21.length / 2) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
} else {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_MEDIUM);
}
if (r12 != null) {
setTimeout(callback, r12);
}
ref.current = current;
}, []);
useEffect(() => {
callback();
return () => {
ref.current = [];
};
}, [callback]);
useEffect(() => {
lockOrientation(Orientation.PORTRAIT);
return () => {
restoreDefaultOrientation();
};
}, []);
const r115 = [memo3 != null && <Image2 source={{
uri: memo3
}} style={styles.backdropImage} blurRadius={4} resizeMode="cover" />, <Module4611 style={styles.backdropGradient} start={VerticalGradient.START} end={VerticalGradient.END} locations={[0.4, 0.75, 1]} colors={["rgba(0,0,0,0)", "rgba(0,0,0,0.6)", "#000000"]} />, , ,];
const r147 = [<View style={styles.header}>
<HeaderBackButton onPress={onClose} backImage={() => <XSmallIcon size="lg" style={styles.closeButtonIcon} />} accessibilityLabel={intl.string(t.cpT0Cq)} labelVisible={false} />
</View>, <ScrollView style={{
flex: 1
}} contentContainerStyle={styles.body} alwaysBounceVertical={false}>
<ReanimatedRexport.View style={[styles.preview, animatedStyle]}>
<SlayerStorefrontItemCard sku={sku} size={250} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.messages, animatedStyle2]}>
<Text variant="heading-xl/semibold" color="text-overlay-light" style={styles.title}>{title}</Text>
<Text variant="text-md/medium" color="text-overlay-light" style={styles.description}>{body}</Text>
</ReanimatedRexport.View>
</ScrollView>, ,];
const r193 = [finePrint != null && <Text variant="text-xs/normal" color="text-muted" style={styles.finePrint}>{finePrint}</Text>, ,];
if (onCtaPress == null) {
onCtaPress = onClose;
}
if (ctaLabel == null) {
ctaLabel = intl.string(t.cpT0Cq);
}
r193[1] = <View style={styles.cta}>
<Button onPress={onCtaPress} text={ctaLabel} icon={ctaIcon} loading={ctaLoading} size="lg" grow />
</View>;
r147[2] = <View style={styles.footer}>{r193}</View>;
r115[2] = <SafeAreaPaddingView style={styles.main} top bottom left right>{r147}</SafeAreaPaddingView>;
r115[3] = <ReanimatedRexport.View style={[styles.curtain, animatedStyle3]} pointerEvents="none" />;
return <View style={[styles.root, memo4]}>{r115}</View>;
};
useStyles = createStyles({
root: {
flex: 1,
backgroundColor: Module712.colors.BLACK
},
backdropImage: {
position: "absolute",
inset: 0,
opacity: 0.45
},
backdropGradient: {
position: "absolute",
inset: 0
},
curtain: {
position: "absolute",
inset: 0,
backgroundColor: Module712.colors.BLACK
},
main: {
flex: 1
},
header: {
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
paddingHorizontal: Module712.space.PX_16
},
closeButtonIcon: {
tintColor: Module712.colors.WHITE
},
body: {
flexGrow: 1,
flexDirection: "column",
justifyContent: "center"
},
preview: {
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
},
messages: {
paddingTop: Module712.space.PX_24,
flexDirection: "column",
alignItems: "center",
justifyContent: "flex-start",
gap: Module712.space.PX_8
},
title: {
textAlign: "center",
marginHorizontal: Module712.space.PX_32
},
description: {
textAlign: "center",
marginHorizontal: Module712.space.PX_32
},
footer: {
marginBottom: Module712.space.PX_16
},
cta: {
marginHorizontal: Module712.space.PX_24
},
finePrint: {
textAlign: "center",
marginHorizontal: Module712.space.PX_24,
marginBottom: Module712.space.PX_12
}
});
useStyles2 = createStyles({
linkAccountIcon: {
marginRight: Module712.space.PX_4
}
});
__initData = {
code: "function SocialLayerStorefrontPoductPurchaseSuccessModalTsx1(){const{interpolate,springInput}=this.__closure;return{opacity:interpolate(springInput.get(),[0,1],[0.1,1]),transform:[{scale:interpolate(springInput.get(),[0,1],[0,1])}]};}"
};
__initData2 = {
code: "function SocialLayerStorefrontPoductPurchaseSuccessModalTsx2(){const{interpolate,springInput}=this.__closure;return{opacity:interpolate(springInput.get(),[0,1],[0,1]),transform:[{scale:interpolate(springInput.get(),[0,1],[0.75,1])}]};}"
};
__initData3 = {
code: "function SocialLayerStorefrontPoductPurchaseSuccessModalTsx3(){const{interpolate,linearInput}=this.__closure;return{opacity:interpolate(linearInput.get(),[0,1],[0.5,0])};}"
};
c6477_21 = [80, 79, 78, 75, 72, 50, 45, 35, 70];
export function SocialLayerStorefrontProductSelfPurchaseSuccessModal(props) {
let getOrFetchApplication, fetched, hasAlreadyLinked, canStartAuthorization, startAuthorization, memo, ref2, c17476_10;
const skuId = props.skuId;
props.orbsReward;
const { analyticsLocations, onClose } = props;
getOrFetchApplication = void 0;
fetched = void 0;
hasAlreadyLinked = void 0;
canStartAuthorization = void 0;
startAuthorization = void 0;
memo = void 0;
ref2 = void 0;
c17476_10 = void 0;
const styles2 = useStyles2();
const stateFromStores2 = useStateFromStores([SKUStore], () => SKUStore.get(skuId));
getOrFetchApplication = useGetOrFetchApplication(stateFromStores2?.applicationId);
const startAuthorize = useStartAuthorize(getOrFetchApplication == null ? null : getOrFetchApplication);
fetched = startAuthorize.fetched;
hasAlreadyLinked = startAuthorize.hasAlreadyLinked;
canStartAuthorization = startAuthorize.canStartAuthorization;
startAuthorization = startAuthorize.startAuthorization;
const socialLayerStorefrontMobileAccountLinkingDisabled = useSocialLayerStorefrontMobileAccountLinkingDisabled(stateFromStores2?.applicationId);
memo = useMemo(() => {
let r3 = analyticsLocations;
if (analyticsLocations == null) {
r3 = [];
}
return [...r3, AnalyticsLocation.SLAYER_STOREFRONT_NATIVE_PURCHASE_SUCCESS];
}, [analyticsLocations]);
ref2 = useRef({
analyticsLocations: memo,
skuId,
applicationId: stateFromStores2?.applicationId,
canStartAuthorization
});
useEffect(() => {
ref2.current.canStartAuthorization = canStartAuthorization;
}, [canStartAuthorization]);
useEffect(() => {
if (fetched) {
const current = ref2.current;
AnalyticsUtils.track(AnalyticEvents.SLAYER_STOREFRONT_LINK_ACCOUNT_STEP_VIEWED, {
location_stack: current.analyticsLocations,
sku_id: current.skuId,
application_id: current.applicationId,
is_gift: false,
is_account_linked: hasAlreadyLinked,
can_start_authorization: current.canStartAuthorization
});
}
}, [fetched, hasAlreadyLinked]);
const callback2 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.SLAYER_STOREFRONT_ACCOUNT_LINK_CLICKED, {
location_stack: memo,
sku_id: skuId,
application_id: stateFromStores2?.applicationId,
is_gift: false
});
startAuthorization({
analyticsLocations: memo
});
}, [startAuthorization, memo, skuId, stateFromStores2?.applicationId]);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
location_stack: memo,
type: SOCIAL_LAYER_STOREFRONT_SELF_PURCHASE_SUCCESS_MODAL_KEY,
sku_id: skuId,
application_id: stateFromStores2?.applicationId
});
});
const title = hasAlreadyLinked ? intl.string(t["5glWta"]) : intl.string(SlayerStorefront_messages.bRPsNX);
const r81 = (hasAlreadyLinked ? !hasAlreadyLinked : canStartAuthorization) && !socialLayerStorefrontMobileAccountLinkingDisabled;
c17476_10 = r81;
return <PurchaseSuccessModalBase sku={stateFromStores2} title={title} body={useMemo(() => {
let r23;
if (hasAlreadyLinked) {
const W2znvX = t.W2znvX;
let skuName2 = stateFromStores2?.name;
if (skuName2 == null) {
skuName2 = "";
}
let applicationName3 = getOrFetchApplication?.name;
if (applicationName3 == null) {
applicationName3 = "";
}
r23 = intl.formatToPlainString(W2znvX, {
skuName: skuName2,
applicationName: applicationName3
});
} else if (c17476_10) {
const r29 = t["EgCl+Q"];
let skuName = stateFromStores2?.name;
if (skuName == null) {
skuName = "";
}
let applicationName2 = getOrFetchApplication?.name;
if (applicationName2 == null) {
applicationName2 = "";
}
r23 = intl.formatToPlainString(r29, {
skuName,
applicationName: applicationName2
});
} else {
let applicationName = getOrFetchApplication?.name;
if (applicationName == null) {
applicationName = "";
}
r23 = intl.formatToPlainString(SlayerStorefront_messages.eNNnIG, {
applicationName
});
}
return r23;
}, [hasAlreadyLinked, r81, getOrFetchApplication?.name, stateFromStores2?.name])} finePrint={hasAlreadyLinked ? void 0 : intl.formatToPlainString(t.TTj7ME, {
numDays: SOCIAL_LAYER_DAYS_TO_CLAIM_ITEM
})} ctaLabel={r81 ? intl.string(t["VDAhr+"]) : void 0} ctaIcon={r81 ? <ExperimentalGameControllerLinkIcon size="xs" color={Module712.colors.WHITE} style={styles2.linkAccountIcon} /> : void 0} ctaLoading={!fetched} onCtaPress={r81 ? callback2 : void 0} onClose={onClose} />;
}
export function SocialLayerStorefrontProductGiftPurchaseSuccessModal(props) {
let memo2;
const skuId2 = props.skuId;
props.orbsReward;
const { recipient, analyticsLocations: analyticsLocations2, onClose } = props;
memo2 = void 0;
const stateFromStores3 = useStateFromStores([SKUStore], () => SKUStore.get(skuId2));
memo2 = useMemo(() => {
let r3 = analyticsLocations2;
if (analyticsLocations2 == null) {
r3 = [];
}
return [...r3, AnalyticsLocation.SLAYER_STOREFRONT_NATIVE_PURCHASE_SUCCESS];
}, [analyticsLocations2]);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
location_stack: memo2,
type: SOCIAL_LAYER_STOREFRONT_GIFT_PURCHASE_SUCCESS_MODAL_KEY,
sku_id: skuId2,
application_id: stateFromStores3?.applicationId
});
});
return <PurchaseSuccessModalBase sku={stateFromStores3} title={intl.string(t["5glWta"])} body={useMemo(() => {
const r15 = t["2VjPTw"];
const name = stateFromStores3?.name;
let giftRecipient = UserUtils.getName(recipient);
if (giftRecipient == null) {
giftRecipient = "your recipient";
}
return intl.formatToPlainString(r15, {
itemName: name,
giftRecipient
});
}, [stateFromStores3?.name, recipient])} onClose={onClose} />;
}
@@ -0,0 +1,543 @@
// Metro module 9755 (f9756).
import { useCallback, useMemo, useState, useRef, useEffect } from "react";
import { ScrollView, StyleSheet, View } from "react-native";
import { useNativeCheckoutStore } from "../../checkout/native/NativeCheckoutStore";
import SKUStore from "../../../stores/game_store/SKUStore";
import SocialLayerStorefrontStore from "../SocialLayerStorefrontStore";
import { SlayerShopPDPCTAType } from "../SocialLayerStorefrontAnalyticsConstants";
import { AnalyticEvents, PaymentGateways, PriceSetAssignmentPurchaseTypes } from "../../../Constants";
import Module689 from "../../../_bundle/Module689";
import Module712 from "../../../_bundle/Module712";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../design/components/Navigator/native/NavigatorConstants.native";
import { getThumbnailSrc, convertCarouselItemsToMediaItems, MOBILE_HERO_WIDTH_PX, MOBILE_HERO_HEIGHT_PX } from "../utils/carouselMediaItems";
import { VideoComponent } from "../../../components_native/common/Video";
import FastImage from "../../../components_native/common/FastImage";
import { Text, Heading } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { useFormattedSKUPrice } from "../../storefront/native/StorefrontNativeUtils.android";
import { PressableOpacity } from "../../../design/void/native";
import * as _StringUtils from "../../../utils/StringUtils";
import { getAssetURL } from "../../../utils/StoreUtils";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import NativePaymentHooks_android from "../../payments/native/hooks/NativePaymentHooks.android";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import useStartAuthorize from "../../application_account_linking/native/useStartAuthorize";
import { getCardImageURL } from "../SlayerStorefrontUtils";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import useInitialValue from "../../../hooks/useInitialValue";
import { v4 } from "../../../_bundle/Module514";
import useMountEffect, { useUnmountEffect } from "../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { SOCIAL_LAYER_STOREFRONT_PRODUCT_DETAILS_MODAL_KEY, openSocialLayerStorefrontProductSelfPurchaseSuccessModal, closeSocialLayerStorefrontProductDetailsModal, openSocialLayerStorefrontGiftModal } from "./SocialLayerStorefrontNativeActionCreators";
import { fetchSocialLayerStorefrontSkuForApplication } from "../SocialLayerStorefrontActionCreators";
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
import useMobileSocialLayerPurchaseSKU_android from "./hooks/useMobileSocialLayerPurchaseSKU.android";
import { isSlayerSkuAvailableOnThisPlatform } from "../../storefront/StorefrontUtils";
import { HeaderBackButton } from "../../../_bundle/Module5150";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import Module4611 from "../../../_bundle/Module4611";
import SlayerStorefrontItemCard from "./SlayerStorefrontItemCard";
import { ExclusiveBadge } from "./SocialLayerStorefrontBadges";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
import { Button } from "../../../design/components/Button/native/Button.native";
import { IconButton } from "../../../design/components/Button/native/IconButton.native";
import Module7858 from "../../../_bundle/Module7858";
import { getMobileFinePrintMessageForApplication } from "../utils/SlayerStorefrontDisclaimerUtils";
import { OTPACOMOrderExperiment } from "../../billing/native/ACOMExperiments";
import NativeCheckoutStoreProvider from "../../checkout/native/stores/NativeCheckoutStoreProvider";
import { NativePaymentContextProvider } from "../../payments/native/NativePaymentContext";
let c6465_18, c6465_19, useStyles, InGameItemTag, ProductPriceSection, BundleThumbnailRow, SKUNameAndDescriptionSection, ItemDetailsSection, SocialLayerStorefrontProductDetailsModal, SocialLayerStorefrontProductDetailsModalWithOrderCTX;
const HeroMedia = function HeroMedia(props) {
const mediaItem = props.mediaItem;
const styles3 = useStyles();
return mediaItem.type === "video" ? <View style={styles3.hero}>
<VideoComponent source={{
uri: mediaItem.src
}} poster={mediaItem.videoThumbnailSrc} muted resizeMode="cover" style={styles3.heroImage} />
</View> : mediaItem.backgroundSrc != null ? <View style={styles3.hero}>
<FastImage source={{
uri: mediaItem.backgroundSrc
}} style={StyleSheet.absoluteFill} resizeMode="cover" />
<FastImage source={{
uri: mediaItem.src
}} style={styles3.heroImage} resizeMode="cover" />
</View> : <View style={styles3.hero}>
<FastImage source={{
uri: mediaItem.src
}} style={styles3.heroImage} resizeMode="cover" />
</View>;
};
InGameItemTag = function InGameItemTag() {
return <Text variant="text-sm/medium" color="text-muted">
{intl.string(t.V91tvy)}
</Text>;
};
ProductPriceSection = function ProductPriceSection(props) {
const sku = props.sku;
const styles3 = useStyles();
const userPrice = useFormattedSKUPrice({
sku,
priceSetAssignmentPurchaseType: PriceSetAssignmentPurchaseTypes.DEFAULT
}).userPrice;
return userPrice != null ? <View style={styles3.priceSection}>
<InGameItemTag />
<View style={styles3.priceRow}>
<Text variant="text-md/bold" color="mobile-text-heading-primary">{userPrice}</Text>
</View>
</View> : null;
};
BundleThumbnailRow = function BundleThumbnailRow(props) {
const { items, mediaItems, selectedIndex, onSelectIndex, trackPDPClick } = props;
const styles = useStyles();
const callback = useCallback((a0) => {
trackPDPClick(SlayerShopPDPCTAType.CAROUSEL_ITEM);
onSelectIndex(a0);
}, [onSelectIndex, trackPDPClick]);
return <View style={styles.section}>
<Text variant="text-xs/semibold" color="text-muted">
{intl.string(t.U7DAV9)}
</Text>
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.bundleThumbnailRow}>
{mediaItems.map((mediaItem, index) => {
const r12 = items[index];
let accessibilityLabel = r12?.label;
if (accessibilityLabel == null) {
accessibilityLabel = r12?.title;
}
let selected = index === selectedIndex;
const props = {
accessibilityRole: "button",
accessibilityLabel,
accessibilityState: {
selected
},
onPress: () => callback(index),
style: [styles.thumbnail, selected ? styles.thumbnailSelected : selected],
children: null
};
const style = [styles.thumbnailInner, ,];
if (selected) {
selected = styles.thumbnailInnerSelected;
}
style[1] = selected;
props.children = <View style={style}>
<FastImage source={{
uri: getThumbnailSrc(mediaItem)
}} style={styles.thumbnailImage} resizeMode="cover" />
</View>;
return <PressableOpacity key={index} {...props} />;
})}
</ScrollView>
</View>;
};
SKUNameAndDescriptionSection = function SKUNameAndDescriptionSection(props) {
const sku = props.sku;
const styles3 = useStyles();
const isNullOrEmpty = _StringUtils.isNullOrEmpty(sku.name);
let r17 = null;
if (!isNullOrEmpty) {
const r26 = [<Heading variant="heading-xl/bold" color="mobile-text-heading-primary">{sku.name}</Heading>, ,];
const isNullOrEmpty2 = _StringUtils.isNullOrEmpty(sku.description);
r26[1] = isNullOrEmpty2 ? !isNullOrEmpty2 : <Text variant="text-md/medium" color="text-muted">{sku.description}</Text>;
r17 = <View style={styles3.section}>{r26}</View>;
}
return r17;
};
ItemDetailsSection = function ItemDetailsSection(props) {
let r49;
const { selectedItem, applicationId } = props;
const styles3 = useStyles();
const uri = selectedItem.labelIconAssetId != null ? getAssetURL(applicationId, selectedItem.labelIconAssetId) : null;
const title = selectedItem.title;
const r15 = title == null ? void 0 : title.trim();
const label = selectedItem.label;
const r18 = label == null ? void 0 : label.trim();
const description = selectedItem.description;
const r12 = description == null ? void 0 : description.trim();
L20: {
if (_StringUtils.isNullOrEmpty(r15) && _StringUtils.isNullOrEmpty(r18)) {
const isNullOrEmpty = _StringUtils.isNullOrEmpty(r12);
r49 = null;
if (isNullOrEmpty) {
break L20;
}
}
const isNullOrEmpty2 = _StringUtils.isNullOrEmpty(r15);
const r61 = [isNullOrEmpty2 ? !isNullOrEmpty2 : <Heading variant="heading-lg/bold" color="mobile-text-heading-primary">{r15}</Heading>, , ,];
const isNullOrEmpty3 = _StringUtils.isNullOrEmpty(r18);
r61[1] = isNullOrEmpty3 ? !isNullOrEmpty3 : <View style={styles3.labelRow}>
{uri != null && <FastImage source={{
uri
}} style={styles3.labelIcon} />}
<Text variant="text-sm/medium" color="text-muted">{r18}</Text>
</View>;
const isNullOrEmpty4 = _StringUtils.isNullOrEmpty(r12);
r61[2] = isNullOrEmpty4 ? !isNullOrEmpty4 : <Text variant="text-md/medium" color="text-default">{r12}</Text>;
r49 = <View style={styles3.section}>{r61}</View>;
}
return r49;
};
SocialLayerStorefrontProductDetailsModal = function SocialLayerStorefrontProductDetailsModal(props) {
let stateFromStores2, stateFromStores3, memo, load_id, memo2, ref, callback2, c17465_12, setState, ref2, callback3, c17465_16;
const { skuId, analyticsLocations } = props;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
memo = void 0;
load_id = void 0;
memo2 = void 0;
ref = void 0;
callback2 = void 0;
c17465_12 = void 0;
setState = void 0;
ref2 = void 0;
callback3 = void 0;
c17465_16 = void 0;
const styles2 = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const storeFront = NativePaymentHooks_android.useNativeIAPPayments().storeFront;
const stateFromStores = useStateFromStores([SKUStore], () => SKUStore.get(skuId));
stateFromStores2 = useStateFromStores([SKUStore], () => SKUStore.isFetching(skuId) || SKUStore.didFetchingSkuFail(skuId));
const getOrFetchApplication = useGetOrFetchApplication(stateFromStores?.applicationId);
const hasAlreadyLinked = useStartAuthorize(getOrFetchApplication == null ? null : getOrFetchApplication).hasAlreadyLinked;
stateFromStores3 = useStateFromStores([SocialLayerStorefrontStore], () => SocialLayerStorefrontStore.getSkuAssets());
const memo3 = useMemo(() => getCardImageURL(stateFromStores), [stateFromStores]);
const [state, onSelectIndex2] = useState(0);
memo = useMemo(() => {
let r3 = analyticsLocations;
if (analyticsLocations == null) {
r3 = [];
}
return [...r3, AnalyticsLocation.SLAYER_STOREFRONT_NATIVE_PDP];
}, [analyticsLocations]);
load_id = useInitialValue(() => v4());
memo2 = useMemo(() => ({
is_gift: false,
location_stack: memo,
payment_type: "sku",
sku_id: skuId,
sku_type: stateFromStores?.type,
sku_product_line: stateFromStores?.productLine,
application_id: stateFromStores?.applicationId,
load_id
}), [memo, skuId, stateFromStores?.type, stateFromStores?.productLine, stateFromStores?.applicationId, load_id]);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
location_stack: memo,
type: SOCIAL_LAYER_STOREFRONT_PRODUCT_DETAILS_MODAL_KEY,
sku_id: skuId,
application_id: stateFromStores?.applicationId
});
});
ref = useRef("not_started");
useUnmountEffect(() => {
if (ref.current === "pending") {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_CANCELED, memo2);
}
});
callback2 = useCallback((a0) => {
AnalyticsUtils.track(AnalyticEvents.SLAYER_STOREFRONT_PDP_ELEMENT_CLICKED, {
slayer_storefront_session_id: void 0,
sku_id: skuId,
guild_id: void 0,
application_id: stateFromStores?.applicationId,
cta_type: a0,
location_stack: memo
});
}, [skuId, stateFromStores?.applicationId, memo]);
const [items2, mediaItems] = useMemo(() => {
let r26;
if (stateFromStores?.applicationId == null) {
r26 = [[], []];
} else {
const tenantMetadata = stateFromStores.tenantMetadata;
let r6 = tenantMetadata == null ? void 0 : tenantMetadata.socialLayer?.carouselItems;
if (r6 == null) {
r6 = [];
}
r26 = convertCarouselItemsToMediaItems(r6, stateFromStores.applicationId, stateFromStores3, {
heroWidth: MOBILE_HERO_WIDTH_PX
});
}
return r26;
}, [stateFromStores, stateFromStores3]);
const r7 = mediaItems.length > 1;
const selectedIndex2 = state < mediaItems.length ? state : 0;
let selectedItem = items2[selectedIndex2];
if (selectedItem == null) {
selectedItem = null;
}
let mediaItem = mediaItems[selectedIndex2];
if (mediaItem == null) {
mediaItem = null;
}
const r119 = stateFromStores == null;
let r120 = void 0;
if (!r119) {
const tenantMetadata = stateFromStores.tenantMetadata;
const r122 = tenantMetadata == null;
r120 = void 0;
if (!r122) {
const socialLayer = tenantMetadata.socialLayer;
r120 = socialLayer == null ? void 0 : socialLayer.carouselItems?.length;
}
}
if (r120 == null) {
r120 = 0;
}
const r6 = r120 === items2.length;
c17465_12 = r6;
let loading;
[loading, setState] = useState(false);
ref2 = useRef(false);
useEffect(() => {
if (stateFromStores != null && stateFromStores.applicationId != null && !(c17465_12 || stateFromStores2 || ref2.current)) {
ref2.current = true;
fetchSocialLayerStorefrontSkuForApplication(stateFromStores.applicationId, stateFromStores.id, {
withGoogleSkuIds: isAndroid(),
countryCode: storeFront?.country,
paymentGateway: isIOS() ? PaymentGateways.APPLE : void 0
});
}
}, [stateFromStores, stateFromStores3, r6, stateFromStores2, storeFront?.country]);
callback3 = useCallback(() => {
if (ref.current === "pending") {
ref.current = "failed";
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_FAILED, memo2);
}
setState(false);
}, [memo2]);
const mobileSocialLayerPurchaseSKU_android = useMobileSocialLayerPurchaseSKU_android({
skuId,
sku: stateFromStores,
analyticsLoadId: load_id,
analyticsLocations: memo,
orderId: useNativeCheckoutStore((a0) => a0.orderRecord)?.id,
analyticsData: memo2,
onPurchaseComplete: () => {
ref.current = "succeeded";
if (isIOS()) {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_SUCCEEDED, memo2);
}
setState(false);
let orbsReward = stateFromStores?.orbsReward;
if (orbsReward == null) {
orbsReward = void 0;
}
openSocialLayerStorefrontProductSelfPurchaseSuccessModal({
skuId,
orbsReward,
analyticsLocations: memo
}).then(closeSocialLayerStorefrontProductDetailsModal);
},
onPurchaseError: () => {
callback3(null);
},
onPurchasePending: () => {}
});
c17465_16 = mobileSocialLayerPurchaseSKU_android;
const callback4 = useCallback(() => {
callback2(SlayerShopPDPCTAType.BUY_BUTTON);
ref.current = "pending";
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STARTED, memo2);
setState(true);
c17465_16().catch((error) => {
callback3(error);
});
}, [mobileSocialLayerPurchaseSKU_android, callback2, memo2, callback3]);
const callback5 = useCallback(() => {
callback2(SlayerShopPDPCTAType.GIFT_BUTTON);
openSocialLayerStorefrontGiftModal({
skuId,
analyticsLocations: memo
});
}, [skuId, memo, callback2]);
if (stateFromStores == null) {
return null;
}
let r169 = isSlayerSkuAvailableOnThisPlatform(stateFromStores);
const text = intl.string(t.boqtTA);
const style = [styles2.container, {
paddingTop: isIOS() ? 0 : safeAreaInsets_native.top
}];
const r221 = [<View style={styles2.header}>
<HeaderBackButton onPress={closeSocialLayerStorefrontProductDetailsModal} backImage={() => <XSmallIcon size="md" style={styles2.closeButtonIcon} />} accessibilityLabel={intl.string(t.cpT0Cq)} labelVisible={false} />
<Heading variant="heading-lg/bold" color="mobile-text-heading-primary" style={styles2.headerTitle}>
{getOrFetchApplication?.name}
</Heading>
</View>, , ,];
const r232 = [stateFromStores.exclusive && <Module4611 style={StyleSheet.absoluteFill} colors={[c6465_18, c6465_19]} pointerEvents="none" />, <ScrollView contentContainerStyle={styles2.scrollContent}>
{mediaItem != null ? <HeroMedia mediaItem={mediaItem} /> : memo3 != null && <SlayerStorefrontItemCard sku={stateFromStores} />}
{stateFromStores.exclusive && <View style={styles2.exclusiveBadgeContainer}>
<ExclusiveBadge />
</View>}
{r7 ? <>
<SKUNameAndDescriptionSection sku={stateFromStores} />
<BundleThumbnailRow items={items2} mediaItems={mediaItems} selectedIndex={selectedIndex2} onSelectIndex={onSelectIndex2} trackPDPClick={callback2} />
{stateFromStores.applicationId != null && selectedItem != null && <ItemDetailsSection selectedItem={selectedItem} applicationId={stateFromStores.applicationId} />}
</> : <SKUNameAndDescriptionSection sku={stateFromStores} />}
</ScrollView>];
r221[1] = <View style={styles2.scrollContainer}>{r232}</View>;
const r281 = [<ProductPriceSection sku={stateFromStores} />, r169 ? !r169 : <Text variant="text-xs/normal" color="text-muted" style={styles2.availabilityCopy}>
{intl.string(SlayerStorefront_messages.gndWN7)}
</Text>, , ,];
const r307 = [<View style={styles2.buyButton}>
<Button variant="primary" size="lg" text={text} loading={loading} disabled={loading ? loading : !r169} onPress={callback4} />
</View>, ,];
if (!loading) {
loading = !r169;
}
r307[1] = <IconButton icon={Module7858} variant="primary" size="lg" disabled={loading} accessibilityLabel={intl.string(t.QAZA5f)} onPress={callback5} />;
r281[2] = <View style={styles2.footerButtonRow}>{r307}</View>;
if (r169) {
let r330 = getOrFetchApplication;
if (r330 == null) {
r330 = void 0;
}
r169 = <View style={styles2.legalCopy}>
{getMobileFinePrintMessageForApplication(r330, text, {
shouldAppendDisclaimer: hasAlreadyLinked === false
}).map((item, index) => <Text key={index} variant="text-xs/normal" color="text-muted">
{item}
</Text>)}
</View>;
}
r281[3] = r169;
r221[2] = <View style={[styles2.footer, {
paddingBottom: safeAreaInsets_native.bottom + Module712.space.PX_16
}]}>{r281}</View>;
return <View style={style}>{r221}</View>;
};
SocialLayerStorefrontProductDetailsModalWithOrderCTX = function SocialLayerStorefrontProductDetailsModalWithOrderCTX(props) {
const paymentGateway = isIOS() ? PaymentGateways.APPLE_ADVANCED_COMMERCE : PaymentGateways.GOOGLE;
return <NativeCheckoutStoreProvider key={props.skuId} paymentGateway={paymentGateway} orderRequired={OTPACOMOrderExperiment.useConfig({
location: "SocialLayerStorefrontProductDetailsModal"
}).enabled && paymentGateway === PaymentGateways.APPLE_ADVANCED_COMMERCE} skuIds={[props.skuId]} isGift={false} activeSubscription={null} onOrderRetryCancellation={closeSocialLayerStorefrontProductDetailsModal}>
<SocialLayerStorefrontProductDetailsModal {...props} />
</NativeCheckoutStoreProvider>;
};
c6465_18 = Module689(Module712.unsafe_rawColors.BRAND_500).alpha(0.25).hex();
c6465_19 = Module689(Module712.unsafe_rawColors.BRAND_500).alpha(0).hex();
useStyles = createStyles({
container: {
flex: 1
},
header: {
height: NAV_BAR_HEIGHT,
flexDirection: "row",
alignItems: "center",
paddingHorizontal: Module712.space.PX_8,
gap: Module712.space.PX_8,
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE
},
headerTitle: {
flexShrink: 1
},
closeButtonIcon: {
tintColor: Module712.colors.INTERACTIVE_ICON_DEFAULT
},
scrollContent: {
alignItems: "stretch",
gap: Module712.space.PX_16,
paddingVertical: Module712.space.PX_16
},
scrollContainer: {
flex: 1
},
section: {
width: "100%",
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8
},
bundleThumbnailRow: {
flexDirection: "row",
gap: Module712.space.PX_8,
paddingVertical: Module712.space.PX_4
},
thumbnail: {
width: 64,
height: 64,
borderRadius: Module712.radii.md,
borderWidth: 2,
borderColor: "transparent"
},
thumbnailSelected: {
borderColor: Module712.colors.BORDER_STRONG
},
thumbnailInner: {
flex: 1,
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
thumbnailInnerSelected: {
margin: 2,
borderRadius: Module712.radii.sm
},
thumbnailImage: {
width: "100%",
height: "100%"
},
labelRow: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
labelIcon: {
width: Module712.space.PX_16,
height: Module712.space.PX_16
},
priceRow: {
flexDirection: "row",
alignItems: "center",
flexWrap: "wrap",
gap: Module712.space.PX_8
},
footer: {
paddingHorizontal: Module712.space.PX_16,
paddingTop: Module712.space.PX_12,
gap: Module712.space.PX_8,
borderTopWidth: 1,
borderTopColor: Module712.colors.BORDER_SUBTLE
},
footerButtonRow: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
},
buyButton: {
flex: 1
},
availabilityCopy: {
textAlign: "center"
},
legalCopy: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_4
},
hero: {
marginHorizontal: Module712.space.PX_16,
height: MOBILE_HERO_HEIGHT_PX,
borderRadius: Module712.radii.md,
overflow: "hidden",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
priceSection: {
width: "100%",
gap: Module712.space.PX_8
},
heroImage: {
width: "100%",
height: "100%"
},
exclusiveBadgeContainer: {
paddingHorizontal: Module712.space.PX_16
}
});
export default function WrappedSocialLayerStorefrontProductDetailsModal(props) {
return <NativePaymentContextProvider skuIDs={[]} activeSubscription={null}>
<SocialLayerStorefrontProductDetailsModalWithOrderCTX {...props} />
</NativePaymentContextProvider>;
};
@@ -0,0 +1,175 @@
// Metro module 10894 (f10895).
import { useMemo, useEffect } from "react";
import ApplicationStore from "../../applications/ApplicationStore";
import SKUStore from "../../../stores/game_store/SKUStore";
import { PaymentGateways } from "../../../Constants";
import { InviteTypes } from "../../instant_invite/Constants";
import getEmbedThemeColors from "../../messages/native/renderer/row_data/embeds/getEmbedThemeColors";
import { intl, t } from "../../../intl/index.native";
import isSocialLayerApplication from "../../applications/isSocialLayerApplication";
import * as _StorefrontUtils from "../../storefront/StorefrontUtils";
import { getCardImageURL } from "../SlayerStorefrontUtils";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
import { useIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import NativePaymentHooks_android from "../../payments/native/hooks/NativePaymentHooks.android";
import { CodedLinkType } from "../../coded_links/CodedLink";
import { fetchSocialLayerStorefrontSku, fetchSocialLayerStorefrontSkuForApplication } from "../SocialLayerStorefrontActionCreators";
import { isAndroid, isIOS } from "../../../_bundle/Module501";
import { useStateFromStoresArray } from "../../../_bundle/Module589";
import { isNotNullish } from "../../../utils/GlobalUtils";
import useGetOrFetchApplications from "../../applications/useGetOrFetchApplications";
export function createSocialLayerStorefrontProductDetailsEmbed(a0) {
const { skuId, guildOrApplication } = a0;
const embedThemeColors = getEmbedThemeColors(a0.theme);
const { colors, baseColors } = embedThemeColors;
const r12 = SKUStore.get(skuId);
const applicationId = r12?.applicationId;
const application = ApplicationStore.getApplication(applicationId);
const isFetching = SKUStore.isFetching(skuId);
const r16 = SKUStore.didFetchingSkuFail(skuId);
let r32 = applicationId != null;
if (r32) {
r32 = ApplicationStore.isFetchingApplication(applicationId);
}
const r35 = applicationId != null && ApplicationStore.didFetchingApplicationFail(applicationId);
let headerText = application?.name;
if (headerText == null) {
headerText = intl.string(t.vyaWs7).toUpperCase();
}
L21: {
L19: {
if (!isFetching) {
if (r12 == null && !isFetching && !r16) {
break L19;
}
if (!r32) {
if (applicationId == null) {
break L21;
}
if (application != null) {
break L21;
}
if (r32) {
break L21;
}
if (r35) {
break L21;
}
}
}
}
if (!(r12 != null && application != null)) {
return {
...baseColors,
headerText,
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD
};
}
}
if (r12 == null) {
return null;
}
L43: {
if (application != null && isSocialLayerApplication(application)) {
if (guildOrApplication.type === "guild" && application.guildId !== guildOrApplication.guildId) {
break L43;
}
if (guildOrApplication.type === "application" && application.id !== guildOrApplication.applicationId) {
break L43;
}
const isSlayerSkuAvailableOnThisPlatform = _StorefrontUtils.isSlayerSkuAvailableOnThisPlatform(r12);
const cardImageURL = getCardImageURL(r12);
let thumbnailUrl = cardImageURL == null ? void 0 : cardImageURL.toString();
if (thumbnailUrl == null) {
thumbnailUrl = application.getIconURL(64);
}
if (thumbnailUrl == null) {
thumbnailUrl = void 0;
}
return {
...baseColors,
headerText,
headerColor: colors.headerColor,
titleText: r12.name,
titleColor: colors.titleColor,
subtitle: intl.string(t.V91tvy),
subtitleColor: colors.subtitleColor,
thumbnailUrl,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
acceptLabelText: isSlayerSkuAvailableOnThisPlatform ? intl.string(t.boqtTA) : intl.string(SlayerStorefront_messages.BKf0MM),
acceptLabelColor: isSlayerSkuAvailableOnThisPlatform ? colors.acceptLabelGreenColor : void 0,
acceptLabelBackgroundColor: isSlayerSkuAvailableOnThisPlatform ? colors.acceptLabelGreenBackgroundColor : colors.acceptBlurpleLabelBackgroundColor,
embedCanBeTapped: true,
canBeAccepted: true,
type: InviteTypes.GUILD
};
}
}
return null;
}
export function useFetchSocialLayerStorefrontProductDetailsEmbedData(a0) {
let c18345_3, c18345_4;
const isEligibleForSocialLayerStorefrontMobilePurchasing = useIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "use_fetch_social_layer_storefront_product_details_embed_data"
});
const country = NativePaymentHooks_android.useNativeIAPPayments().storeFront?.country;
const [r28, r29] = useMemo(() => {
let r6;
const r1 = [];
const r4 = [, ,];
if (isEligibleForSocialLayerStorefrontMobilePurchasing) {
r4[0] = r1;
r4[1] = [];
r6 = a0.reduce((acc, item) => {
const [r28, r29] = acc;
for (const codedLink of item.codedLinks) {
const { type, code } = codedLink;
if (type === CodedLinkType.SOCIAL_LAYER_STOREFRONT) {
r28.push(code.split("-"));
} else if (type === CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
r29.push(code.split("-"));
}
}
return [r28, r29];
}, r4);
} else {
r4[0] = r1;
r4[1] = [];
r6 = r4;
}
return r6;
}, [isEligibleForSocialLayerStorefrontMobilePurchasing, a0]);
c18345_3 = r28;
c18345_4 = r29;
useEffect(() => {
for (const item of c18345_3) {
const [r13, r38] = item;
if (!(SKUStore.get(r13) != null || SKUStore.isFetching(r13) || SKUStore.didFetchingSkuFail(r13))) {
fetchSocialLayerStorefrontSku(r38, r13, {
withGoogleSkuIds: isAndroid(),
countryCode: country,
paymentGateway: isIOS() ? PaymentGateways.APPLE : void 0
});
}
}
for (const item2 of c18345_4) {
const [r79, r81] = item2;
if (!(SKUStore.get(r79) != null || SKUStore.isFetching(r79) || SKUStore.didFetchingSkuFail(r79))) {
fetchSocialLayerStorefrontSkuForApplication(r81, r79, {
withGoogleSkuIds: isAndroid(),
countryCode: country,
paymentGateway: isIOS() ? PaymentGateways.APPLE : void 0
});
}
}
}, [r28, r29, country]);
useGetOrFetchApplications(useStateFromStoresArray([SKUStore], () => [...new Set([...c18345_3.map((item) => {
const [r3] = item;
return SKUStore.get(r3);
}), ...c18345_4.map((item) => {
const [r3] = item;
return SKUStore.get(r3);
})].filter(isNotNullish).map((item) => item.applicationId))], [r29, r28]));
}
@@ -0,0 +1,28 @@
// Metro module 9759 (f9760).
import { useEffect } from "react";
import { PriceSetAssignmentPurchaseTypes } from "../../../../Constants";
import { loadInAppSkus } from "../../../../actions/native/GPlayActionCreators";
import useMobilePurchaseSKU_android from "../../../billing/native/hooks/useMobilePurchaseSKU.android";
export default function useMobileSocialLayerPurchaseSKU({ sku, ...rest }) {
const isGift = rest.giftParams?.isGift;
const r7 = isGift != null && isGift ? PriceSetAssignmentPurchaseTypes.GIFT : PriceSetAssignmentPurchaseTypes.DEFAULT;
let r18 = sku?.googleSkuIds;
if (r18 == null) {
r18 = {};
}
let platformSkuId = r18[r7];
if (platformSkuId == null) {
platformSkuId = null;
}
let c17467_0 = platformSkuId;
useEffect(() => {
if (c17467_0 != null) {
loadInAppSkus([c17467_0]);
}
}, [platformSkuId]);
return useMobilePurchaseSKU_android({
...rest,
platformSkuId,
isFreeForStaffSelfPurchase: false
});
};
@@ -0,0 +1,6 @@
// Metro module 8047 (f8048).
import SocialLayerStorefrontStore from "../../SocialLayerStorefrontStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
export function useSocialLayerStorefrontMobileAccountLinkingDisabled(a0) {
return useStateFromStores([SocialLayerStorefrontStore], () => a0 != null && SocialLayerStorefrontStore.getConfigForApplicationId(a0)?.disableMobileAccountLinking === true, [a0]);
}
@@ -0,0 +1,100 @@
// Metro module 6687 (f6688).
import GuildStore from "../../stores/GuildStore";
import SocialLayerStorefrontStore from "./SocialLayerStorefrontStore";
import { GuildFeatures, Routes } from "../../Constants";
import { fetchSocialLayerStorefront, fetchSocialLayerStorefrontForApplication } from "./SocialLayerStorefrontActionCreators";
import { getSocialLayerStorefrontGuildId } from "./SlayerStorefrontUtils";
import { transitionTo } from "../routing/router_utils";
import { startLurking } from "../../utils/GuildDiscoveryUtils";
import InstantInviteActionCreators from "../../actions/InstantInviteActionCreators";
const navigateToSocialLayerStorefrontWithGuildPreview = async function navigateToSocialLayerStorefrontWithGuildPreview(c25948_0) {
let r95;
let c25948_2;
let c29812_0, c29812_1, c29812_2, c29812_3, c29812_4, c29812_5, c29812_6;
L28: {
c25948_2 = void 0;
c29812_0 = void 0;
c29812_1 = void 0;
c29812_2 = void 0;
c29812_3 = void 0;
c29812_4 = void 0;
c29812_0 = c25948_0.guildId;
c29812_1 = c25948_0.invite;
c29812_2 = c25948_0.pageIndex;
c29812_3 = c25948_0.skuId;
c29812_4 = c25948_0.slug;
c29812_5 = void 0;
c29812_6 = void 0;
await void 0;
c29812_5 = null;
if (c29812_1 != null) {
c29812_0 = c29812_1.guild?.id;
c29812_5 = new Set(c29812_1.guild?.features);
}
if (c29812_0 != null) {
c29812_6 = GuildStore.getGuild(c29812_0);
const joinedAt = c29812_6?.joinedAt;
L20: {
if (joinedAt == null) {
if (c29812_5 != null && !c29812_5.has(GuildFeatures.PREVIEW_ENABLED)) {
if (c29812_1 != null) {
await InstantInviteActionCreators.acceptInvite({
inviteKey: c29812_1.code,
context: {
location: "game_shop"
},
skipOnboarding: true
});
break L20;
}
break L20;
}
await startLurking(c29812_0, {}, {
shouldNavigate: false
});
}
}
r95 = transitionTo(Routes.CHANNELS_GAME_SHOP(c29812_0, c29812_2, c29812_3, c29812_4));
break L28;
}
return void 0;
}
return r95;
};
export default function navigateToSocialLayerStorefront({ applicationId, guildId, pageIndex, invite, skuId, slug }) {
let r9 = applicationId;
if (r9 == null) {
r9 = SocialLayerStorefrontStore.getApplicationIdFromGuildId(guildId);
}
let guildId2 = guildId;
if (guildId2 == null) {
guildId2 = getSocialLayerStorefrontGuildId(applicationId);
}
return r9 == null && (guildId2 == null && invite == null) ? Promise.resolve() : r9 != null ? Promise.resolve(transitionTo(Routes.COLLECTIBLES_SHOP_GAME_SHOP(r9, pageIndex, skuId, slug))) : navigateToSocialLayerStorefrontWithGuildPreview({
guildId: guildId2,
pageIndex,
invite,
skuId,
slug
});
};
export function eagerNavigateToSocialLayerStorefront(a0) {
let guildId = a0.guildId;
const { invite, forceFetch } = a0;
if (invite != null) {
guildId = invite.guild?.id;
}
if (guildId != null) {
fetchSocialLayerStorefront(guildId, {
eager: true,
forceFetch
});
}
}
export function eagerNavigateToSocialLayerStorefrontForApplication(a0) {
fetchSocialLayerStorefrontForApplication(a0.applicationId, {
eager: true,
forceFetch: a0.forceFetch
});
}
export { navigateToSocialLayerStorefrontWithGuildPreview };
@@ -0,0 +1,146 @@
// Metro module 9764 (f9765).
import LocaleStore from "../../user_settings/LocaleStore";
import SocialLayerStorefrontStore from "../SocialLayerStorefrontStore";
import { MarketingURLs } from "../../../Constants";
import { StorefrontPlatform } from "../../../_bundle/Module9765";
import { intl, t } from "../../../intl/index.native";
import SlayerStorefront_messages from "../intl/SlayerStorefront.messages";
let $mk83283 = function() {
return (a0) => c6472_6[a0];
};
const r19 = {};
r19[StorefrontPlatform.DESKTOP] = "PC";
r19[StorefrontPlatform.XBOX] = "Xbox";
r19[StorefrontPlatform.PLAYSTATION] = "PlayStation";
r19[StorefrontPlatform.SWITCH] = "Switch";
r19[StorefrontPlatform.APPLE_ARCADE] = "Apple Arcade";
r19[StorefrontPlatform.NETFLIX] = "Netflix";
r19[StorefrontPlatform.AMAZON_KIDS_PLUS] = "Amazon Kids+";
let c6472_6 = r19;
let c6472_7 = [StorefrontPlatform.PLAYSTATION];
export function getNotSupportedSentence(a0) {
let r7;
if (a0 == null) {
r7 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(a0);
r7 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
return r7.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r7.map($mk83283())),
count: r7.length
}) : "";
}
export function getCheckoutDisclaimerMessageForApplication(a0) {
let r26;
const id = a0?.id;
if (id == null) {
r26 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(id);
r26 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
return intl.format(SlayerStorefront_messages.Q0dHYO, {
platforms_info: r26.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r26.map($mk83283())),
count: r26.length
}) : ""
});
}
export function getFinePrintMessageForApplication(a0, { shouldAppendDisclaimer }) {
let r32, r44;
let applicationName = a0?.name;
if (applicationName == null) {
applicationName = "game's";
}
if (shouldAppendDisclaimer) {
const r6 = SlayerStorefront_messages["3ah/a2"];
const id = a0?.id;
if (id == null) {
r44 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(id);
r44 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
r32 = intl.format(r6, {
applicationName,
platforms_info: intl.format(SlayerStorefront_messages.Q0dHYO, {
platforms_info: r44.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r44.map($mk83283())),
count: r44.length
}) : ""
})
});
} else {
r32 = intl.format(t.CVITgq, {
applicationName
});
}
return r32;
}
export function getMobileFinePrintMessageForApplication(a0, a1, { shouldAppendDisclaimer }) {
let r17, r34;
let applicationName = a0?.name;
if (applicationName == null) {
applicationName = "game's";
}
const r9 = {
buyButtonLabel: a1,
paidServiceTermURL: MarketingURLs.PAID_TERMS,
applicationName
};
if (shouldAppendDisclaimer) {
const Q0dHYO = SlayerStorefront_messages.Q0dHYO;
const id = a0?.id;
if (id == null) {
r17 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(id);
r17 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
r34 = [intl.format(Q0dHYO, {
platforms_info: r17.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r17.map($mk83283())),
count: r17.length
}) : ""
}), intl.format(SlayerStorefront_messages.Ufm9XX, r9)];
} else {
r34 = [intl.format(SlayerStorefront_messages.Ufm9XX, r9)];
}
return r34;
}
export function getRedeemPurchaseDescriptionForApplication({ name, id }) {
let r27;
if (id == null) {
r27 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(id);
r27 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
return intl.format(SlayerStorefront_messages.fO4b1C, {
applicationName: name,
platforms_info: r27.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r27.map($mk83283())),
count: r27.length
}) : ""
});
}
export function getGiftLinkAccountDescriptionForApplication(a0, { hasAlreadyLinked }) {
let r35;
const name = a0.name;
const r6 = hasAlreadyLinked ? SlayerStorefront_messages.yqAKVO : SlayerStorefront_messages.vyAtfo;
const id = a0.id;
if (id == null) {
r35 = c6472_7;
} else {
const configForApplicationId = SocialLayerStorefrontStore.getConfigForApplicationId(id);
r35 = configForApplicationId == null ? c6472_7 : configForApplicationId.excludedPlatforms;
}
return intl.format(r6, {
applicationName: name,
platforms_info: r35.length !== 0 ? intl.formatToPlainString(SlayerStorefront_messages["5h8p5P"], {
platforms: new Intl.ListFormat(LocaleStore.locale).format(r35.map($mk83283())),
count: r35.length
}) : ""
});
}
@@ -0,0 +1,41 @@
// Metro module 9757 (f9758).
import { getAssetURL } from "../../../utils/StoreUtils";
import { LARGE_ASSET_FORMAT } from "../SlayerStorefrontUtils";
export const WEB_HERO_WIDTH_PX = 747;
export const WEB_HERO_HEIGHT_PX = 560;
export const MOBILE_HERO_WIDTH_PX = 343;
export const MOBILE_HERO_HEIGHT_PX = 257;
export const CAROUSEL_THUMBNAIL_SIZE = 112;
export function getThumbnailSrc(a0) {
return a0.thumbnailSrc != null ? a0.thumbnailSrc : a0.type === "video" ? a0.videoThumbnailSrc : a0.src;
}
export function convertCarouselItemsToMediaItems(a0, a1, a2, { heroWidth }) {
const r2 = [];
const r38 = [];
if (a0 != null && a0.length !== 0) {
for (const item of a0) {
const r47 = item.assetId != null ? a2[item.assetId] : null;
if (r47 != null) {
r2.push(item);
if (r47.mime_type.startsWith("video/")) {
r38.push({
type: "video",
src: getAssetURL(a1, r47, heroWidth, "mp4"),
videoThumbnailSrc: getAssetURL(a1, r47, heroWidth, "webp"),
thumbnailSrc: item.thumbnailAssetId != null ? getAssetURL(a1, item.thumbnailAssetId, 112, "webp") : void 0,
backgroundSrc: item.backgroundAssetId != null ? getAssetURL(a1, item.backgroundAssetId, heroWidth, LARGE_ASSET_FORMAT) : void 0
});
} else {
r38.push({
type: "image",
src: getAssetURL(a1, r47, heroWidth, "webp"),
thumbnailSrc: item.thumbnailAssetId != null ? getAssetURL(a1, item.thumbnailAssetId, 112, "webp") : void 0,
backgroundSrc: item.backgroundAssetId != null ? getAssetURL(a1, item.backgroundAssetId, heroWidth, LARGE_ASSET_FORMAT) : void 0
});
}
}
}
return [r2, r38];
}
return [r2, r38];
}