596 lines
19 KiB
TypeScript
596 lines
19 KiB
TypeScript
// Metro module 5793 (f5794).
|
|
import { getCountryCodeByAlpha2 } from "../i18n/CountryCodeUtils";
|
|
import MobileCacheSnapshotStore from "../../stores/MobileCacheSnapshotStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { FAMILY_CENTER_REFETCH_COOLDOWN, FAMILY_CENTER_SUB_ROUTES, FamilyCenterSubPages, TeenActionDisplayType } from "./FamilyCenterConstants";
|
|
import { dangerouslyConstructGuildRecordFromUntypedObject } from "../../utils/GuildRecordUtils";
|
|
import SnowflakeUtils from "../../utils/SnowflakeUtils";
|
|
import FamilyCenterActionCreators from "./FamilyCenterActionCreators";
|
|
import { displayTypeFromString } from "./FamilyCenterUtils";
|
|
import { getIsFamilyCenterV3Enabled } from "./FamilyCenterV3Experiment";
|
|
import { $callWithNewTarget } from "../../_hermes/prelude";
|
|
function $mk77050() {
|
|
return (a0, a1) => {
|
|
const r0 = {
|
|
...a0
|
|
};
|
|
r0[a1.user_id] = a1;
|
|
return r0;
|
|
};
|
|
}
|
|
function $mk77051($env) {
|
|
return (a0) => {
|
|
const r7 = $env[0].get(a0.display_type);
|
|
if (!(r7 === void 0 || r7.has(a0.event_id))) {
|
|
r7.set(a0.event_id, a0);
|
|
}
|
|
};
|
|
}
|
|
function $mk77053() {
|
|
return (a0, a1) => {
|
|
if (a1.invoice_items != null && a1.invoice_items.length > 0) {
|
|
const r12 = a1.invoice_items[0];
|
|
const { sku_id, subscription_plan_id } = r12;
|
|
if (!(sku_id == null && subscription_plan_id == null)) {
|
|
a0[a1.id] = {
|
|
sku_id,
|
|
subscription_plan_id,
|
|
total: a1.total,
|
|
currency: a1.currency
|
|
};
|
|
}
|
|
}
|
|
return a0;
|
|
};
|
|
}
|
|
function $mk77054() {
|
|
return (a0, a1) => {
|
|
a0[a1.entitlement_id] = a1;
|
|
return a0;
|
|
};
|
|
}
|
|
function $mk77056($env) {
|
|
return () => $env[0].loadCache();
|
|
}
|
|
let REQUESTS2;
|
|
let c3606_0;
|
|
let teenId, rangeStartId, c3605_12, c3605_13, c3605_14, totals, linkCode, expiresAt, REQUESTS, c3605_19, c3605_20, c3605_21, c3605_22, topUserActivities, topGuildActivities, totalSpendAmount, totalSpendCurrency, c3605_27, c3605_28, c3605_29, c3605_30, c3605_31, c3605_32, handleFetchStart, handleInitialLoad, handleLinkedUserFetch, handleRequestLinkSuccess, handleTeenActivityFetch, handleTeenActivityMoreFetch, handleUserLinkStatusUpdate, handleUserLinkRemove, handleLinkCodeFetch, handleTabSelect, handleCurrentUserUpdate, handleConnectionOpen, handleSetLocationMetadata, reset, $mk77052 = function() {
|
|
return (a0, a1) => {
|
|
const r2 = {
|
|
...a0
|
|
};
|
|
const id = a1.id;
|
|
const r10 = {
|
|
...dangerouslyConstructGuildRecordFromUntypedObject(a1)
|
|
};
|
|
let approximate_member_count = a1.approximate_member_count;
|
|
if (approximate_member_count == null) {
|
|
approximate_member_count = 0;
|
|
}
|
|
r10.approximateMemberCount = approximate_member_count;
|
|
r2[id] = r10;
|
|
return r2;
|
|
};
|
|
};
|
|
const freshTeenActivityWithMap = function freshTeenActivityWithMap() {
|
|
const map = new Map();
|
|
map.set(TeenActionDisplayType.USER_ADD, new Map());
|
|
map.set(TeenActionDisplayType.GUILD_ADD, new Map());
|
|
map.set(TeenActionDisplayType.USER_INTERACTION, new Map());
|
|
map.set(TeenActionDisplayType.GUILD_INTERACTION, new Map());
|
|
map.set(TeenActionDisplayType.USER_CALLED, new Map());
|
|
map.set(TeenActionDisplayType.TOTAL_VOICE_MINUTES, new Map());
|
|
map.set(TeenActionDisplayType.PURCHASES, new Map());
|
|
map.set(TeenActionDisplayType.GIFTS, new Map());
|
|
return map;
|
|
};
|
|
handleFetchStart = function handleFetchStart() {
|
|
c3605_20 = true;
|
|
};
|
|
handleInitialLoad = function handleInitialLoad(a0) {
|
|
let env15173;
|
|
let linkedUsers = a0.linkedUsers;
|
|
const familyCenterTeenActivity = a0.familyCenterTeenActivity;
|
|
let ageGroup = a0.ageGroup;
|
|
const { actions, guilds, totals: totals2, teenId: teenId2, rangeStartId: rangeStartId2, topUserActivities: topUserActivities2, topGuildActivities: topGuildActivities2, totalSpendAmount: totalSpendAmount2, totalSpendCurrency: totalSpendCurrency2 } = familyCenterTeenActivity;
|
|
let spendingLimit = familyCenterTeenActivity.spendingLimit;
|
|
let monthlyPurchases = familyCenterTeenActivity.monthlyPurchases;
|
|
const { invoices, gifts } = familyCenterTeenActivity;
|
|
teenId = teenId2;
|
|
rangeStartId = rangeStartId2;
|
|
const r23 = env15173 = {};
|
|
env15173[0] = void 0;
|
|
const r25 = freshTeenActivityWithMap();
|
|
env15173[0] = r25;
|
|
actions.forEach($mk77051(r23));
|
|
c3605_14 = r25;
|
|
if (totals2 !== void 0) {
|
|
totals = totals2;
|
|
}
|
|
const r29 = c3605_32;
|
|
c3605_32 = guilds.reduce($mk77052(), r29);
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
if (invoices != null) {
|
|
c3605_29 = invoices.reduce($mk77053(), {});
|
|
}
|
|
if (gifts != null) {
|
|
c3605_30 = gifts.reduce($mk77054(), {});
|
|
}
|
|
topUserActivities = topUserActivities2;
|
|
topGuildActivities = topGuildActivities2;
|
|
totalSpendAmount = totalSpendAmount2;
|
|
totalSpendCurrency = totalSpendCurrency2;
|
|
if (spendingLimit == null) {
|
|
spendingLimit = null;
|
|
}
|
|
c3605_27 = spendingLimit;
|
|
if (monthlyPurchases == null) {
|
|
monthlyPurchases = null;
|
|
}
|
|
c3605_28 = monthlyPurchases;
|
|
if (ageGroup == null) {
|
|
ageGroup = null;
|
|
}
|
|
c3605_31 = ageGroup;
|
|
c3605_20 = false;
|
|
c3605_21 = SnowflakeUtils.fromTimestamp(Date.now());
|
|
c3605_19 = true;
|
|
};
|
|
handleLinkedUserFetch = function handleLinkedUserFetch({ linkedUsers }) {
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
};
|
|
handleRequestLinkSuccess = function handleRequestLinkSuccess({ linkedUsers }) {
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
};
|
|
handleTeenActivityFetch = function handleTeenActivityFetch({ familyCenterTeenActivity }) {
|
|
if (familyCenterTeenActivity === void 0) {
|
|
return false;
|
|
}
|
|
let env15174;
|
|
const { actions, totals: totals2, guilds, teenId: teenId2, rangeStartId: rangeStartId2, topUserActivities: topUserActivities2, topGuildActivities: topGuildActivities2, totalSpendAmount: totalSpendAmount2, totalSpendCurrency: totalSpendCurrency2, invoices, gifts } = familyCenterTeenActivity;
|
|
let spendingLimit = familyCenterTeenActivity.spendingLimit;
|
|
let monthlyPurchases = familyCenterTeenActivity.monthlyPurchases;
|
|
teenId = teenId2;
|
|
rangeStartId = rangeStartId2;
|
|
const r21 = env15174 = {};
|
|
env15174[0] = void 0;
|
|
const r23 = freshTeenActivityWithMap();
|
|
env15174[0] = r23;
|
|
actions.forEach($mk77051(r21));
|
|
c3605_14 = r23;
|
|
if (totals2 !== void 0) {
|
|
totals = totals2;
|
|
}
|
|
const r27 = c3605_32;
|
|
c3605_32 = guilds.reduce($mk77052(), r27);
|
|
if (invoices != null) {
|
|
c3605_29 = invoices.reduce($mk77053(), {});
|
|
}
|
|
if (gifts != null) {
|
|
c3605_30 = gifts.reduce($mk77054(), {});
|
|
}
|
|
topUserActivities = topUserActivities2;
|
|
topGuildActivities = topGuildActivities2;
|
|
c3605_20 = false;
|
|
c3605_21 = SnowflakeUtils.fromTimestamp(Date.now());
|
|
totalSpendAmount = totalSpendAmount2;
|
|
totalSpendCurrency = totalSpendCurrency2;
|
|
if (spendingLimit == null) {
|
|
spendingLimit = null;
|
|
}
|
|
c3605_27 = spendingLimit;
|
|
if (monthlyPurchases == null) {
|
|
monthlyPurchases = null;
|
|
}
|
|
c3605_28 = monthlyPurchases;
|
|
};
|
|
handleTeenActivityMoreFetch = function handleTeenActivityMoreFetch({ familyCenterTeenActivity }) {
|
|
let env15175;
|
|
const { actions, guilds } = familyCenterTeenActivity;
|
|
const r3 = env15175 = {};
|
|
const r8 = c3605_14;
|
|
env15175[0] = r8;
|
|
actions.forEach($mk77051(r3));
|
|
c3605_14 = r8;
|
|
const r12 = c3605_32;
|
|
c3605_32 = guilds.reduce($mk77052(), r12);
|
|
};
|
|
handleUserLinkStatusUpdate = function handleUserLinkStatusUpdate({ linkedUsers }) {
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
};
|
|
handleUserLinkRemove = function handleUserLinkRemove({ linkedUsers }) {
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
};
|
|
handleLinkCodeFetch = function handleLinkCodeFetch({ linkCode: linkCode2, expiresAt: expiresAt2 }) {
|
|
linkCode = linkCode2;
|
|
expiresAt = expiresAt2;
|
|
};
|
|
handleTabSelect = function handleTabSelect(a0) {
|
|
REQUESTS = a0.tab;
|
|
};
|
|
handleCurrentUserUpdate = function handleCurrentUserUpdate({ user }) {
|
|
if (user.linked_users === void 0) {
|
|
return false;
|
|
}
|
|
const users = UserStore.getUsers();
|
|
if (user.linked_users.some((linked_user) => users[linked_user.user_id] === void 0) && user.linked_users.length > Object.keys(c3605_12).length) {
|
|
FamilyCenterActionCreators.fetchLinkedUsers();
|
|
} else {
|
|
let linked_users = user.linked_users;
|
|
if (linked_users === void 0) {
|
|
linked_users = [];
|
|
}
|
|
c3605_12 = linked_users.length > 0 ? linked_users.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
}
|
|
};
|
|
handleConnectionOpen = function handleConnectionOpen({ linkedUsers }) {
|
|
if (linkedUsers == null) {
|
|
return false;
|
|
}
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
c3605_12 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
c3605_13 = true;
|
|
};
|
|
handleSetLocationMetadata = function handleSetLocationMetadata({ countryCode }) {
|
|
if (countryCode != null) {
|
|
let r6 = getCountryCodeByAlpha2(countryCode);
|
|
if (r6 == null) {
|
|
r6 = null;
|
|
}
|
|
c3605_22 = r6;
|
|
}
|
|
};
|
|
reset = function reset() {
|
|
let REQUESTS2;
|
|
teenId = null;
|
|
rangeStartId = null;
|
|
c3605_12 = {};
|
|
linkCode = null;
|
|
expiresAt = null;
|
|
c3605_14 = freshTeenActivityWithMap();
|
|
const r12 = {};
|
|
r12[TeenActionDisplayType.USER_ADD] = 0;
|
|
r12[TeenActionDisplayType.GUILD_ADD] = 0;
|
|
r12[TeenActionDisplayType.USER_INTERACTION] = 0;
|
|
r12[TeenActionDisplayType.GUILD_INTERACTION] = 0;
|
|
r12[TeenActionDisplayType.USER_CALLED] = 0;
|
|
r12[TeenActionDisplayType.TOTAL_VOICE_MINUTES] = 0;
|
|
r12[TeenActionDisplayType.PURCHASES] = 0;
|
|
r12[TeenActionDisplayType.GIFTS] = 0;
|
|
totals = r12;
|
|
c3605_32 = {};
|
|
c3605_20 = false;
|
|
c3605_21 = null;
|
|
const r22 = window;
|
|
if ((r22 == null ? void 0 : r22.location?.pathname) === FAMILY_CENTER_SUB_ROUTES.FAMILY_CENTER_MY_FAMILY) {
|
|
REQUESTS2 = FamilyCenterSubPages.REQUESTS;
|
|
} else {
|
|
const r27 = window;
|
|
REQUESTS2 = (r27 == null ? void 0 : r27.location?.pathname) === FAMILY_CENTER_SUB_ROUTES.FAMILY_CENTER_SETTINGS ? FamilyCenterSubPages.SETTINGS : FamilyCenterSubPages.ACTIVITY;
|
|
}
|
|
REQUESTS = REQUESTS2;
|
|
c3605_13 = false;
|
|
topUserActivities = [];
|
|
topGuildActivities = [];
|
|
totalSpendAmount = null;
|
|
totalSpendCurrency = null;
|
|
c3605_27 = null;
|
|
c3605_28 = null;
|
|
c3605_29 = {};
|
|
c3605_30 = {};
|
|
c3605_31 = null;
|
|
c3605_19 = false;
|
|
};
|
|
teenId = null;
|
|
rangeStartId = null;
|
|
c3605_12 = {};
|
|
c3605_13 = false;
|
|
c3605_14 = freshTeenActivityWithMap();
|
|
const r52 = {};
|
|
r52[TeenActionDisplayType.USER_ADD] = 0;
|
|
r52[TeenActionDisplayType.GUILD_ADD] = 0;
|
|
r52[TeenActionDisplayType.USER_INTERACTION] = 0;
|
|
r52[TeenActionDisplayType.GUILD_INTERACTION] = 0;
|
|
r52[TeenActionDisplayType.USER_CALLED] = 0;
|
|
r52[TeenActionDisplayType.TOTAL_VOICE_MINUTES] = 0;
|
|
r52[TeenActionDisplayType.PURCHASES] = 0;
|
|
r52[TeenActionDisplayType.GIFTS] = 0;
|
|
totals = r52;
|
|
linkCode = null;
|
|
expiresAt = null;
|
|
const r61 = window;
|
|
if ((r61 == null ? void 0 : r61.location?.pathname) === FAMILY_CENTER_SUB_ROUTES.FAMILY_CENTER_MY_FAMILY) {
|
|
REQUESTS2 = FamilyCenterSubPages.REQUESTS;
|
|
} else {
|
|
const r66 = window;
|
|
REQUESTS2 = (r66 == null ? void 0 : r66.location?.pathname) === FAMILY_CENTER_SUB_ROUTES.FAMILY_CENTER_SETTINGS ? FamilyCenterSubPages.SETTINGS : FamilyCenterSubPages.ACTIVITY;
|
|
}
|
|
let env3606;
|
|
REQUESTS = REQUESTS2;
|
|
c3605_19 = false;
|
|
c3605_20 = false;
|
|
c3605_21 = null;
|
|
c3605_22 = null;
|
|
topUserActivities = [];
|
|
topGuildActivities = [];
|
|
totalSpendAmount = null;
|
|
totalSpendCurrency = null;
|
|
c3605_27 = null;
|
|
c3605_28 = null;
|
|
c3605_29 = {};
|
|
c3605_30 = {};
|
|
c3605_31 = null;
|
|
c3605_32 = {};
|
|
class FamilyCenterStore extends MobileCacheSnapshotStore {
|
|
static displayName = "FamilyCenterStore";
|
|
static LATEST_SNAPSHOT_VERSION = 3;
|
|
constructor() {
|
|
let env15177;
|
|
const r1 = env15177 = {};
|
|
env15177[0] = void 0;
|
|
const r11 = {
|
|
CONNECTION_OPEN: handleConnectionOpen,
|
|
CURRENT_USER_UPDATE: handleCurrentUserUpdate,
|
|
CACHE_LOADED_LAZY: $mk77056(r1),
|
|
FAMILY_CENTER_INITIAL_LOAD: handleInitialLoad,
|
|
FAMILY_CENTER_FETCH_START: handleFetchStart,
|
|
FAMILY_CENTER_LINKED_USERS_FETCH_SUCCESS: handleLinkedUserFetch,
|
|
FAMILY_CENTER_TEEN_ACTIVITY_FETCH_SUCCESS: handleTeenActivityFetch,
|
|
FAMILY_CENTER_TEEN_ACTIVITY_MORE_FETCH_SUCCESS: handleTeenActivityMoreFetch,
|
|
FAMILY_CENTER_REQUEST_LINK_SUCCESS: handleRequestLinkSuccess,
|
|
FAMILY_CENTER_REQUEST_LINK_UPDATE_SUCCESS: handleUserLinkStatusUpdate,
|
|
FAMILY_CENTER_REQUEST_LINK_REMOVE_SUCCESS: handleUserLinkRemove,
|
|
FAMILY_CENTER_LINK_CODE_FETCH_SUCCESS: handleLinkCodeFetch,
|
|
FAMILY_CENTER_HANDLE_TAB_SELECT: handleTabSelect,
|
|
SET_LOCATION_METADATA: handleSetLocationMetadata,
|
|
LOGOUT: reset
|
|
};
|
|
super(r11);
|
|
env15177[0] = this;
|
|
}
|
|
initialize() {
|
|
this.waitFor(UserStore);
|
|
}
|
|
loadCache() {
|
|
const r11 = this.readSnapshot(FamilyCenterStore.LATEST_SNAPSHOT_VERSION);
|
|
if (r11 != null) {
|
|
let linkedUsers = r11.linkedUsers;
|
|
if (linkedUsers === void 0) {
|
|
linkedUsers = [];
|
|
}
|
|
const r14 = linkedUsers.length > 0 ? linkedUsers.reduce($mk77050(), {}) : {};
|
|
let env15178;
|
|
c3605_12 = r14;
|
|
c3605_13 = true;
|
|
const guilds = r11.guilds;
|
|
const r18 = c3605_32;
|
|
c3605_32 = guilds.reduce($mk77052(), r18);
|
|
const teenActivity = r11.teenActivity;
|
|
const r22 = env15178 = {};
|
|
env15178[0] = void 0;
|
|
const r24 = freshTeenActivityWithMap();
|
|
env15178[0] = r24;
|
|
teenActivity.forEach($mk77051(r22));
|
|
c3605_14 = r24;
|
|
const teenActivityTotals = r11.teenActivityTotals;
|
|
const r30 = {};
|
|
r30[TeenActionDisplayType.USER_ADD] = 0;
|
|
r30[TeenActionDisplayType.GUILD_ADD] = 0;
|
|
r30[TeenActionDisplayType.USER_INTERACTION] = 0;
|
|
r30[TeenActionDisplayType.GUILD_INTERACTION] = 0;
|
|
r30[TeenActionDisplayType.USER_CALLED] = 0;
|
|
r30[TeenActionDisplayType.TOTAL_VOICE_MINUTES] = 0;
|
|
r30[TeenActionDisplayType.PURCHASES] = 0;
|
|
r30[TeenActionDisplayType.GIFTS] = 0;
|
|
totals = teenActivityTotals.reduce((acc, teenActivityTotal) => {
|
|
const [r12, r13] = teenActivityTotal.split(":");
|
|
const r19 = displayTypeFromString(r12);
|
|
let r20 = acc;
|
|
if (r19 !== void 0) {
|
|
const r21 = {
|
|
...acc
|
|
};
|
|
r21[r19] = parseInt(r13, 10);
|
|
r20 = r21;
|
|
}
|
|
return r20;
|
|
}, r30);
|
|
}
|
|
}
|
|
takeSnapshot() {
|
|
let c15179_0;
|
|
const data = {
|
|
linkedUsers: Object.values(c3605_12),
|
|
teenActivityTotals: Object.entries(totals).map((item) => {
|
|
const [r7, r24] = item;
|
|
return `${r7}:${r24}`;
|
|
}),
|
|
teenActivity: null,
|
|
guilds: null
|
|
};
|
|
const teenActivity = [];
|
|
c15179_0 = teenActivity;
|
|
c3605_14.forEach((item) => {
|
|
c15179_0.push.apply(c15179_0, [...Array.from(item.values())]);
|
|
});
|
|
data.teenActivity = teenActivity;
|
|
data.guilds = Object.values(c3605_32);
|
|
return {
|
|
version: FamilyCenterStore.LATEST_SNAPSHOT_VERSION,
|
|
data
|
|
};
|
|
}
|
|
getSelectedTeenId() {
|
|
return teenId;
|
|
}
|
|
getLinkedUsers() {
|
|
return c3605_12;
|
|
}
|
|
getLinkTimestamp(a0) {
|
|
const r4 = c3605_12[a0];
|
|
const r1 = r4 == null;
|
|
let r6 = null;
|
|
if (!r1) {
|
|
let updated_at = r4.updated_at;
|
|
if (updated_at == null) {
|
|
updated_at = r4.created_at;
|
|
}
|
|
r6 = updated_at;
|
|
}
|
|
return r6;
|
|
}
|
|
getRangeStartTimestamp() {
|
|
return rangeStartId != null ? SnowflakeUtils.extractTimestamp(rangeStartId) : null;
|
|
}
|
|
getActionsForDisplayType(a0) {
|
|
const r5 = c3605_14.get(a0);
|
|
return r5 != null ? Array.from(r5.values()) : [];
|
|
}
|
|
getTotalForDisplayType(a0) {
|
|
return totals[a0];
|
|
}
|
|
getLinkCode() {
|
|
return linkCode;
|
|
}
|
|
getLinkCodeExpiresAt() {
|
|
return expiresAt;
|
|
}
|
|
getGuild(a0) {
|
|
return c3605_32[a0];
|
|
}
|
|
getSelectedTab() {
|
|
return REQUESTS;
|
|
}
|
|
getStartId() {
|
|
return rangeStartId;
|
|
}
|
|
getIsInitialized() {
|
|
return c3605_19;
|
|
}
|
|
getAreLinkedUsersProcessed() {
|
|
return c3605_13;
|
|
}
|
|
getUserCountry() {
|
|
return c3605_22;
|
|
}
|
|
isLoading() {
|
|
return c3605_20;
|
|
}
|
|
getTopUserActivities() {
|
|
return topUserActivities;
|
|
}
|
|
getTopGuildActivities() {
|
|
return topGuildActivities;
|
|
}
|
|
getTotalSpendAmount() {
|
|
return totalSpendAmount;
|
|
}
|
|
getTotalSpendCurrency() {
|
|
return totalSpendCurrency;
|
|
}
|
|
getTotalGiftValue() {
|
|
let currency = null;
|
|
let amount = 0;
|
|
let r0 = false;
|
|
for (const item of Object.values(c3605_30)) {
|
|
if (item.price == null) {
|
|
continue;
|
|
}
|
|
if (!(currency != null && item.price.currency !== currency)) {
|
|
currency = item.price.currency;
|
|
amount = amount + item.price.amount;
|
|
r0 = true;
|
|
continue;
|
|
}
|
|
return null;
|
|
}
|
|
return r0 ? currency != null ? {
|
|
amount,
|
|
currency
|
|
} : null : null;
|
|
}
|
|
getSpendingLimit() {
|
|
return c3605_27;
|
|
}
|
|
getMonthlyPurchases() {
|
|
return c3605_28;
|
|
}
|
|
getPurchaseInfo(a0) {
|
|
return c3605_29[a0];
|
|
}
|
|
getGiftInfo(a0) {
|
|
return c3605_30[a0];
|
|
}
|
|
getAgeGroup() {
|
|
return c3605_31;
|
|
}
|
|
canRefetch() {
|
|
return c3605_21 === null || SnowflakeUtils.age(c3605_21) > FAMILY_CENTER_REFETCH_COOLDOWN;
|
|
}
|
|
isCurrentUserInRestrictedHours() {
|
|
if (getIsFamilyCenterV3Enabled({
|
|
location: "isInRestrictedHours"
|
|
})) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const r2 = currentUser == null;
|
|
let r15 = void 0;
|
|
if (!r2) {
|
|
const restrictedSchedule = currentUser.restrictedSchedule;
|
|
r15 = restrictedSchedule == null ? void 0 : restrictedSchedule.isInRestrictedHours();
|
|
}
|
|
if (r15 == null) {
|
|
r15 = false;
|
|
}
|
|
return r15;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
const r143 = env3606 = {};
|
|
c3606_0 = void 0;
|
|
const prototypeOf = Object.getPrototypeOf(FamilyCenterStore);
|
|
const r147 = {
|
|
CONNECTION_OPEN: handleConnectionOpen,
|
|
CURRENT_USER_UPDATE: handleCurrentUserUpdate,
|
|
CACHE_LOADED_LAZY: $mk77056(r143),
|
|
FAMILY_CENTER_INITIAL_LOAD: handleInitialLoad,
|
|
FAMILY_CENTER_FETCH_START: handleFetchStart,
|
|
FAMILY_CENTER_LINKED_USERS_FETCH_SUCCESS: handleLinkedUserFetch,
|
|
FAMILY_CENTER_TEEN_ACTIVITY_FETCH_SUCCESS: handleTeenActivityFetch,
|
|
FAMILY_CENTER_TEEN_ACTIVITY_MORE_FETCH_SUCCESS: handleTeenActivityMoreFetch,
|
|
FAMILY_CENTER_REQUEST_LINK_SUCCESS: handleRequestLinkSuccess,
|
|
FAMILY_CENTER_REQUEST_LINK_UPDATE_SUCCESS: handleUserLinkStatusUpdate,
|
|
FAMILY_CENTER_REQUEST_LINK_REMOVE_SUCCESS: handleUserLinkRemove,
|
|
FAMILY_CENTER_LINK_CODE_FETCH_SUCCESS: handleLinkCodeFetch,
|
|
FAMILY_CENTER_HANDLE_TAB_SELECT: handleTabSelect,
|
|
SET_LOCATION_METADATA: handleSetLocationMetadata,
|
|
LOGOUT: reset
|
|
};
|
|
const r148 = Object.create(FamilyCenterStore.prototype);
|
|
const r149 = $callWithNewTarget(prototypeOf, r148, FamilyCenterStore, r147);
|
|
c3606_0 = r149 instanceof Object ? r149 : r148;
|
|
export default c3606_0;
|