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,19 @@
// Metro module 8665 (f8666).
import { CollectiblesItemType } from "../../_bundle/Module1901";
import { intl, t } from "../../intl/index.native";
import * as _CollectiblesUtils from "../collectibles/CollectiblesUtils";
import { getIsProfileFrameGiftingEnabled } from "../collectibles/experiments/CollectiblesProfileFrameGiftingExperiment";
export function getProductNameAndTypeFromSku({ name, tenantMetadata }) {
const r7 = tenantMetadata == null ? void 0 : tenantMetadata.collectibles?.type;
return CollectiblesItemType.AVATAR_DECORATION === r7 ? intl.formatToPlainString(t.lvBzLi, {
product: name
}) : CollectiblesItemType.PROFILE_EFFECT === r7 ? intl.formatToPlainString(t.eR7moP, {
product: name
}) : CollectiblesItemType.NAMEPLATE === r7 ? intl.formatToPlainString(t.YFOwHj, {
product: name
}) : name;
}
export function isWishlistableCollectiblesProduct(a0) {
const isPremiumCollectiblesProduct = _CollectiblesUtils.isPremiumCollectiblesProduct(a0);
return isPremiumCollectiblesProduct ? !isPremiumCollectiblesProduct : a0.type !== CollectiblesItemType.EXTERNAL_SKU && !(a0.type === CollectiblesItemType.PROFILE_FRAME && !getIsProfileFrameGiftingEnabled("isWishlistableCollectiblesProduct"));
}
+52
View File
@@ -0,0 +1,52 @@
// Metro module 9773 (f9774).
import _slicedToArray from "../../_bundle/_slicedToArray";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c6480_1 = {
sentGifts: {}
};
class SentGiftsStore extends Module589.PersistedStore {
static displayName = "SentGiftsStore";
static persistKey = "SentGiftsStore";
initialize(a0) {
if (a0 != null) {
c6480_1 = a0;
this.cleanupExpiredGifts();
}
}
getState() {
return c6480_1;
}
hasSentGift(a0, a1) {
const r17 = c6480_1.sentGifts[`${a0}:${a1}`];
return r17 != null && !(new Date(r17.expiresAt) < new Date());
}
getSentGift(a0, a1) {
const r17 = c6480_1.sentGifts[`${a0}:${a1}`];
return r17 == null ? null : new Date(r17.expiresAt) < new Date() ? null : r17;
}
cleanupExpiredGifts() {
const date = new Date();
for (const item of Object.entries(c6480_1.sentGifts)) {
const r34 = _slicedToArray(item, 2);
const r35 = r34[0];
if (new Date(r34[1].expiresAt) < date) {
delete c6480_1.sentGifts[r35];
}
}
}
}
const sentGiftsStore = new SentGiftsStore(Dispatcher, {
WISHLIST_GIFT_SENT: function handleGiftSent(a0) {
const r14 = `${a0.skuId}:${a0.recipientId}`;
const date = new Date();
const date2 = new Date(date.getTime() + 172800000);
c6480_1.sentGifts[r14] = {
skuId: a0.skuId,
recipientId: a0.recipientId,
sentAt: date.toISOString(),
expiresAt: date2.toISOString()
};
}
});
export default sentGiftsStore;
@@ -0,0 +1,608 @@
// Metro module 8680 (f8681).
import UserProfileStore from "../user_profile/UserProfileStore";
import UserStore from "../../stores/UserStore";
import BillingInfoStore from "../../stores/billing/BillingInfoStore";
import WishlistRecommendationRecord from "./records/WishlistRecommendationRecord";
import WishlistRecord, { getWishlistSkuIds } from "./records/WishlistRecord";
import { PaymentGateways, Endpoints, AnalyticEvents } from "../../Constants";
import { isAndroid, isIOS } from "../../_bundle/Module501";
import { isNotNullish } from "../../utils/GlobalUtils";
import Dispatcher from "../../Dispatcher";
import { transformStorefrontPricesServer } from "../storefront/StorefrontUtils";
import { HTTP } from "../../_bundle/sendRequest";
import { WishlistFetchSource } from "./hooks/useWishlistHooks";
import SentryUtils_native from "../../utils/SentryUtils.native";
import { APIError } from "../../errors/index";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { fetchProfile } from "../../actions/UserActionCreators";
function $mk81137() {
return (a0) => a0.id;
}
function $mk115328($env) {
return function maybeDispatchAdditionalActionsForRecommendation(a0) {
Dispatcher.dispatch({
type: "SKUS_FETCH_SUCCESS",
skus: a0.skus
});
const { storefront_pricing, skus } = a0;
if (storefront_pricing != null) {
Dispatcher.dispatch({
type: "SKUS_PRICING_FETCH_SUCCESS",
priceId: {
type: "skus",
skuIds: skus.map($mk81137())
},
data: transformStorefrontPricesServer(storefront_pricing)
});
}
};
}
let maybeDispatchAdditionalActions;
let env5655 = {};
const extraWishlistParams = function extraWishlistParams() {
const r1 = {};
if (BillingInfoStore.ipCountryCode != null) {
r1.country_code = BillingInfoStore.ipCountryCode;
}
if (isAndroid()) {
r1.payment_gateway = PaymentGateways.GOOGLE;
} else if (isIOS()) {
r1.payment_gateway = PaymentGateways.APPLE;
}
return r1;
};
maybeDispatchAdditionalActions = function maybeDispatchAdditionalActions(a0) {
const skus = a0.wishlist_items.map((wishlist_item) => wishlist_item.sku).filter(isNotNullish);
Dispatcher.dispatch({
type: "SKUS_FETCH_SUCCESS",
skus
});
const storefront_pricing = a0.storefront_pricing;
if (storefront_pricing != null) {
Dispatcher.dispatch({
type: "SKUS_PRICING_FETCH_SUCCESS",
priceId: {
type: "skus",
skuIds: skus.map($mk81137())
},
data: transformStorefrontPricesServer(storefront_pricing)
});
}
};
const r35 = {
fetchWishlist: async (wishlistId, c16715_1, c16715_2) => {
let USER_PROFILE, c26260_3;
let c26260_4 = 0;
let c29962_0, c29962_1, c29962_2, c29962_3;
L16: {
try {
c29962_0 = void 0;
c29962_1 = void 0;
c29962_2 = void 0;
Dispatcher.dispatch({
type: "WISHLIST_FETCH_START",
wishlistId
});
c26260_4 = 1;
const r48 = {
url: Endpoints.USER_WISHLIST(wishlistId),
query: null,
rejectWithError: true
};
USER_PROFILE = c16715_2;
if (c16715_2 == null) {
USER_PROFILE = WishlistFetchSource.USER_PROFILE;
}
r48.query = {
source: USER_PROFILE,
...extraWishlistParams()
};
c29962_0 = await HTTP.get(r48);
if (c29962_0.body?.wishlist_items == null) {
SentryUtils_native.captureMessage("Wishlist items not found in response");
}
c29962_1 = c29962_0.body;
(0, maybeDispatchAdditionalActions)(c29962_1);
c29962_2 = WishlistRecord.fromServer(c29962_1);
Dispatcher.dispatch({
type: "WISHLIST_FETCH_SUCCESS",
wishlistId,
wishlistData: c29962_2,
updatedAt: c16715_1
});
c26260_4 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c26260_3 = r32;
if (c26260_4 !== 0) {
while (true) {
try {
const r122 = c26260_3;
c26260_4 = 0;
c29962_3 = r122;
Dispatcher.dispatch({
type: "WISHLIST_FETCH_FAILURE",
wishlistId,
error: new APIError(c29962_3)
});
SentryUtils_native.captureException(c29962_3);
break L16;
} catch (r118) {
r8 = r118;
c26260_3 = r118;
if (c26260_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
},
addSkuToWishlist: async (sku_id, c16716_1) => {
let c26261_2;
let c26261_3 = 0;
let c29963_1, c29963_2, c29963_3, c29963_4, c29963_0, c29963_5;
L17: {
try {
c29963_1 = void 0;
c29963_2 = void 0;
c29963_3 = void 0;
c29963_4 = void 0;
c29963_0 = null;
c26261_3 = 1;
const r54 = await HTTP.post({
url: Endpoints.USER_WISHLIST_ITEMS,
body: {
sku_id,
...extraWishlistParams()
},
rejectWithError: true
});
c29963_0 = r54;
c29963_1 = r54.body;
(0, maybeDispatchAdditionalActions)(c29963_1);
c29963_2 = WishlistRecord.fromServer(c29963_1);
Dispatcher.dispatch({
type: "WISHLIST_ADD_SKU_SUCCESS",
wishlistId: c29963_2.id,
skuId: sku_id,
wishlistData: c29963_2
});
if (c16716_1 != null) {
c26261_3 = 2;
c29963_3 = (0, getWishlistSkuIds)(c29963_2);
AnalyticsUtils.track(AnalyticEvents.WISHLIST_UPDATED, {
wishlist_id: c29963_2.id,
action_type: "ADD",
sku_id,
sku_ids: c29963_3,
location_stack: c16716_1
});
c26261_3 = 1;
}
c26261_3 = 0;
if (c29963_0 != null) {
c29963_4 = UserStore.getCurrentUser();
if (c29963_4 != null && UserProfileStore.getFirstWishlistId(c29963_4.id) == null) {
c26261_3 = 3;
await fetchProfile(c29963_4.id);
c26261_3 = 0;
}
}
} catch ($e) {
const r36 = $e;
let r8 = r36;
c26261_2 = r36;
let r37 = c26261_3;
if (r37 !== 0) {
while (true) {
if (r37 === 1) {
try {
const r219 = c26261_2;
c26261_3 = 0;
c29963_5 = r219;
Dispatcher.dispatch({
type: "WISHLIST_ADD_SKU_FAILURE",
skuId: sku_id,
error: new APIError(c29963_5)
});
throw c29963_5;
} catch (r216) {
r8 = r216;
c26261_2 = r216;
r37 = c26261_3;
if (r37 === 0) {
break;
}
}
} else if (r37 === 2) {
try {
c26261_3 = 1;
c26261_3 = 0;
if (c29963_0 == null) {
break L17;
}
c29963_4 = UserStore.getCurrentUser();
if (c29963_4 == null) {
break L17;
}
if (UserProfileStore.getFirstWishlistId(c29963_4.id) == null) {
c26261_3 = 3;
await fetchProfile(c29963_4.id);
c26261_3 = 0;
break L17;
}
break L17;
} catch (r164) {
r8 = r164;
c26261_2 = r164;
r37 = c26261_3;
if (r37 === 0) {
break;
}
}
} else {
try {
c26261_3 = 0;
break L17;
} catch (r160) {
r8 = r160;
c26261_2 = r160;
r37 = c26261_3;
if (r37 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
},
removeSkuFromWishlist: async (wishlistId2, skuId, c16717_2) => {
let c26262_2;
let c26262_3 = 0;
let c29964_0, c29964_1, c29964_2, c29964_3;
L11: {
try {
c29964_0 = void 0;
c29964_1 = void 0;
c29964_2 = void 0;
Dispatcher.dispatch({
type: "WISHLIST_REMOVE_SKU_START",
wishlistId: wishlistId2,
skuId
});
c26262_3 = 1;
c29964_0 = (await HTTP.del({
url: Endpoints.USER_WISHLIST_ITEM(wishlistId2, skuId),
query: {
...extraWishlistParams()
},
rejectWithError: true
})).body;
(0, maybeDispatchAdditionalActions)(c29964_0);
c29964_1 = WishlistRecord.fromServer(c29964_0);
Dispatcher.dispatch({
type: "WISHLIST_REMOVE_SKU_SUCCESS",
wishlistId: wishlistId2,
skuId,
wishlistData: c29964_1
});
if (c16717_2 != null) {
c26262_3 = 2;
c29964_2 = (0, getWishlistSkuIds)(c29964_1);
AnalyticsUtils.track(AnalyticEvents.WISHLIST_UPDATED, {
wishlist_id: c29964_1.id,
action_type: "REMOVE",
sku_id: skuId,
sku_ids: c29964_2,
location_stack: c16717_2
});
c26262_3 = 1;
}
c26262_3 = 0;
} catch ($e) {
const r30 = $e;
let r8 = r30;
c26262_2 = r30;
let r31 = c26262_3;
if (r31 !== 0) {
while (true) {
if (r31 === 1) {
try {
const r123 = c26262_2;
c26262_3 = 0;
c29964_3 = r123;
Dispatcher.dispatch({
type: "WISHLIST_REMOVE_SKU_FAILURE",
wishlistId: wishlistId2,
skuId,
error: new APIError(c29964_3)
});
throw c29964_3;
} catch (r120) {
r8 = r120;
c26262_2 = r120;
r31 = c26262_3;
if (r31 === 0) {
break;
}
}
} else {
try {
c26262_3 = 1;
c26262_3 = 0;
break L11;
} catch (r115) {
r8 = r115;
c26262_2 = r115;
r31 = c26262_3;
if (r31 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
},
updateWishlistVisibility: async (c16718_0, visibility) => {
let c26263_0, c26263_4;
let c26263_3 = 0;
let c29965_0, c29965_1;
L16: {
try {
c29965_0 = void 0;
const currentUser = UserStore.getCurrentUser();
c29965_0 = currentUser;
if (currentUser != null) {
c26263_3 = 1;
c26263_0 = maybeDispatchAdditionalActions;
c26263_0((await HTTP.patch({
url: Endpoints.USER_WISHLIST_PATCH(c16718_0),
body: {
visibility,
...extraWishlistParams()
},
rejectWithError: true
})).body);
Dispatcher.dispatch({
type: "WISHLIST_UPDATE_VISIBILITY_SUCCESS",
wishlistId: c16718_0,
visibility
});
c26263_3 = 2;
await fetchProfile(c29965_0.id);
c26263_3 = 1;
c26263_3 = 0;
break L16;
}
} catch ($e) {
const r33 = $e;
let r8 = r33;
c26263_4 = r33;
let r34 = c26263_3;
if (r34 !== 0) {
while (true) {
if (r34 === 1) {
try {
const r124 = c26263_4;
c26263_3 = 0;
c29965_1 = r124;
Dispatcher.dispatch({
type: "WISHLIST_UPDATE_VISIBILITY_FAILURE",
wishlistId: c16718_0,
error: new APIError(c29965_1)
});
throw c29965_1;
} catch (r121) {
r8 = r121;
c26263_4 = r121;
r34 = c26263_3;
if (r34 === 0) {
break;
}
}
} else {
try {
c26263_3 = 1;
c26263_3 = 0;
break L16;
} catch (r117) {
r8 = r117;
c26263_4 = r117;
r34 = c26263_3;
if (r34 === 0) {
break;
}
}
}
}
}
throw r8;
}
return void 0;
}
},
reorderWishlistItem: async (wishlistId3, skuId2, { previousSkuId, nextSkuId, newWishlistData, analyticsLocations }) => {
let c26264_2;
let c26264_3 = 0;
let c29966_0, c29966_1, c29966_2, c29966_3;
L12: {
try {
c29966_0 = void 0;
c29966_1 = void 0;
c29966_2 = void 0;
Dispatcher.dispatch({
type: "WISHLIST_REORDER_START",
wishlistId: wishlistId3,
skuId: skuId2,
previousSkuId,
nextSkuId,
newWishlistData
});
c26264_3 = 1;
c29966_0 = (await HTTP.patch({
url: Endpoints.USER_WISHLIST_ITEM(wishlistId3, skuId2),
body: {
previous_sku_id: previousSkuId,
next_sku_id: nextSkuId,
...extraWishlistParams()
},
rejectWithError: true
})).body;
(0, maybeDispatchAdditionalActions)(c29966_0);
c29966_1 = WishlistRecord.fromServer(c29966_0);
Dispatcher.dispatch({
type: "WISHLIST_REORDER_SUCCESS",
wishlistId: wishlistId3,
wishlistData: c29966_1
});
if (analyticsLocations != null) {
c26264_3 = 2;
c29966_2 = (0, getWishlistSkuIds)(c29966_1);
AnalyticsUtils.track(AnalyticEvents.WISHLIST_UPDATED, {
wishlist_id: wishlistId3,
action_type: "REORDER",
sku_id: skuId2,
sku_ids: c29966_2,
location_stack: analyticsLocations
});
c26264_3 = 1;
}
c26264_3 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c26264_2 = r32;
let r33 = c26264_3;
if (r33 !== 0) {
while (true) {
if (r33 === 1) {
try {
const r124 = c26264_2;
c26264_3 = 0;
c29966_3 = r124;
Dispatcher.dispatch({
type: "WISHLIST_REORDER_FAILURE",
wishlistId: wishlistId3,
skuId: skuId2,
error: new APIError(c29966_3)
});
SentryUtils_native.captureException(c29966_3);
break L12;
} catch (r121) {
r8 = r121;
c26264_2 = r121;
r33 = c26264_3;
if (r33 === 0) {
break;
}
}
} else {
try {
c26264_3 = 1;
c26264_3 = 0;
break L12;
} catch (r116) {
r8 = r116;
c26264_2 = r116;
r33 = c26264_3;
if (r33 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
},
fetchWishlistRecommendations: async function fetchWishlistRecommendations(applicationIds, userIds, r7 = 20) {
const max_recommendations = r7;
let r5 = arguments[3];
if (r5 === void 0) {
r5 = true;
}
const localize = r5;
let c26265_0, c26265_1, c26265_2;
let c26265_3 = 0;
const r19 = void 0;
const r18 = env5655;
L10: {
try {
let env29967;
c26265_1 = r19;
const r36 = env29967 = {
$parent: r18
};
c26265_0 = r36;
env29967[0] = void 0;
env29967[1] = void 0;
Dispatcher.dispatch({
type: "WISHLIST_RECOMMENDATIONS_FETCH_START",
userIds,
applicationIds
});
c26265_3 = 1;
env29967[0] = (await HTTP.get({
url: Endpoints.USER_WISHLIST_RECOMMENDATIONS,
query: {
application_ids: applicationIds,
user_ids: userIds,
max_recommendations,
localize,
...extraWishlistParams()
},
rejectWithError: true
})).body;
const r78 = env29967[0];
$mk115328(env5655)(r78);
env29967[1] = WishlistRecommendationRecord.fromServer(env29967[0]);
Dispatcher.dispatch({
type: "WISHLIST_RECOMMENDATIONS_FETCH_SUCCESS",
userIds,
applicationIds,
data: env29967[1]
});
c26265_3 = 0;
} catch ($e) {
const r34 = $e;
let r15 = r34;
c26265_2 = r34;
if (c26265_3 !== 0) {
while (true) {
try {
const r104 = c26265_2;
c26265_3 = 0;
env29967[2] = r104;
SentryUtils_native.captureException(env29967[2]);
Dispatcher.dispatch({
type: "WISHLIST_RECOMMENDATIONS_FETCH_FAILURE",
userIds,
applicationIds
});
break L10;
} catch (r100) {
r15 = r100;
c26265_2 = r100;
if (c26265_3 === 0) {
break;
}
}
}
}
throw r15;
}
}
}
};
export default r35;
@@ -0,0 +1,14 @@
// Metro module 12203 (f12204).
import { createContext, useContext } from "react";
const context = createContext(null);
export { context as WishlistAnalyticsContext };
export function useWishlistAnalyticsContext() {
return useContext(context);
}
export function WishlistAnalyticsProvider(props) {
const { newValue, children } = props;
return <context.Provider value={{
...useContext(context),
...newValue
}}>{children}</context.Provider>;
}
@@ -0,0 +1,91 @@
// Metro module 9750 (f9751).
import LocaleStore from "../user_settings/LocaleStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let locale, c6460_2;
const handleUserSettingsStoreUpdate = function handleUserSettingsStoreUpdate() {
if (locale === LocaleStore.locale) {
return false;
}
c6460_2 = {};
locale = LocaleStore.locale;
};
c6460_2 = {};
class WishlistRecommendationsStore extends Module589.Store {
initialize() {
this.waitFor(LocaleStore);
this.syncWith([LocaleStore], handleUserSettingsStoreUpdate);
locale = LocaleStore.locale;
}
getRecommendations(a0, a1) {
if (a0.length !== 0 && a1.length !== 0) {
if (a0.length === 0) {
throw new Error("No user IDs provided");
}
return c6460_2[[...a0, ...a1].join(",")];
}
}
}
const wishlistRecommendationsStore = new WishlistRecommendationsStore(Dispatcher, {
LOGOUT: function handleLogout() {
c6460_2 = {};
},
WISHLIST_RECOMMENDATIONS_FETCH_START: function handleFetchStart({ userIds, applicationIds }) {
if (userIds.length !== 0 && applicationIds.length !== 0) {
if (userIds.length === 0) {
throw new Error("No user IDs provided");
}
const r20 = [...userIds, ...applicationIds].join(",");
const r21 = {
...c6460_2
};
r21[r20] = {
state: "loading"
};
c6460_2 = r21;
return void 0;
}
return false;
},
WISHLIST_RECOMMENDATIONS_FETCH_SUCCESS: function handleFetchSuccess({ userIds, applicationIds, data }) {
if (userIds.length !== 0 && applicationIds.length !== 0) {
if (userIds.length === 0) {
throw new Error("No user IDs provided");
}
const r22 = [...userIds, ...applicationIds].join(",");
const r23 = {
...c6460_2
};
r23[r22] = {
state: "success",
data,
fetchedAt: Date.now()
};
c6460_2 = r23;
return void 0;
}
return false;
},
WISHLIST_RECOMMENDATIONS_FETCH_FAILURE: function handleFetchFailure({ userIds, applicationIds }) {
if (userIds.length !== 0 && applicationIds.length !== 0) {
if (userIds.length === 0) {
throw new Error("No user IDs provided");
}
const r23 = [...userIds, ...applicationIds].join(",");
if (c6460_2[r23]?.state === "success") {
return false;
}
const r29 = {
...c6460_2
};
r29[r23] = {
state: "error",
fetchedAt: Date.now()
};
c6460_2 = r29;
return void 0;
}
return false;
}
});
export default wishlistRecommendationsStore;
+221
View File
@@ -0,0 +1,221 @@
// Metro module 8674 (f8675).
import WishlistRecord, { getWishlistSkuIds, wishlistHasSkuId } from "./records/WishlistRecord";
import SentryUtils_native from "../../utils/SentryUtils.native";
import * as _UserProfileStore from "../user_profile/UserProfileStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c5649_6 = {};
class WishlistStore extends Module589.Store {
get(a0) {
let r4 = c5649_6[a0];
if (r4 == null) {
r4 = {
data: null,
status: "not_loaded"
};
}
return r4;
}
getWishlist(a0) {
return this.get(a0).data;
}
getWishlistItems(a0) {
const data = this.get(a0).data;
return data != null ? getWishlistSkuIds(data) : [];
}
hasSkuId(a0, a1) {
const data = this.get(a0).data;
return data != null && wishlistHasSkuId(data, a1);
}
getStatus(a0) {
return this.get(a0).status;
}
isFetching(a0) {
return this.getStatus(a0) === "fetching";
}
hasError(a0) {
return this.getStatus(a0) === "error";
}
getError(a0) {
return this.get(a0).error;
}
getUpdatedAt(a0) {
return this.get(a0).updatedAt;
}
getLastFetchedAt(a0) {
return this.get(a0).lastFetchedAt;
}
}
const wishlistStore = new WishlistStore(Dispatcher, {
WISHLIST_FETCH_START: function handleFetchStart({ wishlistId }) {
let r6 = c5649_6[wishlistId];
if (r6 == null) {
const r2 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r2;
r6 = r2;
}
r6.status = "fetching";
r6.error = void 0;
},
WISHLIST_FETCH_SUCCESS: function handleFetchSuccess({ wishlistId, wishlistData, updatedAt }) {
let r8 = c5649_6[wishlistId];
if (r8 == null) {
const r4 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r4;
r8 = r4;
}
r8.data = wishlistData;
r8.status = "success";
r8.error = void 0;
r8.updatedAt = updatedAt;
r8.lastFetchedAt = Date.now();
},
WISHLIST_FETCH_FAILURE: function handleFetchFailure({ wishlistId, error }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r3 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r3;
r7 = r3;
}
r7.status = "error";
r7.error = error;
},
WISHLIST_ADD_SKU_SUCCESS: function handleAddSkuSuccess({ wishlistId, wishlistData }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r3 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r3;
r7 = r3;
}
r7.data = wishlistData;
r7.status = "success";
r7.error = void 0;
r7.lastFetchedAt = Date.now();
},
WISHLIST_ADD_SKU_FAILURE: function handleAddSkuFailure(a0) {
SentryUtils_native.captureException(a0.error);
},
WISHLIST_REMOVE_SKU_START: function handleRemoveSkuStart({ wishlistId, skuId }) {
let r10 = c5649_6[wishlistId];
if (r10 == null) {
const r4 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r4;
r10 = r4;
}
if (r10.data != null) {
r10.data = new WishlistRecord({
id: r10.data.id,
userId: r10.data.userId,
items: r10.data.items.filter((item) => item.skuId !== skuId),
applications: r10.data.applications
});
}
},
WISHLIST_REMOVE_SKU_SUCCESS: function handleRemoveSkuSuccess({ wishlistId, wishlistData }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r3 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r3;
r7 = r3;
}
r7.data = wishlistData;
r7.status = "success";
r7.error = void 0;
r7.lastFetchedAt = Date.now();
},
WISHLIST_REMOVE_SKU_FAILURE: function handleRemoveSkuFailure({ wishlistId, error }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r4 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r4;
r7 = r4;
}
r7.updatedAt = void 0;
SentryUtils_native.captureException(error);
},
WISHLIST_UPDATE_VISIBILITY_SUCCESS: function handleUpdateVisibilitySuccess({ wishlistId }) {
let r2 = c5649_6[wishlistId];
if (r2 == null) {
const r6 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r6;
r2 = r6;
}
r2.status = "success";
r2.error = void 0;
r2.lastFetchedAt = Date.now();
},
WISHLIST_UPDATE_VISIBILITY_FAILURE: function handleUpdateVisibilityFailure(a0) {
SentryUtils_native.captureException(a0.error);
},
WISHLIST_REORDER_START: function handleReorderStart({ wishlistId, newWishlistData }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r3 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r3;
r7 = r3;
}
r7.data = newWishlistData;
},
WISHLIST_REORDER_SUCCESS: function handleReorderSuccess({ wishlistId, wishlistData }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r3 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r3;
r7 = r3;
}
r7.data = wishlistData;
r7.status = "success";
r7.error = void 0;
r7.lastFetchedAt = Date.now();
},
WISHLIST_REORDER_FAILURE: function handleReorderFailure({ wishlistId, error }) {
let r7 = c5649_6[wishlistId];
if (r7 == null) {
const r4 = {
data: null,
status: "not_loaded"
};
c5649_6[wishlistId] = r4;
r7 = r4;
}
r7.updatedAt = void 0;
SentryUtils_native.captureException(error);
},
WISHLIST_ITEM_PURCHASED: function handleWishlistItemPurchased({ recipientId, skuId: skuId2 }) {
const firstWishlistId = _UserProfileStore.default.getFirstWishlistId(recipientId);
if (firstWishlistId != null && c5649_6[firstWishlistId] != null && c5649_6[firstWishlistId].data != null && wishlistHasSkuId(c5649_6[firstWishlistId].data, skuId2)) {
c5649_6[firstWishlistId].updatedAt = void 0;
}
}
});
export default wishlistStore;
+84
View File
@@ -0,0 +1,84 @@
// Metro module 12176 (f12177).
import _slicedToArray from "../../_bundle/_slicedToArray";
import SKURecord from "../skus/SKURecord";
import { isCollectiblesWishlistItemRecord } from "./records/CollectiblesWishlistItemRecord";
import { isPremiumWishlistItemRecord } from "./records/PremiumWishlistItemRecord";
import { isSKUWishlistItemRecord } from "./records/SKUWishlistItemRecord";
import { SKUProductLines } from "../../Constants";
import { PremiumSubscriptionSKUs } from "../premium/PremiumConstants";
import { intl, t } from "../../intl/index.native";
import { isSlayerSkuAvailableOnThisPlatform } from "../storefront/StorefrontUtils";
import PremiumUtils from "../../utils/PremiumUtils";
export function createNitroSuggestedSku() {
return new SKURecord({
id: PremiumSubscriptionSKUs.TIER_2,
productLine: SKUProductLines.PREMIUM,
name: intl.string(t.lG6a5x),
features: new Set(),
genres: new Set(),
manifests: [],
availableRegions: [],
locales: [],
bundledSkuIds: [],
selectedOptions: [],
eligibleOffers: [],
prices: {}
});
}
export function isEligibleWishlistItemOnMobile(a0, a1) {
let r14;
let isWishlistOwner = a1.isWishlistOwner;
const isSocialLayerStorefrontMobilePurchasingEnabled = a1.isSocialLayerStorefrontMobilePurchasingEnabled;
if (isSKUWishlistItemRecord(a0) && a0.sku.productLine === SKUProductLines.SOCIAL_LAYER_GAME_ITEM) {
let r16 = !!isSocialLayerStorefrontMobilePurchasingEnabled;
if (r16) {
if (!isWishlistOwner) {
isWishlistOwner = isSlayerSkuAvailableOnThisPlatform(a0.sku);
}
r16 = isWishlistOwner;
}
r14 = r16;
} else {
r14 = isCollectiblesWishlistItemRecord(a0) || isPremiumWishlistItemRecord(a0);
}
return r14;
}
export function buildReorderedWishlistData(a0, a1, a2, a3) {
let nextSkuId, previousSkuId;
if (a2 < a3) {
let r20 = a1[a3]?.skuId;
if (r20 == null) {
r20 = null;
}
let r9 = a1[a3 + 1]?.skuId;
if (r9 == null) {
r9 = null;
}
nextSkuId = r9;
previousSkuId = r20;
} else {
previousSkuId = a1[a3 - 1]?.skuId;
if (previousSkuId == null) {
previousSkuId = null;
}
nextSkuId = a1[a3]?.skuId;
if (nextSkuId == null) {
nextSkuId = null;
}
}
const r27 = [...a1];
r27.splice(a3, 0, _slicedToArray(r27.splice(a2, 1), 1)[0]);
return {
newWishlistData: a0.set("items", r27),
previousSkuId,
nextSkuId
};
}
export function buildReorderedNitroFirstWishlistItems(a0) {
const r6 = a0.findIndex((item) => PremiumUtils.isPremiumSku(item.skuId));
if (r6 <= 0) {
return a0;
}
const r10 = [...a0];
return [_slicedToArray(r10.splice(r6, 1), 1)[0], ...r10];
}
@@ -0,0 +1,27 @@
// Metro module 12193 (f12194).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-07-smag-mobile-wishlist-suggestions",
kind: "user",
defaultConfig: {
isEnabled: false
},
variations: {
0: {
isEnabled: false
},
1: {
isEnabled: true
}
}
});
export function useIsMobileWishlistSuggestionsEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).isEnabled;
}
export function getIsMobileWishlistSuggestionsEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).isEnabled;
}
@@ -0,0 +1,44 @@
// Metro module 12202 (f12203).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-03-wishlisting-nitro",
kind: "user",
defaultConfig: {
isEnabled: false,
isRoadblocksEnabled: false
},
variations: {
0: {
isEnabled: false,
isRoadblocksEnabled: false
},
1: {
isEnabled: true,
isRoadblocksEnabled: false
},
2: {
isEnabled: true,
isRoadblocksEnabled: true
}
}
});
export function useIsNitroWishlistingEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).isEnabled;
}
export function getIsNitroWishlistingEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).isEnabled;
}
export function useAreNitroWishlistRoadblocksEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).isRoadblocksEnabled;
}
export function getAreNitroWishlistRoadblocksEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).isRoadblocksEnabled;
}
@@ -0,0 +1,46 @@
// Metro module 12201 (f12202).
import { useMemo } from "react";
import { PremiumSubscriptionSKUs } from "../../premium/PremiumConstants";
import { useRecommendationsForSingleUser } from "./useWishlistRecommendations";
import { useIsNitroWishlistingEnabled } from "../experiments/WishlistingNitroExperiment";
import { createNitroSuggestedSku } from "../WishlistUtils";
export function useAddToWishlistGridItems(a0) {
let c19727_4;
const { userId, wishlist, numWishlistItemsToRecommend: numWishlistItemsToRecommend2, maxWishlistItemsToShow = numWishlistItemsToRecommend2 } = a0;
const numWishlistItemsToRecommend = maxWishlistItemsToShow;
const source = a0.source;
c19727_4 = void 0;
const recommendationsForSingleUser = useRecommendationsForSingleUser({
userId,
numItems: numWishlistItemsToRecommend2,
source
});
const { recommendations, status } = recommendationsForSingleUser;
const isNitroWishlistingEnabled = useIsNitroWishlistingEnabled("add_to_wishlist_grid_suggested_nitro");
const memo = useMemo(() => {
const r5 = Set;
let r11 = wishlist == null ? void 0 : wishlist.items.map((item) => item.skuId);
if (r11 == null) {
r11 = [];
}
return new r5(r11);
}, [wishlist]);
const r28 = isNitroWishlistingEnabled && status === "success" && !memo.has(PremiumSubscriptionSKUs.TIER_2);
c19727_4 = r28;
return {
items: useMemo(() => {
const r11 = recommendations.filter((recommendation) => !memo.has(recommendation.id)).map((item) => ({
sku: item,
itemSource: "recommendation"
}));
if (c19727_4) {
r11.unshift({
sku: createNitroSuggestedSku(),
itemSource: "takeover"
});
}
return r11.slice(0, numWishlistItemsToRecommend);
}, [recommendations, memo, r28, numWishlistItemsToRecommend]),
status
};
}
@@ -0,0 +1,6 @@
// Metro module 9751 (f9752).
import { useMemo } from "react";
import { COLLECTIBLES_APPLICATION_ID } from "../../../Constants";
export function useWishlistApplicationIds() {
return useMemo(() => [COLLECTIBLES_APPLICATION_ID], []);
}
@@ -0,0 +1,14 @@
// Metro module 8690 (f8691).
import { useMemo } from "react";
import { SKUProductLines } from "../../../Constants";
let c5664_1 = new Set([SKUProductLines.COLLECTIBLES, SKUProductLines.PREMIUM, SKUProductLines.SOCIAL_LAYER_GAME_ITEM]);
export { c5664_1 as GIFTABLE_PRODUCT_LINES };
export function useWishlistGiftableItems(a0) {
return useMemo(() => {
let r6 = a0 == null ? void 0 : a0.items.filter((item) => c5664_1.has(item.skuProductLine) && !item.isOwned);
if (r6 == null) {
r6 = [];
}
return r6;
}, [a0]);
}
@@ -0,0 +1,197 @@
// Metro module 8673 (f8674).
import { useMemo, useEffect } from "react";
import UserProfileStore from "../../user_profile/UserProfileStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import UserStore from "../../../stores/UserStore";
import WishlistStore from "../WishlistStore";
import { getWishlistSkuIds } from "../records/WishlistRecord";
import { useStateFromStoresArray, useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import WishlistActionCreators from "../WishlistActionCreators";
import { uniq } from "../../../_bundle/Module12";
import { useGetOrFetchStorefrontPricesForSkuIds } from "../../storefront/hooks/useGetOrFetchStorefrontPrices";
import maybeFetchUserProfile from "../../user_profile/maybeFetchUserProfile";
import useDisplayProfileSocialLayerStorefrontApplicationIds from "../../slayer_storefront/hooks/useDisplayProfileSocialLayerStorefrontApplicationIds";
import { useWishlistGiftableItems } from "./useWishlistGiftableItems.native";
function $mk81116($env) {
return () => $env.$parent[8].getUser($env[0]);
}
function $mk81117($env) {
return () => {
const r5 = $env[0];
return {
userProfile: r5 != null ? $env.$parent[6].getUserProfile(r5) : null,
wishlistId: r5 != null ? $env.$parent[6].getFirstWishlistId(r5) : null
};
};
}
function $mk81118($env) {
return () => {
const r4 = $env;
if (r4[0] != null && r4[2] == null && r4[1] != null && r4[2] == null) {
const r11 = $env.$parent;
const r15 = (0, r11[1])(r11[2][11]);
const r7 = r4[1];
r15(r7.id, r7.getAvatarURL(null, 80));
}
};
}
let useFetchWishlist, c5648_11;
let env5648 = {};
const getUserWishlistKey = function getUserWishlistKey(a0, a1) {
return a1 != null ? `${a0}:${a1}` : `${a0}:default`;
};
useFetchWishlist = function useFetchWishlist({ wishlistId, userId, source = c5648_11.USER_PROFILE }) {
let c16707_3, c16707_4, c16707_5, stateFromStores;
const USER_PROFILE = source;
c16707_3 = void 0;
c16707_4 = void 0;
c16707_5 = void 0;
stateFromStores = void 0;
const [wishlist, r26, error, r28] = useStateFromStoresArray([WishlistStore], () => wishlistId == null ? [null, "success", void 0, void 0] : [WishlistStore.getWishlist(wishlistId), WishlistStore.getStatus(wishlistId), WishlistStore.getError(wishlistId), WishlistStore.getUpdatedAt(wishlistId)]);
c16707_3 = wishlist;
c16707_4 = error;
c16707_5 = r28;
useGetOrFetchStorefrontPricesForSkuIds({
skuIds: useMemo(() => c16707_3 == null ? [] : uniq((0, getWishlistSkuIds)(c16707_3)), [wishlist])
});
stateFromStores = useStateFromStores([UserProfileStore], () => {
if (wishlistId != null && userId != null) {
return UserProfileStore.getWishlistSettings(userId, wishlistId)?.updated_at;
}
});
(0, useEffect)(() => {
if (!(wishlistId == null || WishlistStore.isFetching(wishlistId) || c16707_4 != null) && (c16707_3 == null || stateFromStores != null && c16707_5 !== stateFromStores)) {
WishlistActionCreators.fetchWishlist(wishlistId, stateFromStores, USER_PROFILE);
}
}, [wishlistId, USER_PROFILE, wishlist, stateFromStores, r28, error]);
return {
wishlist,
isFetching: r26 === "fetching",
wasFetched: r26 === "success" || r26 === "error",
error
};
};
const r34 = {
WISHLIST: "wishlist",
POPULAR: "popular"
};
c5648_11 = {
USER_PROFILE: "user_profile"
};
export const WISHLIST_IN_DM_LENGTH = 5;
export const WISHLIST_IN_DM_LENGTH_MOBILE = 6;
export const WISHLIST_TOOLTIP_DELAY_MS = 350;
export { r34 as WishlistItemSource };
export { c5648_11 as WishlistFetchSource };
export function useFetchWishlists({ wishlistIdsAndUsers, source = c5648_11.USER_PROFILE }) {
let stateFromStoresArray, memo;
const USER_PROFILE2 = source;
stateFromStoresArray = void 0;
memo = void 0;
const stateFromStoresArray2 = useStateFromStoresArray([WishlistStore], () => wishlistIdsAndUsers.map(({ wishlistId: wishlistId2 }) => wishlistId2 != null ? WishlistStore.getWishlist(wishlistId2) : null), [wishlistIdsAndUsers]);
const stateFromStores2 = useStateFromStores([WishlistStore], () => wishlistIdsAndUsers.some(({ wishlistId: wishlistId2 }) => wishlistId2 != null && WishlistStore.isFetching(wishlistId2)), [wishlistIdsAndUsers]);
const stateFromStoresArray3 = useStateFromStoresArray([WishlistStore], () => wishlistIdsAndUsers.map(({ wishlistId: wishlistId2 }) => wishlistId2 != null ? WishlistStore.getError(wishlistId2) : void 0), [wishlistIdsAndUsers]);
stateFromStoresArray = useStateFromStoresArray([UserProfileStore], () => wishlistIdsAndUsers.map(({ wishlistId: wishlistId2, userId: userId2 }) => wishlistId2 != null ? UserProfileStore.getWishlistSettings(userId2, wishlistId2)?.updated_at : void 0));
memo = useMemo(() => {
const r0 = {};
let c26259_0 = r0;
wishlistIdsAndUsers.forEach(({ userId: userId2, wishlistId: wishlistId2 }, index) => {
if (!(index >= stateFromStoresArray.length)) {
c26259_0[wishlistId2 != null ? `${userId2}:${wishlistId2}` : `${userId2}:default`] = stateFromStoresArray[index];
}
});
return r0;
}, [wishlistIdsAndUsers, stateFromStoresArray]);
(0, useEffect)(() => {
for (const wishlistIdsAndUser of wishlistIdsAndUsers) {
const { wishlistId: wishlistId2, userId: userId2 } = wishlistIdsAndUser;
if (wishlistId2 != null) {
if (!WishlistStore.isFetching(wishlistId2) && WishlistStore.getError(wishlistId2) == null) {
const wishlist = WishlistStore.getWishlist(wishlistId2);
const updatedAt = WishlistStore.getUpdatedAt(wishlistId2);
const r48 = memo[getUserWishlistKey(userId2, wishlistId2)];
if (wishlist == null || r48 != null && updatedAt !== r48) {
WishlistActionCreators.fetchWishlist(wishlistId2, r48, USER_PROFILE2);
}
}
}
}
}, [wishlistIdsAndUsers, USER_PROFILE2, memo]);
return {
wishlists: stateFromStoresArray2,
isFetching: stateFromStores2,
errors: stateFromStoresArray3
};
}
export { useFetchWishlist };
export function useIsSkuInWishlist(c16710_0, c16710_1) {
return useStateFromStores([WishlistStore], () => c16710_0 != null && WishlistStore.hasSkuId(c16710_0, c16710_1));
}
export function useShouldShowWishlistInDMGifting({ isGift, giftRecipient, isSocialLayerStorefrontEnabled = true }) {
let c16711_3, wishlistGiftableItems;
let c16711_2 = isSocialLayerStorefrontEnabled;
c16711_3 = void 0;
wishlistGiftableItems = void 0;
useEffect(() => {
if (giftRecipient?.id != null) {
maybeFetchUserProfile(giftRecipient.id);
}
}, [giftRecipient?.id]);
const displayProfileSocialLayerStorefrontApplicationIds = useDisplayProfileSocialLayerStorefrontApplicationIds({
userId: giftRecipient?.id
});
c16711_3 = displayProfileSocialLayerStorefrontApplicationIds;
const stateFromStores2 = useStateFromStores([UserProfileStore], () => giftRecipient?.id == null ? null : UserProfileStore.getFirstWishlistId(giftRecipient.id));
wishlistGiftableItems = useWishlistGiftableItems(useFetchWishlist({
wishlistId: stateFromStores2 != null ? isGift ? giftRecipient != null ? stateFromStores2 : null : null : null,
userId: giftRecipient?.id
}).wishlist);
return useMemo(() => isGift === true && giftRecipient != null && (wishlistGiftableItems.length > 0 || c16711_2 && c16711_3.length > 0), [isGift, giftRecipient, wishlistGiftableItems, displayProfileSocialLayerStorefrontApplicationIds, isSocialLayerStorefrontEnabled]);
}
export function useCurrentUserWishlist() {
let env16712;
const stateFromStores2 = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
const r16 = env16712 = {
$parent: env5648
};
env16712[0] = stateFromStores2;
env16712[1] = void 0;
env16712[2] = void 0;
const stateFromStores3 = useStateFromStores([UserStore], $mk81116(r16));
env16712[1] = stateFromStores3;
const stateFromStoresObject = useStateFromStoresObject([UserProfileStore], $mk81117(r16), [stateFromStores2]);
const userProfile = stateFromStoresObject.userProfile;
env16712[2] = userProfile;
const wishlistId2 = stateFromStoresObject.wishlistId;
useEffect($mk81118(r16), [stateFromStores3, stateFromStores2, userProfile]);
return {
...useFetchWishlist({
wishlistId: wishlistId2,
userId: stateFromStores2
}),
wishlistId: wishlistId2,
userProfile
};
}
export function useFetchWishlistAndProfileInfoForUser(a0) {
let env16708;
const r1 = env16708 = {
$parent: env5648
};
env16708[0] = a0;
const stateFromStores2 = useStateFromStores([UserStore], $mk81116(r1));
env16708[1] = stateFromStores2;
const stateFromStoresObject = useStateFromStoresObject([UserProfileStore], $mk81117(r1), [a0]);
const userProfile = stateFromStoresObject.userProfile;
env16708[2] = userProfile;
const wishlistId2 = stateFromStoresObject.wishlistId;
useEffect($mk81118(r1), [stateFromStores2, a0, userProfile]);
return {
...useFetchWishlist({
wishlistId: wishlistId2,
userId: a0
}),
wishlistId: wishlistId2,
userProfile
};
}
@@ -0,0 +1,280 @@
// Metro module 9749 (f9750).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useMemo, useEffect } from "react";
import UserProfileStore from "../../user_profile/UserProfileStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import WishlistRecommendationsStore from "../WishlistRecommendationsStore";
import WishlistRecommendationRecord, { WishlistRecommendationReason } from "../records/WishlistRecommendationRecord";
import Durations from "../../../utils/Durations";
import { useStateFromStores, useStateFromStoresObject, useStateFromStoresArray } from "../../../_bundle/Module589";
import { WishlistFetchSource, useFetchWishlists } from "./useWishlistHooks";
import { isNotNullish } from "../../../utils/GlobalUtils";
import WishlistActionCreators from "../WishlistActionCreators";
import { uniq } from "../../../_bundle/Module12";
import { useGetOrFetchStorefrontPricesForSkuIds } from "../../storefront/hooks/useGetOrFetchStorefrontPrices";
import maybeFetchUserProfile from "../../user_profile/maybeFetchUserProfile";
import { useWishlistApplicationIds } from "./useWishlistApplicationIds.native";
import { useWishlistSkuFilter } from "./useWishlistSkuFilter.native";
function $mk83234($env) {
return () => {
const r1 = $env.$parent;
(0, r1[1])(r1[2][13])($env[0]);
};
}
function $mk83235($env) {
return () => ({
defaultWishlistId: $env.$parent[5].getFirstWishlistId($env[0])
});
}
function $mk83236($env) {
return () => {
const r0 = $env;
return [{
userId: r0[0],
wishlistId: r0[1]
}];
};
}
let c6459_9, c6459_10;
let env6459 = {};
const useWishlistRecommendationsWithWishlists = function useWishlistRecommendationsWithWishlists({ userIdsAndWishlistIds, numItems: numItems4, applicationIds: applicationIds3, source = WishlistFetchSource.USER_PROFILE, filterByApplicationIds = false }) {
let c17452_1, memo, memo2, memo3, isFetching, errors, filteredRecommendations, skusToUserAndReasonRecommendations, combinedSkus;
let numItems, applicationIds;
c17452_1 = void 0;
memo = void 0;
memo2 = void 0;
memo3 = void 0;
isFetching = void 0;
errors = void 0;
filteredRecommendations = void 0;
skusToUserAndReasonRecommendations = void 0;
combinedSkus = void 0;
const memo4 = useMemo(() => userIdsAndWishlistIds.map((userIdsAndWishlistId) => userIdsAndWishlistId.userId), [userIdsAndWishlistIds]);
numItems = numItems4;
applicationIds = applicationIds3;
const stateFromStores2 = useStateFromStores([WishlistRecommendationsStore], () => WishlistRecommendationsStore.getRecommendations(memo4, applicationIds));
useEffect(() => {
if (memo4.length !== 0 && applicationIds.length !== 0) {
const recommendations2 = WishlistRecommendationsStore.getRecommendations(memo4, applicationIds);
if (recommendations2 != null) {
if (recommendations2.state === "loading") {
return void 0;
}
const r2 = recommendations2.fetchedAt < Date.now() - c6459_9;
const r24 = recommendations2.state === "success" && recommendations2.data.skus.length >= numItems;
if (!r2 && r24) {
return void 0;
}
}
WishlistActionCreators.fetchWishlistRecommendations(applicationIds, memo4, numItems);
}
}, [memo4, applicationIds, numItems]);
const r37 = memo4.length !== 0 ? applicationIds.length === 0 ? c6459_10 : stateFromStores2 : c6459_10;
c17452_1 = r37;
const r38 = filterByApplicationIds ? applicationIds : void 0;
let wishlists, memo5, memo6;
const applicationIds2 = r38;
const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
const fetchWishlists = useFetchWishlists({
wishlistIdsAndUsers: userIdsAndWishlistIds,
source
});
wishlists = fetchWishlists.wishlists;
const { isFetching: isFetching2, errors: errors2 } = fetchWishlists;
memo5 = useMemo(() => {
const r32 = wishlists.filter(isNotNullish);
const r33 = {};
for (const item of r32) {
for (const item2 of item.items) {
if (!(item2.sku == null || item2.isOwned || applicationIds2 != null && !applicationIds2.includes(item2.sku.applicationId))) {
const skuId = item2.skuId;
const r60 = {
...r33[item2.skuId] != null ? r33[item2.skuId] : {}
};
r60[item.userId] = WishlistRecommendationReason.WISHLIST;
r33[skuId] = r60;
}
}
}
return r33;
}, [wishlists, applicationIds2]);
memo6 = useMemo(() => Object.fromEntries(wishlists.filter(isNotNullish).flatMap((item) => item.items).filter((item) => item != null && item.sku != null && !item.isOwned && (applicationIds2 == null || applicationIds2.includes(item.sku.applicationId))).map((item) => [item.skuId, item.sku])), [wishlists, applicationIds2]);
memo = useMemo(() => Object.keys(memo6).sort((a, b) => {
let r5 = memo5[b];
if (r5 == null) {
r5 = {};
}
let r6 = memo5[a];
if (r6 == null) {
r6 = {};
}
const r17 = Object.keys(r5).length - Object.keys(r6).length;
const r18 = r6;
if (r17 !== 0) {
return r17;
}
const r23 = Boolean(r5[stateFromStores]);
return Number(Boolean(r18[stateFromStores])) - Number(r23);
}).map((item) => memo6[item]), [stateFromStores, memo6, memo5]);
memo2 = memo6;
memo3 = memo5;
isFetching = isFetching2;
errors = errors2;
const memo8 = useMemo(() => c17452_1 != null && c17452_1.state === "success" ? {
filteredRecommendations: c17452_1.data.skus.filter((sku) => !(sku.id in memo2)),
skusToUserAndReasonRecommendations: c17452_1.data.skusToUserAndReason
} : {
filteredRecommendations: [],
skusToUserAndReasonRecommendations: {}
}, [r37, memo6]);
filteredRecommendations = memo8.filteredRecommendations;
skusToUserAndReasonRecommendations = memo8.skusToUserAndReasonRecommendations;
const memo9 = useMemo(() => {
const combinedSkusToUserAndReason = {
...skusToUserAndReasonRecommendations
};
for (const item of Object.entries(memo3)) {
const r33 = _slicedToArray(item, 2);
const r34 = r33[0];
combinedSkusToUserAndReason[r34] = {
...combinedSkusToUserAndReason[r34],
...r33[1]
};
}
return {
combinedSkus: [...memo, ...filteredRecommendations],
combinedSkusToUserAndReason
};
}, [memo, filteredRecommendations, memo5, skusToUserAndReasonRecommendations]);
combinedSkus = memo9.combinedSkus;
const combinedSkusToUserAndReason = memo9.combinedSkusToUserAndReason;
const memo10 = useMemo(() => {
let r3;
L8: {
r3 = "loading";
if (!isFetching) {
const r2 = c17452_1 == null;
r3 = "loading";
if (!r2) {
if (c17452_1 != null) {
const state = c17452_1.state;
r3 = "loading";
if (state === "loading") {
break L8;
}
}
r3 = errors.filter(isNotNullish).length > 0 ? "error" : c17452_1.state === "error" ? "error" : "success";
}
}
}
return r3;
}, [isFetching, r37, errors]);
useGetOrFetchStorefrontPricesForSkuIds({
skuIds: useMemo(() => uniq([...filteredRecommendations.map((filteredRecommendation) => filteredRecommendation.id), ...combinedSkus.map((combinedSku) => combinedSku.id)]), [filteredRecommendations, combinedSkus])
});
return {
recommendations: filteredRecommendations,
wishlistAndRecommendations: combinedSkus,
skusToUserAndReason: combinedSkusToUserAndReason,
status: memo10
};
};
c6459_9 = 30 * Durations.Millis.MINUTE;
c6459_10 = {
state: "success",
data: new WishlistRecommendationRecord({
skus: [],
skus_to_user_and_reason: {},
applications: []
}),
fetchedAt: 0
};
export function useWishlistRecommendationsForSingleUser({ userId, numItems: numItems4, source = WishlistFetchSource.USER_PROFILE }) {
let env17455;
const r6 = env17455 = {
$parent: env6459
};
env17455[0] = userId;
useEffect($mk83234(r6), [userId]);
const defaultWishlistId = useStateFromStoresObject([UserProfileStore], $mk83235(r6)).defaultWishlistId;
env17455[1] = defaultWishlistId;
const wishlistRecommendationsWithWishlists = useWishlistRecommendationsWithWishlists({
userIdsAndWishlistIds: useMemo($mk83236(r6), [userId, defaultWishlistId]),
applicationIds: useWishlistApplicationIds(userId),
numItems: numItems4,
source
});
const { wishlistAndRecommendations: wishlistAndRecommendations2, skusToUserAndReason, status } = wishlistRecommendationsWithWishlists;
const wishlistSkuFilter = useWishlistSkuFilter({
wishlistAndRecommendations: wishlistAndRecommendations2,
skusToUserAndReason,
userId,
numItems: numItems4
});
return {
wishlistAndRecommendations: wishlistSkuFilter.slicedWishlistAndRecommendations,
skusToUserAndReason,
status,
defaultWishlistId,
totalUnownedWishlistItemCount: wishlistSkuFilter.totalUnownedWishlistItemCount
};
}
export function useRecommendationsForApplicationIds({ applicationIds: applicationIds3, userIds, numItems: numItems2, source = WishlistFetchSource.USER_PROFILE }) {
let wishlistAndRecommendations;
let stateFromStoresArray;
wishlistAndRecommendations = void 0;
const memo7 = useMemo(() => userIds == null ? void 0 : userIds.slice(0, 5), [userIds]);
stateFromStoresArray = void 0;
useEffect(() => {
memo7.forEach((item) => {
maybeFetchUserProfile(item);
});
}, [memo7]);
stateFromStoresArray = useStateFromStoresArray([UserProfileStore], () => memo7.map((item) => {
let r5 = UserProfileStore.getFirstWishlistId(item);
if (r5 == null) {
r5 = null;
}
return r5;
}));
const r39 = useWishlistRecommendationsWithWishlists({
userIdsAndWishlistIds: useMemo(() => memo7.map((item, index) => ({
userId: item,
wishlistId: stateFromStoresArray[index]
})), [memo7, stateFromStoresArray]),
applicationIds: applicationIds3,
numItems: numItems2,
source,
filterByApplicationIds: true
});
wishlistAndRecommendations = r39.wishlistAndRecommendations;
const { skusToUserAndReason, status } = r39;
return {
recommendations: useMemo(() => wishlistAndRecommendations.slice(0, numItems2), [wishlistAndRecommendations, numItems2]),
skusToUserAndReason,
status
};
}
export function useRecommendationsForSingleUser({ userId, numItems: numItems3, source = WishlistFetchSource.USER_PROFILE }) {
let env17459;
const r11 = env17459 = {
$parent: env6459
};
env17459[0] = userId;
env17459[1] = void 0;
useEffect($mk83234(r11), [userId]);
const defaultWishlistId = useStateFromStoresObject([UserProfileStore], $mk83235(r11)).defaultWishlistId;
env17459[1] = defaultWishlistId;
const r39 = useWishlistRecommendationsWithWishlists({
userIdsAndWishlistIds: useMemo($mk83236(r11), [userId, defaultWishlistId]),
applicationIds: useWishlistApplicationIds(userId),
numItems: numItems3,
source
});
const { recommendations, skusToUserAndReason, status } = r39;
return {
recommendations: useMemo(() => recommendations.slice(0, numItems3), [recommendations, numItems3]),
skusToUserAndReason,
status
};
}
@@ -0,0 +1,31 @@
// Metro module 9752 (f9753).
import { useMemo } from "react";
import { WishlistRecommendationReason } from "../records/WishlistRecommendationRecord";
import { SKUProductLines } from "../../../Constants";
import { useIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../../slayer_storefront/experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import { GIFTABLE_PRODUCT_LINES } from "./useWishlistGiftableItems.native";
import { isSlayerSkuAvailableOnThisPlatform } from "../../storefront/StorefrontUtils";
export function useWishlistSkuFilter({ wishlistAndRecommendations, skusToUserAndReason, userId, numItems }) {
const isEligibleForSocialLayerStorefrontMobilePurchasing = useIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "use_wishlist_sku_filter"
});
const memo = useMemo(() => wishlistAndRecommendations.filter((wishlistAndRecommendation) => {
let r12 = !!GIFTABLE_PRODUCT_LINES.has(wishlistAndRecommendation.productLine);
if (r12) {
let r16 = wishlistAndRecommendation.productLine !== SKUProductLines.SOCIAL_LAYER_GAME_ITEM;
if (!r16) {
let r18 = isEligibleForSocialLayerStorefrontMobilePurchasing;
if (isEligibleForSocialLayerStorefrontMobilePurchasing) {
r18 = isSlayerSkuAvailableOnThisPlatform(wishlistAndRecommendation);
}
r16 = r18;
}
r12 = r16;
}
return r12;
}), [wishlistAndRecommendations, isEligibleForSocialLayerStorefrontMobilePurchasing]);
return {
totalUnownedWishlistItemCount: useMemo(() => memo.filter((item) => skusToUserAndReason[item.id] != null && skusToUserAndReason[item.id][userId] === WishlistRecommendationReason.WISHLIST).length, [memo, userId, skusToUserAndReason]),
slicedWishlistAndRecommendations: useMemo(() => memo.slice(0, numItems), [memo, numItems])
};
}
@@ -0,0 +1,30 @@
// Metro module 12204 (f12205).
import { View } from "react-native";
import { WISHLIST_SUGGESTION_CARD_GAP } from "../../user_profile/native/Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { WishlistAnalyticsProvider } from "../WishlistAnalyticsContext";
import AddToWishlistItemCard from "./AddToWishlistItemCard";
const useStyles = createStyles({
itemsContainer: {
flexDirection: "row",
flexWrap: "wrap",
gap: WISHLIST_SUGGESTION_CARD_GAP,
justifyContent: "flex-start"
}
});
export default function AddToWishlistGrid(props) {
const { items, wishlist, analyticsLocations, cardSize } = props;
return <View style={useStyles().itemsContainer}>
{items.map((item, index) => {
const sku = item.sku;
return <WishlistAnalyticsProvider key={sku.id} newValue={{
positionInSection: index,
skuId: sku.id,
itemSource: item.itemSource,
productLine: sku.productLine
}}>
<AddToWishlistItemCard sku={sku} wishlistId={wishlist?.id} analyticsLocations={analyticsLocations} size={cardSize} />
</WishlistAnalyticsProvider>;
})}
</View>;
};
@@ -0,0 +1,121 @@
// Metro module 12205 (f12206).
import { useState, useCallback } from "react";
import { View } from "react-native";
import { AnalyticEvents } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useWishlistAnalyticsContext } from "../WishlistAnalyticsContext";
import SKUPreview from "../../skus/native/SKUPreview";
import { HeartOutlineIcon } from "../../../design/components/Icon/native/redesign/generated/HeartOutlineIcon";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import WishlistActionCreators from "../WishlistActionCreators";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
import WishlistItemCardBase from "./WishlistItemCardBase";
import { getProductNameAndTypeFromSku } from "../CollectiblesWishlistUtils";
const useStyles = createStyles({
heartOverlay: {
position: "absolute",
top: Module712.space.PX_4,
right: Module712.space.PX_4,
zIndex: 1,
alignItems: "center",
justifyContent: "center",
padding: Module712.space.PX_6,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT
}
});
export default function AddToWishlistItemCard(props) {
const { sku, wishlistId, analyticsLocations, ...props2 } = props;
let c19729_3 = props2;
const styles = useStyles();
const wishlistAnalyticsContext = useWishlistAnalyticsContext();
const [state, setState] = useState(false);
const callback = useCallback(() => <>
<SKUPreview sku={sku} size={c19729_3.size} />
<View style={styles.heartOverlay} pointerEvents="none">
<HeartOutlineIcon size="sm" color={Module712.colors.ICON_OVERLAY_LIGHT} />
</View>
</>, [sku, styles.heartOverlay, props2.size]);
const callback2 = useCallback(async () => {
let c27270_2;
let c27270_3 = 0;
L18: {
L17: {
try {
if (state) {
break L18;
}
if (wishlistAnalyticsContext?.surface != null) {
AnalyticsUtils.track(AnalyticEvents.WISHLIST_ITEM_CLICKED, {
sku_id: sku.id,
wishlist_id: wishlistId,
wishlist_owner_id: wishlistAnalyticsContext.wishlistOwnerId,
surface: wishlistAnalyticsContext.surface,
position_in_section: wishlistAnalyticsContext.positionInSection,
item_source: wishlistAnalyticsContext.itemSource,
click_type: "add_to_wishlist",
product_line: sku.productLine,
impression_session_id: wishlistAnalyticsContext.impressionSessionId,
location_stack: wishlistAnalyticsContext.analyticsLocations
});
}
setState(true);
c27270_3 = 2;
await WishlistActionCreators.addSkuToWishlist(sku.id, analyticsLocations);
c27270_3 = 1;
c27270_3 = 0;
(0, setState)(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c27270_2 = r29;
let r30 = c27270_3;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r118 = c27270_2;
c27270_3 = 0;
(0, setState)(false);
throw r118;
} catch (r116) {
r7 = r116;
c27270_2 = r116;
r30 = c27270_3;
if (r30 === 0) {
break;
}
}
} else {
try {
c27270_3 = 1;
ToastActionCreators.open({
key: "WISHLIST_ADD_SUGGESTION_ERROR",
content: intl.string(t.F8FvUy)
});
c27270_3 = 0;
(0, setState)(false);
break L17;
} catch (r87) {
r7 = r87;
c27270_2 = r87;
r30 = c27270_3;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
}, [state, wishlistAnalyticsContext, sku.id, sku.productLine, wishlistId, analyticsLocations]);
return <WishlistItemCardBase accessibilityLabel={intl.formatToPlainString(t.xRjJBe, {
productName: getProductNameAndTypeFromSku(sku)
})} renderPreview={callback} onPress={callback2} {...props2} />;
};
@@ -0,0 +1,40 @@
// Metro module 9772 (f9773).
import { useMemo, useCallback } from "react";
import { transformSKUToCollectiblesItem } from "../../collectibles/records/CollectiblesItemRecord";
import SentGiftsStore from "../SentGiftsStore";
import { useIsProfileFrameGiftingEnabled } from "../../collectibles/experiments/CollectiblesProfileFrameGiftingExperiment";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getProductNameAndTypeFromSku } from "../CollectiblesWishlistUtils";
import { CollectiblesPreview } from "../../skus/native/SKUPreview";
import { CollectiblesItemType } from "../../../_bundle/Module1901";
import WishlistItemCardBase from "./WishlistItemCardBase";
export default function CollectiblesWishlistItemCard(props) {
let r52;
let memo;
const sku = props.sku;
let isOwned = props.isOwned;
if (isOwned === void 0) {
isOwned = false;
}
const { source, wishlistOwnerId, size, sku: _sku, isOwned: _isOwned, ...props2 } = props;
memo = void 0;
const isProfileFrameGiftingEnabled = useIsProfileFrameGiftingEnabled("CollectiblesWishlistItemCard");
const stateFromStores = useStateFromStores([SentGiftsStore], () => wishlistOwnerId != null && SentGiftsStore.hasSentGift(sku.id, wishlistOwnerId), [sku.id, wishlistOwnerId]);
const productNameAndTypeFromSku = getProductNameAndTypeFromSku(sku);
memo = useMemo(() => transformSKUToCollectiblesItem(sku), [sku]);
const callback = useCallback(() => memo != null ? <CollectiblesPreview collectiblesItemData={memo} size={size} /> : null, [memo, size]);
const type = memo?.type;
L10: {
if (type === "single" && memo.item.type === CollectiblesItemType.PROFILE_FRAME) {
r52 = null;
if (!isProfileFrameGiftingEnabled) {
break L10;
}
}
if (!isOwned) {
isOwned = stateFromStores;
}
r52 = <WishlistItemCardBase accessibilityLabel={productNameAndTypeFromSku} renderPreview={callback} source={source} isOwned={isOwned} size={size} {...props2} />;
}
return r52;
};
@@ -0,0 +1,8 @@
// Metro module 9774 (f9775).
import { useCallback } from "react";
import { PremiumSKUPreview } from "../../skus/native/SKUPreview";
import WishlistItemCardBase from "./WishlistItemCardBase";
export default function PremiumWishlistItemCard(props) {
const { sku, source, size, ...props2 } = props;
return <WishlistItemCardBase accessibilityLabel={sku.name} renderPreview={useCallback(() => <PremiumSKUPreview size={size} />, [size])} source={source} isOwned={false} size={size} {...props2} />;
};
@@ -0,0 +1,59 @@
// Metro module 9775 (f9776).
import { useMemo, useCallback } from "react";
import ApplicationStore from "../../applications/ApplicationStore";
import SentGiftsStore from "../SentGiftsStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import SlayerStorefrontItemCard from "../../slayer_storefront/native/SlayerStorefrontItemCard";
import FastImage from "../../../components_native/common/FastImage";
import WishlistItemCardBase from "./WishlistItemCardBase";
const useStyles = createStyles({
applicationIcon: {
position: "absolute",
top: Module712.space.PX_8,
left: Module712.space.PX_8,
width: 24,
height: 24,
borderRadius: Module712.radii.sm,
zIndex: 1
},
nestedCard: {
shadowColor: void 0,
shadowOffset: {
width: 0,
height: 0
},
shadowOpacity: 0,
shadowRadius: 0,
elevation: 0,
overflow: "visible",
borderRadius: Module712.radii.none
}
});
export default function SocialLayerStorefrontWishlistItemCard(props) {
let applicationId, stateFromStores, memo, styles;
const sku = props.sku;
let isOwned = props.isOwned;
if (isOwned === void 0) {
isOwned = false;
}
const { source, wishlistOwnerId, size, sku: _sku, isOwned: _isOwned, ...props2 } = props;
applicationId = void 0;
stateFromStores = void 0;
memo = void 0;
styles = void 0;
const stateFromStores2 = useStateFromStores([SentGiftsStore], () => wishlistOwnerId != null && SentGiftsStore.hasSentGift(sku.id, wishlistOwnerId), [sku.id, wishlistOwnerId]);
applicationId = sku.applicationId;
stateFromStores = useStateFromStores([ApplicationStore], () => applicationId != null ? ApplicationStore.getApplication(applicationId) : null, [applicationId]);
memo = useMemo(() => stateFromStores == null ? void 0 : stateFromStores.getIconSource(24), [stateFromStores]);
styles = useStyles();
const callback = useCallback(() => <>
<SlayerStorefrontItemCard sku={sku} size={size} containerStyle={styles.nestedCard} />
{memo != null && <FastImage source={memo} style={styles.applicationIcon} />}
</>, [sku, size, memo, styles.applicationIcon, styles.nestedCard]);
if (!isOwned) {
isOwned = stateFromStores2;
}
return <WishlistItemCardBase accessibilityLabel={sku.name} renderPreview={callback} source={source} isOwned={isOwned} size={size} {...props2} />;
};
@@ -0,0 +1,23 @@
// Metro module 9771 (f9772).
import { SKUProductLines } from "../../../Constants";
import { useIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../../slayer_storefront/experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import CollectiblesWishlistItemCard from "./CollectiblesWishlistItemCard";
import PremiumWishlistItemCard from "./PremiumWishlistItemCard";
import SocialLayerStorefrontWishlistItemCard from "./SocialLayerStorefrontWishlistItemCard";
export default function WishlistItemCard(props) {
const { sku, isOwned, source, wishlistOwnerId, ...props2 } = props;
const isEligibleForSocialLayerStorefrontMobilePurchasing = useIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "wishlist_item_card"
});
const productLine = sku.productLine;
if (SKUProductLines.COLLECTIBLES === productLine) {
return <CollectiblesWishlistItemCard sku={sku} isOwned={isOwned} source={source} wishlistOwnerId={wishlistOwnerId} {...props2} />;
}
if (SKUProductLines.PREMIUM === productLine) {
return <PremiumWishlistItemCard sku={sku} source={source} {...props2} />;
}
if (SKUProductLines.SOCIAL_LAYER_GAME_ITEM === productLine) {
return isEligibleForSocialLayerStorefrontMobilePurchasing ? <SocialLayerStorefrontWishlistItemCard sku={sku} isOwned={isOwned} source={source} wishlistOwnerId={wishlistOwnerId} {...props2} /> : null;
}
return null;
};
@@ -0,0 +1,115 @@
// Metro module 8670 (f8671).
import { Pressable, View, StyleSheet } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { HeartIcon } from "../../../design/components/Icon/native/redesign/generated/HeartIcon";
import { useThemeContext } from "../../../_bundle/Module3901";
import { useUserProfileColors } from "../../user_profile/hooks/native/useUserProfileColors";
import { useToken } from "../../../design/tokens/native/useToken";
import { WishlistItemSource } from "../hooks/useWishlistHooks";
import { intl, t } from "../../../intl/index.native";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { CheckmarkLargeBoldIcon } from "../../../design/components/Icon/native/redesign/generated/CheckmarkLargeBoldIcon";
let useStyles;
const SourceIcon = function SourceIcon(props) {
const toastText = props.toastText;
return <Pressable style={useStyles().sourceIcon} onPress={function onPress() {
ToastActionCreators.open({
key: "WISHLIST_SOURCE_ICON",
content: toastText
});
}} accessible={false} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<HeartIcon color={Module712.colors.INTERACTIVE_ICON_DEFAULT} size="md" />
</Pressable>;
};
useStyles = createStyles({
card: {
borderWidth: 1,
borderRadius: Module712.radii.lg,
borderColor: Module712.colors.BORDER_MUTED,
justifyContent: "center",
alignItems: "center",
overflow: "hidden"
},
ownedOverlay: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center",
zIndex: 2,
shadowOpacity: 0.5,
shadowRadius: 6,
elevation: 6
},
previewWrap: {
width: "100%",
height: "100%",
justifyContent: "center",
alignItems: "center"
},
ownedCard: {
opacity: 0.5
},
sourceIcon: {
position: "absolute",
top: Module712.space.PX_8,
right: Module712.space.PX_8,
zIndex: 1
}
});
export default function WishlistItemCardBase(props) {
const { onPress: onPress2, accessibilityLabel, renderPreview, source, size = 170 } = props;
let isOwned = props.isOwned;
if (isOwned === void 0) {
isOwned = false;
}
const { accessibilityHidden, recipientName } = props;
const styles = useStyles();
const themeContext = useThemeContext();
const { theme, primaryColor } = themeContext;
const containerBackground = useUserProfileColors({
theme,
primaryColor,
secondaryColor: themeContext.secondaryColor
}).containerBackground;
let backgroundColor = useToken(Module712.colors.BG_SURFACE_RAISED);
if (primaryColor != null) {
backgroundColor = containerBackground;
}
const style = [styles.card, {
backgroundColor
}, typeof size === "object" ? {
width: size.width,
height: size.height
} : {
width: size,
aspectRatio: 1
}];
const WISHLIST = WishlistItemSource.WISHLIST;
const toastText2 = intl.formatToPlainString(t.p3RmJF, {
username: recipientName
});
const r61 = isOwned ? intl.string(t["6cfuDj"]) : null;
let r70 = source === WISHLIST;
const accessibilityLabel2 = [accessibilityLabel, r61, r70 ? toastText2 : null].filter(isNotNullish).join(", ");
const r94 = <View style={styles.ownedOverlay} pointerEvents="none" accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<CheckmarkLargeBoldIcon color={Module712.colors.WHITE} size="custom" style={{
width: 40,
height: 40
}} />
</View>;
const r103 = [<View style={[styles.previewWrap, isOwned ? styles.ownedCard : isOwned]} aria-hidden>
{renderPreview()}
</View>, , ,];
if (isOwned) {
isOwned = r94;
}
r103[1] = isOwned;
if (r70) {
r70 = <SourceIcon toastText={toastText2} />;
}
r103[2] = r70;
const r107 = <>{r103}</>;
return onPress2 == null ? <View style={style} accessibilityElementsHidden={accessibilityHidden} importantForAccessibility={accessibilityHidden ? "no-hide-descendants" : "auto"}>{r107}</View> : <Pressable accessibilityRole="button" accessibilityLabel={accessibilityLabel2} style={style} onPress={onPress2} accessibilityElementsHidden={accessibilityHidden} importantForAccessibility={accessibilityHidden ? "no-hide-descendants" : "auto"}>{r107}</Pressable>;
};
export const DEFAULT_ITEM_SIZE = 170;
@@ -0,0 +1,32 @@
// Metro module 9776 (f9777).
import { Pressable, StyleSheet, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import WishlistItemCard from "./WishlistItemCard";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles(() => ({
moreOverlay: {
...StyleSheet.absoluteFillObject,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT,
justifyContent: "center",
alignItems: "center"
}
}));
export default function WishlistViewMoreCard(props) {
const { sku, size, recipientName, overflowCount, onPress } = props;
const styles = useStyles();
return <Pressable onPress={onPress} accessibilityLabel={intl.formatToPlainString(t["8uYD+I"], {
username: recipientName
})}>
<WishlistItemCard accessibilityHidden sku={sku} size={size} recipientName={recipientName} />
<View style={styles.moreOverlay}>
<Text variant="text-md/semibold" color="text-overlay-light">
{intl.format(t.F6iMs4, {
count: overflowCount
})}
</Text>
</View>
</Pressable>;
};
@@ -0,0 +1,38 @@
// Metro module 8676 (f8677).
import Record from "../../../lib/Record";
import SKURecord from "../../skus/SKURecord";
import { $callWithNewTarget } from "../../../_hermes/prelude";
class BaseWishlistItemRecord extends Record {
constructor(a0) {
super();
this.skuId = a0.sku_id;
this.skuProductLine = a0.sku_product_line;
this.skuName = a0.sku_name;
this.isOwned = a0.is_owned;
this.gifterUserId = a0.gifter_user_id;
this.sku = a0.sku;
}
static fromServer({ sku_id, sku_product_line, sku_name, is_owned, gifter_user_id, sku, ...rest }) {
const r2 = {
...rest,
sku_id,
sku_product_line,
sku_name,
is_owned,
gifter_user_id,
sku: sku != null ? SKURecord.createFromServer(sku) : void 0
};
const prototypeOf = Object.getPrototypeOf(BaseWishlistItemRecord);
const r27 = Object.create(BaseWishlistItemRecord.prototype);
const r28 = $callWithNewTarget(prototypeOf, r27, BaseWishlistItemRecord);
const r29 = r28 instanceof Object ? r28 : r27;
r29.skuId = r2.sku_id;
r29.skuProductLine = r2.sku_product_line;
r29.skuName = r2.sku_name;
r29.isOwned = r2.is_owned;
r29.gifterUserId = r2.gifter_user_id;
r29.sku = r2.sku;
return r29;
}
}
export default BaseWishlistItemRecord;
@@ -0,0 +1,79 @@
// Metro module 8677 (f8678).
import AvatarDecorationRecord from "../../collectibles/records/AvatarDecorationRecord";
import { transformSKUToCollectiblesItem } from "../../collectibles/records/CollectiblesItemRecord";
import NameplateRecord from "../../collectibles/records/NameplateRecord";
import ProfileEffectRecord from "../../collectibles/records/ProfileEffectRecord";
import ProfileFrameRecord from "../../collectibles/records/ProfileFrameRecord";
import SKURecord from "../../skus/SKURecord";
import BaseWishlistItemRecord from "./BaseWishlistItemRecord";
import { SKUProductLines } from "../../../Constants";
import { CollectiblesItemType } from "../../../_bundle/Module1901";
const createCollectiblesItemFromServerResponse = function createCollectiblesItemFromServerResponse(a0) {
const type = a0.type;
if (CollectiblesItemType.AVATAR_DECORATION === type) {
return AvatarDecorationRecord.fromServer(a0);
}
if (CollectiblesItemType.PROFILE_EFFECT === type) {
return ProfileEffectRecord.fromServer(a0);
}
if (CollectiblesItemType.NAMEPLATE === type) {
return NameplateRecord.fromServer(a0);
}
if (CollectiblesItemType.PROFILE_FRAME === type) {
return ProfileFrameRecord.fromServer(a0);
}
return null;
};
class CollectiblesWishlistItemRecord extends BaseWishlistItemRecord {
skuProductLine = SKUProductLines.COLLECTIBLES;
constructor(a0) {
super(a0);
if (a0.bundle_items != null) {
const bundleItems = [];
for (const bundle_item of a0.bundle_items) {
const collectiblesItemFromServerResponse2 = createCollectiblesItemFromServerResponse(bundle_item);
if (collectiblesItemFromServerResponse2 != null) {
bundleItems.push(collectiblesItemFromServerResponse2);
}
}
if (bundleItems.length === 0) {
throw new Error("Bundle has no valid items");
}
this.bundleItems = bundleItems;
} else if (a0.collectibles_item != null) {
const collectiblesItemFromServerResponse = createCollectiblesItemFromServerResponse(a0.collectibles_item);
if (collectiblesItemFromServerResponse == null) {
throw new Error("Collectibles item not found");
}
this.collectiblesItem = collectiblesItemFromServerResponse;
} else if (!a0.skipValidation) {
throw new Error("Collectibles wishlist item missing both collectibles_item and bundle_items");
}
}
static fromServer(a0) {
return new CollectiblesWishlistItemRecord({
...a0,
sku: a0.sku != null ? SKURecord.createFromServer(a0.sku) : void 0
});
}
static fromSKU(a0) {
const r4 = transformSKUToCollectiblesItem(a0);
if (r4 == null) {
return null;
}
const collectiblesWishlistItemRecord = new CollectiblesWishlistItemRecord({
sku_id: a0.id,
sku_product_line: SKUProductLines.COLLECTIBLES,
sku_name: a0.name,
sku: a0,
skipValidation: true
});
collectiblesWishlistItemRecord.collectiblesItem = r4.type === "single" ? r4.item : void 0;
collectiblesWishlistItemRecord.bundleItems = r4.type === "bundle" ? r4.items : void 0;
return collectiblesWishlistItemRecord;
}
}
export default CollectiblesWishlistItemRecord;
export function isCollectiblesWishlistItemRecord(a0) {
return a0 instanceof CollectiblesWishlistItemRecord;
}
@@ -0,0 +1,52 @@
// Metro module 8678 (f8679).
import SKURecord from "../../skus/SKURecord";
import BaseWishlistItemRecord from "./BaseWishlistItemRecord";
import { SKUProductLines } from "../../../Constants";
import { $callWithNewTarget } from "../../../_hermes/prelude";
class PremiumWishlistItemRecord extends BaseWishlistItemRecord {
skuProductLine = SKUProductLines.PREMIUM;
constructor(a0) {
super(a0);
this.sku = a0.sku;
}
static fromServer(a0) {
const fromServer2 = SKURecord.createFromServer(a0.sku);
if (fromServer2 == null) {
throw new Error("SKU not found");
}
const r11 = {
...a0,
sku: fromServer2
};
const prototypeOf = Object.getPrototypeOf(PremiumWishlistItemRecord);
const r18 = Object.create(PremiumWishlistItemRecord.prototype);
const r20 = $callWithNewTarget(prototypeOf, r18, PremiumWishlistItemRecord, r11);
const r21 = r20 instanceof Object ? r20 : r18;
r21.skuProductLine = SKUProductLines.PREMIUM;
r21.sku = r11.sku;
return r21;
}
static fromSKU(a0) {
let r1 = null;
if (a0 != null) {
const r3 = {
sku_id: a0.id,
sku_product_line: SKUProductLines.PREMIUM,
sku_name: a0.name,
sku: a0
};
const prototypeOf = Object.getPrototypeOf(PremiumWishlistItemRecord);
const r16 = Object.create(PremiumWishlistItemRecord.prototype);
const r18 = $callWithNewTarget(prototypeOf, r16, PremiumWishlistItemRecord, r3);
const r19 = r18 instanceof Object ? r18 : r16;
r19.skuProductLine = SKUProductLines.PREMIUM;
r19.sku = r3.sku;
r1 = r19;
}
return r1;
}
}
export default PremiumWishlistItemRecord;
export function isPremiumWishlistItemRecord(a0) {
return a0 instanceof PremiumWishlistItemRecord;
}
@@ -0,0 +1,51 @@
// Metro module 8679 (f8680).
import SKURecord from "../../skus/SKURecord";
import BaseWishlistItemRecord from "./BaseWishlistItemRecord";
import { $callWithNewTarget } from "../../../_hermes/prelude";
class SKUWishlistItemRecord extends BaseWishlistItemRecord {
constructor(a0) {
super(a0);
this.skuProductLine = a0.sku.productLine;
this.sku = a0.sku;
}
static fromServer(a0) {
const fromServer2 = SKURecord.createFromServer(a0.sku);
if (fromServer2 == null) {
throw new Error("SKU not found");
}
const r11 = {
...a0,
sku: fromServer2
};
const prototypeOf = Object.getPrototypeOf(SKUWishlistItemRecord);
const r18 = Object.create(SKUWishlistItemRecord.prototype);
const r20 = $callWithNewTarget(prototypeOf, r18, SKUWishlistItemRecord, r11);
const r21 = r20 instanceof Object ? r20 : r18;
r21.skuProductLine = r11.sku.productLine;
r21.sku = r11.sku;
return r21;
}
static fromSKU(a0) {
let r1 = null;
if (a0 != null) {
const r3 = {
sku_id: a0.id,
sku_product_line: a0.productLine,
sku_name: a0.name,
sku: a0
};
const prototypeOf = Object.getPrototypeOf(SKUWishlistItemRecord);
const r15 = Object.create(SKUWishlistItemRecord.prototype);
const r17 = $callWithNewTarget(prototypeOf, r15, SKUWishlistItemRecord, r3);
const r18 = r17 instanceof Object ? r17 : r15;
r18.skuProductLine = r3.sku.productLine;
r18.sku = r3.sku;
r1 = r18;
}
return r1;
}
}
export default SKUWishlistItemRecord;
export function isSKUWishlistItemRecord(a0) {
return a0 instanceof SKUWishlistItemRecord;
}
@@ -0,0 +1,40 @@
// Metro module 5663 (f5664).
import Record from "../../../lib/Record";
import SKURecord from "../../skus/SKURecord";
import ApplicationRecord from "../../../records/ApplicationRecord";
import { $callWithNewTarget } from "../../../_hermes/prelude";
function $mk76632() {
return (a0) => {
const [r13, r14] = a0;
return [r13, r14];
};
}
let $mk76631 = function() {
return (a0) => SKURecord.createFromServer(a0);
}, $mk76633 = function() {
return (a0) => ApplicationRecord.createFromServer(a0);
};
const r17 = {
WISHLIST: "WISHLIST",
RECOMMENDATION: "RECOMMENDATION"
};
class WishlistRecommendationRecord extends Record {
constructor(a0) {
super();
this.skus = a0.skus.map($mk76631());
this.skusToUserAndReason = Object.fromEntries(Object.entries(a0.skus_to_user_and_reason).map($mk76632()));
this.applications = a0.applications.map($mk76633());
}
static fromServer(a0) {
const prototypeOf = Object.getPrototypeOf(WishlistRecommendationRecord);
const r4 = Object.create(WishlistRecommendationRecord.prototype);
const r14 = $callWithNewTarget(prototypeOf, r4, WishlistRecommendationRecord);
const r15 = r14 instanceof Object ? r14 : r4;
r15.skus = a0.skus.map($mk76631());
r15.skusToUserAndReason = Object.fromEntries(Object.entries(a0.skus_to_user_and_reason).map($mk76632()));
r15.applications = a0.applications.map($mk76633());
return r15;
}
}
export default WishlistRecommendationRecord;
export { r17 as WishlistRecommendationReason };
@@ -0,0 +1,71 @@
// Metro module 8675 (f8676).
import Record from "../../../lib/Record";
import ApplicationRecord from "../../../records/ApplicationRecord";
import BaseWishlistItemRecord from "./BaseWishlistItemRecord";
import CollectiblesWishlistItemRecord from "./CollectiblesWishlistItemRecord";
import PremiumWishlistItemRecord from "./PremiumWishlistItemRecord";
import SKUWishlistItemRecord from "./SKUWishlistItemRecord";
import { SKUProductLines } from "../../../Constants";
import { $callWithNewTarget } from "../../../_hermes/prelude";
class WishlistRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.userId = a0.userId;
this.items = a0.items;
let applications = a0.applications;
if (applications == null) {
applications = void 0;
}
this.applications = applications;
}
static fromServer({ user_id, wishlist_items, ...rest }) {
const items = wishlist_items.map((wishlist_item) => {
const sku_product_line = wishlist_item.sku_product_line;
if (SKUProductLines.COLLECTIBLES === sku_product_line) {
return CollectiblesWishlistItemRecord.fromServer(wishlist_item);
}
if (SKUProductLines.SOCIAL_LAYER_GAME_ITEM === sku_product_line) {
return SKUWishlistItemRecord.fromServer(wishlist_item);
}
if (SKUProductLines.PREMIUM === sku_product_line) {
return PremiumWishlistItemRecord.fromServer(wishlist_item);
}
return BaseWishlistItemRecord.fromServer(wishlist_item);
});
const applications = rest.applications;
let applications3 = applications == null ? void 0 : applications.map((application) => ApplicationRecord.createFromServer(application));
if (applications3 == null) {
applications3 = void 0;
}
const r17 = {
...rest,
userId: user_id,
items,
applications: applications3
};
const prototypeOf = Object.getPrototypeOf(WishlistRecord);
const r29 = Object.create(WishlistRecord.prototype);
const r30 = $callWithNewTarget(prototypeOf, r29, WishlistRecord);
const r31 = r30 instanceof Object ? r30 : r29;
r31.id = r17.id;
r31.userId = r17.userId;
r31.items = r17.items;
let applications2 = r17.applications;
if (applications2 == null) {
applications2 = void 0;
}
r31.applications = applications2;
return r31;
}
}
export default WishlistRecord;
export function getWishlistSkuIds(a0) {
return a0.items.map((item) => item.skuId);
}
export function wishlistHasSkuId(a0, c16714_0) {
return a0.items.some((item) => item.skuId === c16714_0);
}
export function getWishlistProductLines(a0) {
return new Set(a0.items.map((item) => item.skuProductLine));
}