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,109 @@
// Metro module 13939 (f13940).
import { useMemo, useState, useCallback } from "react";
import FamilyCenterStore from "./FamilyCenterStore";
import { ParentalControlledSpendingLimit } from "../user_settings/family_center/ParentalControlledUserSettings";
import { useStateFromStores } from "../../_bundle/Module589";
import { CurrencyExponents } from "../../_bundle/convertToMajorCurrencyUnits";
import { getCurrencySymbol, getNextRenewalDateLabel, sanitizeAmountInput } from "./SpendingLimitUtils";
export function useChangeSpendingLimitFormState(a0) {
let currency, c20801_3, c20801_5, c20801_6, amount;
let c20801_0 = a0;
const controlledSetting = ParentalControlledSpendingLimit.useControlledSetting(a0);
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getSpendingLimit());
const stateFromStores2 = useStateFromStores([FamilyCenterStore], () => {
let r6 = FamilyCenterStore.getMonthlyPurchases()?.total_amount;
if (r6 == null) {
r6 = null;
}
return r6;
});
let r37 = controlledSetting?.currency;
if (r37 == null) {
r37 = stateFromStores?.currency;
}
if (r37 == null) {
r37 = "usd";
}
currency = r37.toLowerCase();
let exponent = CurrencyExponents[currency];
if (exponent == null) {
exponent = 2;
}
c20801_3 = exponent;
const memo = useMemo(() => getCurrencySymbol(currency), [currency]);
const memo2 = useMemo(getNextRenewalDateLabel, []);
let [amountInput, setState] = useState(() => controlledSetting == null ? "" : String(controlledSetting.amount / 10 ** c20801_3));
const callback = useCallback((a0) => setState(sanitizeAmountInput(a0, c20801_3)), [exponent]);
const isClearingCap = amountInput === "" && controlledSetting != null;
c20801_5 = isClearingCap;
const r22 = parseFloat(amountInput);
const isNaN2 = Number.isNaN(r22);
const r3 = isNaN2 ? !isNaN2 : r22 >= 0;
const canSave = isClearingCap || r3;
c20801_6 = canSave;
amount = r3 ? Math.round(r22 * 10 ** exponent) : null;
const [isSubmitting, setState2] = useState(false);
return {
amountInput,
handleAmountChange: callback,
currency,
currencySymbol: memo,
exponent,
isClearingCap,
isOverspending: stateFromStores2 != null && stateFromStores2 > 0 && amount != null && amount <= stateFromStores2,
canSave,
isSubmitting,
renewalDate: memo2,
monthlySpend: stateFromStores2,
save: useCallback(async () => {
let c27591_2;
let c27591_3 = 0;
L18: {
try {
if (!c20801_6) {
break L18;
}
setState2(true);
c27591_3 = 1;
if (c20801_5) {
await ParentalControlledSpendingLimit.updateControlledSetting(c20801_0, null);
} else {
if (amount == null) {
c27591_3 = 0;
(0, setState2)(false);
break L18;
}
await ParentalControlledSpendingLimit.updateControlledSetting(c20801_0, {
amount,
currency
});
}
c27591_3 = 0;
(0, setState2)(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c27591_2 = r29;
if (c27591_3 !== 0) {
while (true) {
try {
const r102 = c27591_2;
c27591_3 = 0;
(0, setState2)(false);
throw r102;
} catch (r99) {
r7 = r99;
c27591_2 = r99;
if (c27591_3 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
}, [canSave, isClearingCap, amount, a0, currency])
};
}
@@ -0,0 +1,132 @@
// Metro module 2223 (f2224).
import { loadJsonAsset } from "../asset_json/native/AssetJsonUtils";
import * as _Module2224 from "../../_bundle/Module2224";
import * as _Module2225 from "../../_bundle/Module2225";
import * as _Module2226 from "../../_bundle/Module2226";
import * as _Module2227 from "../../_bundle/Module2227";
import * as _Module2228 from "../../_bundle/Module2228";
import * as _Module2229 from "../../_bundle/Module2229";
import * as _Module2230 from "../../_bundle/Module2230";
import * as _Module2231 from "../../_bundle/Module2231";
import * as _Module2232 from "../../_bundle/Module2232";
import * as _Module2233 from "../../_bundle/Module2233";
import * as _Module2234 from "../../_bundle/Module2234";
import * as _Module2235 from "../../_bundle/Module2235";
import * as _Module2236 from "../../_bundle/Module2236";
import * as _Module2237 from "../../_bundle/Module2237";
import * as _Module2238 from "../../_bundle/Module2238";
import * as _Module2239 from "../../_bundle/Module2239";
import * as _Module2240 from "../../_bundle/Module2240";
import * as _Module2241 from "../../_bundle/Module2241";
import * as _Module2242 from "../../_bundle/Module2242";
import * as _Module2243 from "../../_bundle/Module2243";
import * as _Module2244 from "../../_bundle/Module2244";
import * as _Module2245 from "../../_bundle/Module2245";
import * as _Module2246 from "../../_bundle/Module2246";
import * as _Module2247 from "../../_bundle/Module2247";
import * as _Module2248 from "../../_bundle/Module2248";
import * as _Module2249 from "../../_bundle/Module2249";
import * as _Module2250 from "../../_bundle/Module2250";
import * as _Module2251 from "../../_bundle/Module2251";
import * as _Module2252 from "../../_bundle/Module2252";
import * as _Module2253 from "../../_bundle/Module2253";
import * as _Module2254 from "../../_bundle/Module2254";
import { createLoader, makeMessagesProxy } from "../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module2224).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module2225).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module2226).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module2227).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module2228).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module2229).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module2230).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module2231).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module2232).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module2233).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module2234).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module2235).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module2236).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module2237).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module2238).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module2239).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module2240).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module2241).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module2242).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module2243).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module2244).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module2245).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module2246).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module2247).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module2248).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module2249).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module2250).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module2251).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module2252).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module2253).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module2254).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
@@ -0,0 +1,470 @@
// Metro module 5795 (f5796).
import FamilyCenterControlledSettingsStore from "./FamilyCenterControlledSettingsStore";
import { FamilyCenterAction } from "./FamilyCenterConstants";
import { AnalyticEvents, Endpoints } from "../../Constants";
import { maybeFetchCollectiblesProduct } from "../collectibles/CollectiblesActionCreators";
import Dispatcher from "../../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { getProtoFieldClass, createModifiedProto } from "../user_settings/UserSettingsProtoUtils";
import { PreloadedUserSettings } from "../../_bundle/Module1306";
import { protoToB64 } from "../user_settings/UserSettingsUtils";
let maybeFetchCollectiblesForGifts;
const maybeFetchCollectiblesForInvoices = async function maybeFetchCollectiblesForInvoices(c25601_0) {
const set = new Set();
let c29610_0 = set;
c25601_0.forEach((item) => {
if (item.invoice_items != null && item.invoice_items.length > 0) {
const r8 = item.invoice_items[0];
if (r8.sku_id != null) {
c29610_0.add(r8.sku_id);
}
}
});
await Promise.all(Array.from(set).map((item) => maybeFetchCollectiblesProduct(item)));
};
maybeFetchCollectiblesForGifts = async function maybeFetchCollectiblesForGifts(c25602_0) {
const set = new Set();
let c29611_0 = set;
c25602_0.forEach((item) => {
if (item.sku_id != null) {
c29611_0.add(item.sku_id);
}
});
await Promise.all(Array.from(set).map((item) => maybeFetchCollectiblesProduct(item)));
};
const r32 = {
initialPageLoad: async () => {
let c25607_13;
c25607_13 = void 0;
Dispatcher.dispatch({
type: "FAMILY_CENTER_FETCH_START"
});
let c29613_0 = (await HTTP.get({
url: Endpoints.FAMILY_CENTER_TEEN_ACTIVITY_ME,
rejectWithError: rejectWithMigratedError()
})).body;
let c29613_1 = c29613_0.teen_audit_log;
let c29613_2 = c29613_0.linked_users;
let c29613_3 = c29613_0.users;
let c29613_4 = c29613_0.age_group;
const teen_user_id = c29613_1?.teen_user_id;
const range_start_id = c29613_1?.range_start_id;
const totals2 = c29613_1?.totals;
let totals = totals2;
if (totals2 == null) {
totals = {};
}
let actions = c29613_1?.actions;
if (actions == null) {
actions = [];
}
let users = c29613_1?.users;
if (users == null) {
users = [];
}
const guilds2 = c29613_1?.guilds;
let guilds = guilds2;
if (guilds2 == null) {
guilds = [];
}
const top_user_activities4 = c29613_1?.top_user_activities;
let top_user_activities = top_user_activities4;
if (top_user_activities4 == null) {
top_user_activities = [];
}
const top_guild_activities4 = c29613_1?.top_guild_activities;
let top_guild_activities = top_guild_activities4;
if (top_guild_activities4 == null) {
top_guild_activities = [];
}
let amount = c29613_1 == null ? void 0 : c29613_1.total_spend?.amount;
if (amount == null) {
amount = null;
}
let currency = c29613_1 == null ? void 0 : c29613_1.total_spend?.currency;
if (currency == null) {
currency = null;
}
const spending_limit3 = c29613_0.spending_limit;
let spending_limit = spending_limit3;
if (spending_limit3 == null) {
spending_limit = null;
}
const monthly_purchases3 = c29613_0.monthly_purchases;
let monthly_purchases = monthly_purchases3;
if (monthly_purchases3 == null) {
monthly_purchases = null;
}
const invoices4 = c29613_1?.invoices;
let invoices = invoices4;
if (invoices4 == null) {
invoices = [];
}
const gifts4 = c29613_1?.gifts;
let gifts = gifts4;
if (gifts4 == null) {
gifts = [];
}
let c29613_5 = {
teenId: teen_user_id,
rangeStartId: range_start_id,
totals,
actions,
users,
guilds,
topUserActivities: top_user_activities,
topGuildActivities: top_guild_activities,
totalSpendAmount: amount,
totalSpendCurrency: currency,
spendingLimit: spending_limit,
monthlyPurchases: monthly_purchases,
invoices,
gifts
};
if (c29613_5.invoices != null && c29613_5.invoices.length > 0) {
await (0, maybeFetchCollectiblesForInvoices)(c29613_5.invoices);
}
if (c29613_5.gifts != null && c29613_5.gifts.length > 0) {
await (0, maybeFetchCollectiblesForGifts)(c29613_5.gifts);
}
Dispatcher.dispatch({
type: "FAMILY_CENTER_INITIAL_LOAD",
familyCenterTeenActivity: c29613_5,
linkedUsers: c29613_2,
users: c29613_3,
ageGroup: c29613_4
});
if (c29613_0.restricted_schedule != null && c29613_5.teenId != null) {
Dispatcher.dispatch({
type: "USER_RESTRICTED_SCHEDULE_UPDATE",
userId: c29613_5.teenId,
restrictedSchedule: c29613_0.restricted_schedule
});
}
return c29613_5;
},
fetchLinkedUsers: async () => {
let c25608_1;
c25608_1 = void 0;
let c29614_0 = (await HTTP.get({
url: Endpoints.FAMILY_CENTER_LINKED_USERS,
rejectWithError: rejectWithMigratedError()
})).body;
let c29614_1 = {
linkedUsers: c29614_0.linked_users,
users: c29614_0.users
};
Dispatcher.dispatch({
type: "FAMILY_CENTER_LINKED_USERS_FETCH_SUCCESS",
...c29614_1
});
return c29614_1;
},
getConnectionPrerequisites: async (teen_id, link_code) => (await HTTP.get({
url: Endpoints.FAMILY_CENTER_CONNECTION_PREREQUISITES,
query: {
teen_id,
link_code
},
rejectWithError: true
})).body,
setPendingConnection: (a0, a1) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_PENDING_CONNECTION_SET",
teenId: a0,
linkCode: a1
});
},
clearPendingConnection: () => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_PENDING_CONNECTION_CLEAR"
});
},
requestLink: async (recipient_id, code) => {
let c25610_1;
c25610_1 = void 0;
let c29615_0 = (await HTTP.post({
url: Endpoints.FAMILY_CENTER_LINKED_USERS,
body: {
recipient_id,
code
},
rejectWithError: rejectWithMigratedError()
})).body;
let c29615_1 = {
linkedUsers: c29615_0.linked_users,
users: c29615_0.users
};
Dispatcher.dispatch({
type: "FAMILY_CENTER_REQUEST_LINK_SUCCESS",
...c29615_1
});
return c29615_1;
},
fetchTeenActivity: async (c15182_0) => {
let c25611_9;
c25611_9 = void 0;
Dispatcher.dispatch({
type: "FAMILY_CENTER_FETCH_START"
});
let c29616_0 = (await HTTP.get({
url: Endpoints.FAMILY_CENTER_TEEN_ACTIVITY(c15182_0),
rejectWithError: rejectWithMigratedError()
})).body;
let c29616_1 = c29616_0.teen_audit_log;
const top_user_activities4 = c29616_1.top_user_activities;
let top_user_activities2 = top_user_activities4;
if (top_user_activities4 == null) {
top_user_activities2 = [];
}
const top_guild_activities4 = c29616_1.top_guild_activities;
let top_guild_activities2 = top_guild_activities4;
if (top_guild_activities4 == null) {
top_guild_activities2 = [];
}
const r94 = c29616_1 == null ? void 0 : c29616_1.total_spend?.amount;
let amount2 = r94;
if (r94 == null) {
amount2 = null;
}
const r102 = c29616_1 == null ? void 0 : c29616_1.total_spend?.currency;
let currency2 = r102;
if (r102 == null) {
currency2 = null;
}
const spending_limit3 = c29616_0.spending_limit;
let spending_limit2 = spending_limit3;
if (spending_limit3 == null) {
spending_limit2 = null;
}
const monthly_purchases3 = c29616_0.monthly_purchases;
let monthly_purchases2 = monthly_purchases3;
if (monthly_purchases3 == null) {
monthly_purchases2 = null;
}
const invoices4 = c29616_1?.invoices;
let invoices2 = invoices4;
if (invoices4 == null) {
invoices2 = [];
}
const gifts4 = c29616_1?.gifts;
let gifts2 = gifts4;
if (gifts4 == null) {
gifts2 = [];
}
let c29616_2 = {
teenId: c29616_1.teen_user_id,
rangeStartId: c29616_1.range_start_id,
totals: c29616_1.totals,
actions: c29616_1.actions,
users: c29616_1.users,
guilds: c29616_1.guilds,
topUserActivities: top_user_activities2,
topGuildActivities: top_guild_activities2,
totalSpendAmount: amount2,
totalSpendCurrency: currency2,
spendingLimit: spending_limit2,
monthlyPurchases: monthly_purchases2,
invoices: invoices2,
gifts: gifts2
};
if (c29616_2.invoices && c29616_2.invoices.length > 0) {
await (0, maybeFetchCollectiblesForInvoices)(c29616_2.invoices);
}
if (c29616_2.gifts && c29616_2.gifts.length > 0) {
await (0, maybeFetchCollectiblesForGifts)(c29616_2.gifts);
}
Dispatcher.dispatch({
type: "FAMILY_CENTER_TEEN_ACTIVITY_FETCH_SUCCESS",
familyCenterTeenActivity: c29616_2
});
if (c29616_0.restricted_schedule != null) {
Dispatcher.dispatch({
type: "USER_RESTRICTED_SCHEDULE_UPDATE",
userId: c15182_0,
restrictedSchedule: c29616_0.restricted_schedule
});
}
return c29616_2;
},
fetchMoreTeenActivity: async (c15183_0, c15183_1, c15183_2, c15183_3) => {
let c25612_7;
c25612_7 = void 0;
let c29617_0 = (await HTTP.get({
url: Endpoints.FAMILY_CENTER_TEEN_ACTIVITY_MORE(c15183_0, c15183_1, c15183_2, c15183_3),
rejectWithError: rejectWithMigratedError()
})).body.teen_audit_log;
const top_user_activities4 = c29617_0.top_user_activities;
let top_user_activities3 = top_user_activities4;
if (top_user_activities4 == null) {
top_user_activities3 = [];
}
const top_guild_activities4 = c29617_0.top_guild_activities;
let top_guild_activities3 = top_guild_activities4;
if (top_guild_activities4 == null) {
top_guild_activities3 = [];
}
const r86 = c29617_0 == null ? void 0 : c29617_0.total_spend?.amount;
let amount3 = r86;
if (r86 == null) {
amount3 = null;
}
const r94 = c29617_0 == null ? void 0 : c29617_0.total_spend?.currency;
let currency3 = r94;
if (r94 == null) {
currency3 = null;
}
const invoices4 = c29617_0?.invoices;
let invoices3 = invoices4;
if (invoices4 == null) {
invoices3 = [];
}
const gifts4 = c29617_0?.gifts;
let gifts3 = gifts4;
if (gifts4 == null) {
gifts3 = [];
}
let c29617_1 = {
teenId: c29617_0.teen_user_id,
rangeStartId: c29617_0.range_start_id,
actions: c29617_0.actions,
users: c29617_0.users,
guilds: c29617_0.guilds,
topUserActivities: top_user_activities3,
topGuildActivities: top_guild_activities3,
totalSpendAmount: amount3,
totalSpendCurrency: currency3,
invoices: invoices3,
gifts: gifts3
};
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.LoadMore,
selected_teen_id: c15183_0,
action_display_type: c15183_1
});
Dispatcher.dispatch({
type: "FAMILY_CENTER_TEEN_ACTIVITY_MORE_FETCH_SUCCESS",
familyCenterTeenActivity: c29617_1
});
return c29617_0;
},
selectTab: (a0) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_HANDLE_TAB_SELECT",
tab: a0
});
},
fetchTeenSettingsAndConsents: (a0) => {
const userId = a0;
return HTTP.get({
url: Endpoints.FAMILY_CENTER_TEEN_SETTINGS_AND_CONSENTS(a0),
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_TEEN_SETTINGS_AND_CONSENTS_FETCH_SUCCESS",
userId,
settings: body.settings,
consents: body.consents
});
});
},
updateTeenSettings: async (c15185_0, c15185_1, c15185_2) => {
let c25613_1;
let c29618_0;
L15: {
c25613_1 = void 0;
c29618_0 = void 0;
const protoFieldClass = getProtoFieldClass(PreloadedUserSettings, c15185_1);
const settings = FamilyCenterControlledSettingsStore.getSettings(c15185_0);
const modifiedProto = createModifiedProto(settings == null ? void 0 : settings[c15185_1], c15185_2, protoFieldClass, PreloadedUserSettings, c15185_1);
if (modifiedProto != null) {
c29618_0 = (await HTTP.patch({
url: Endpoints.FAMILY_CENTER_TEEN_SETTINGS(c15185_0),
body: {
settings: protoToB64(PreloadedUserSettings, modifiedProto)
},
rejectWithError: rejectWithMigratedError()
})).body.settings;
Dispatcher.dispatch({
type: "FAMILY_CENTER_TEEN_UPDATE_SETTINGS_SUCCESS",
userId: c15185_0,
settings: c29618_0
});
break L15;
}
return void 0;
}
},
updateTeenConsents: (a0, a1, a2) => {
const userId2 = a0;
return HTTP.patch({
url: Endpoints.FAMILY_CENTER_TEEN_CONSENTS(a0),
body: {
grant: a1,
revoke: a2
},
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_TEEN_CONSENTS_UPDATE_SUCCESS",
userId: userId2,
consents: result.body
});
});
}
};
export default r32;
export async function updateLinkForUserId(linked_user_id, link_status) {
await HTTP.patch({
url: Endpoints.FAMILY_CENTER_LINKED_USERS,
body: {
linked_user_id,
link_status
},
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_REQUEST_LINK_UPDATE_SUCCESS",
linkedUsers: body
});
return body;
});
}
export async function removeLinkForUserId(linked_user_id2) {
const deletedUserId = linked_user_id2;
await HTTP.del({
url: Endpoints.FAMILY_CENTER_LINKED_USERS,
body: {
linked_user_id: linked_user_id2
},
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "FAMILY_CENTER_REQUEST_LINK_REMOVE_SUCCESS",
linkedUsers: body,
deletedUserId
});
return body;
});
}
export async function getLinkCodeForCurrentUser() {
await HTTP.get({
url: Endpoints.FAMILY_CENTER_LINK_CODE,
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
const link_code2 = body.link_code;
Dispatcher.dispatch({
type: "FAMILY_CENTER_LINK_CODE_FETCH_SUCCESS",
linkCode: link_code2,
expiresAt: body.expires_at
});
return link_code2;
});
}
export async function shareIarWithParents() {
await HTTP.post({
url: Endpoints.FAMILY_CENTER_SHARE_IAR_WITH_PARENTS,
rejectWithError: true
});
}
@@ -0,0 +1,53 @@
// Metro module 13935 (f13936).
import { intl } from "../../intl/index.native";
import { parseISO } from "../../_bundle/Module3414";
import { formatPrice } from "../../utils/PriceUtils";
import FamilyCenter_messages from "./FamilyCenter.messages";
export function getGiftRowDisplayInfo(a0) {
return {
skuId: a0.sku_id,
subscriptionPlanId: a0.subscription_plan_id,
price: a0.price,
gifterUserId: a0.gifter_user_id,
claimed: a0.claimed,
offeredAt: a0.offered_at,
claimedAt: a0.claimed_at
};
}
export function formatGiftDate(a0) {
return new Intl.DateTimeFormat(intl.currentLocale, {
month: "short",
day: "numeric"
}).format(parseISO(a0));
}
export function getGiftSubtext(a0) {
let r63;
const { claimed, price, gifterName, offeredAt } = a0;
let claimedAt = a0.claimedAt;
const price2 = price != null ? formatPrice(price.amount, price.currency) : null;
const r38 = [price2 != null && gifterName != null ? intl.formatToPlainString(FamilyCenter_messages["o44n/1"], {
price: price2,
username: gifterName
}) : price2 ?? null, ,];
if (claimed) {
const kDyllq = FamilyCenter_messages.kDyllq;
if (claimedAt == null) {
claimedAt = offeredAt;
}
r63 = intl.formatToPlainString(kDyllq, {
date: new Intl.DateTimeFormat(intl.currentLocale, {
month: "short",
day: "numeric"
}).format(parseISO(claimedAt))
});
} else {
r63 = intl.formatToPlainString(FamilyCenter_messages.gAG45y, {
date: new Intl.DateTimeFormat(intl.currentLocale, {
month: "short",
day: "numeric"
}).format(parseISO(offeredAt))
});
}
r38[1] = r63;
return r38.filter(Boolean).join(" • ");
}
@@ -0,0 +1,80 @@
// Metro module 13933 (f13934).
import { isAvatarDecorationRecord } from "../collectibles/records/AvatarDecorationRecord";
import { isProfileEffectRecord } from "../collectibles/records/ProfileEffectRecord";
import { PremiumSubscriptionSKUs, SubscriptionPlanInfo } from "../premium/PremiumConstants";
import { CollectiblesItemType } from "../../_bundle/Module1901";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
import { getAvatarDecorationURL } from "../../utils/AvatarUtils";
const getCollectibleTypeName = function getCollectibleTypeName(type) {
if (CollectiblesItemType.AVATAR_DECORATION === type) {
return intl.string(FamilyCenter_messages.obi47v);
}
if (CollectiblesItemType.PROFILE_EFFECT === type) {
return intl.string(FamilyCenter_messages.RX8BMR);
}
if (CollectiblesItemType.NAMEPLATE === type) {
return intl.string(FamilyCenter_messages.nNGEHk);
}
if (CollectiblesItemType.BUNDLE === type) {
return intl.string(FamilyCenter_messages.VS1fKo);
}
if (CollectiblesItemType.PROFILE_FRAME === type) {
return intl.string(FamilyCenter_messages.JiIY1l);
}
return "";
};
export const PREVIEW_SIZE = 40;
export const NAMEPLATE_ASPECT_RATIO = 5.333333333333333;
export { getCollectibleTypeName };
export function getAvatarDecorationPreviewUrl(a0) {
if (a0.items.length === 0) {
return null;
}
const r7 = a0.items[0];
return isAvatarDecorationRecord(r7) ? getAvatarDecorationURL({
avatarDecoration: {
asset: r7.asset
},
size: 40,
canAnimate: true
}) : null;
}
export function getProfileEffectPreviewUrl(a0) {
if (a0.items.length === 0) {
return null;
}
const r8 = a0.items[0];
return isProfileEffectRecord(r8) ? r8.thumbnailPreviewSrc : null;
}
export function isGuildBoostSubscription(a0) {
if (a0 == null) {
return false;
}
return SubscriptionPlanInfo[a0]?.skuId === PremiumSubscriptionSKUs.GUILD;
}
export function getPurchaseDisplayInfo(a0, a1) {
let name, typeName;
const isSubscription = a1 != null;
if (a0 != null) {
name = a0.name;
typeName = getCollectibleTypeName(a0.type);
} else {
typeName = void 0;
name = void 0;
if (isSubscription) {
const r2 = a1 != null;
typeName = void 0;
name = void 0;
if (r2) {
name = SubscriptionPlanInfo[a1]?.name;
typeName = void 0;
}
}
}
return {
displayName: name,
typeName,
isSubscription
};
}
@@ -0,0 +1,8 @@
// Metro module 14444 (f14445).
import FamilyCenterStore from "./FamilyCenterStore";
import FamilyCenterActionCreators from "./FamilyCenterActionCreators";
export function prefetchFamilyCenterAgeGroupWhen(a0) {
if ((a0 ? FamilyCenterStore.getAgeGroup() == null : a0) && !FamilyCenterStore.isLoading() && FamilyCenterStore.canRefetch()) {
FamilyCenterActionCreators.initialPageLoad();
}
}
@@ -0,0 +1,15 @@
// Metro module 11121 (f11122).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-06-family-center-connection-prereq",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as FamilyCenterConnectionPrereqExperiment };
@@ -0,0 +1,308 @@
// Metro module 5794 (f5795).
import Durations from "../../utils/Durations";
import { wrapPaths } from "../../_bundle/getAuthenticationPath";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
const r10 = 30 * Durations.Millis.SECOND;
const r11 = 5 * Durations.Millis.MINUTE;
const r55 = 5 * Durations.Millis.MINUTE;
const r32 = wrapPaths(Object.freeze({
FAMILY_CENTER_SETTINGS: "/family-center/settings",
FAMILY_CENTER_MY_FAMILY: "/family-center/my-family"
}), [":", "?", "@"]);
const r31 = {
DM_MESSAGE_SEND: 1,
1: "DM_MESSAGE_SEND",
GDM_MESSAGE_SEND: 2,
2: "GDM_MESSAGE_SEND",
MESSAGE_REACT: 3,
3: "MESSAGE_REACT",
ADD_FRIEND: 4,
4: "ADD_FRIEND",
SEND_CALL: 5,
5: "SEND_CALL",
CALL_JOIN: 6,
6: "CALL_JOIN",
GUILD_JOIN: 7,
7: "GUILD_JOIN",
GUILD_MESSAGE_SEND: 8,
8: "GUILD_MESSAGE_SEND",
GUILD_VC_JOIN: 9,
9: "GUILD_VC_JOIN",
GUILD_VOICE_CHANNEL_LEAVE: 10,
10: "GUILD_VOICE_CHANNEL_LEAVE",
CALL_LEAVE: 11,
11: "CALL_LEAVE",
CALL_START: 12,
12: "CALL_START",
INVOICE_COMPLETE: 13,
13: "INVOICE_COMPLETE"
};
const r30 = {
PARENT: 1,
1: "PARENT",
CHILD: 2,
2: "CHILD"
};
const r29 = {
PENDING: 1,
1: "PENDING",
ACTIVE: 2,
2: "ACTIVE",
INACTIVE: 3,
3: "INACTIVE",
DECLINED: 4,
4: "DECLINED",
EXPIRED: 5,
5: "EXPIRED"
};
const r28 = {
USER_ADD: 1,
1: "USER_ADD",
GUILD_ADD: 2,
2: "GUILD_ADD",
USER_INTERACTION: 3,
3: "USER_INTERACTION",
GUILD_INTERACTION: 4,
4: "GUILD_INTERACTION",
USER_CALLED: 5,
5: "USER_CALLED",
TOTAL_VOICE_MINUTES: 6,
6: "TOTAL_VOICE_MINUTES",
PURCHASES: 7,
7: "PURCHASES",
GIFTS: 8,
8: "GIFTS"
};
const r27 = {
ACTIVITY: "ACTIVITY",
REQUESTS: "REQUESTS",
SETTINGS: "SETTINGS",
CONTENT_AND_SOCIAL: "CONTENT_AND_SOCIAL",
DATA_AND_PRIVACY: "DATA_AND_PRIVACY",
SCREEN_TIME_CONTROLS: "SCREEN_TIME_CONTROLS"
};
const r26 = {
ACTIVITY: 0,
0: "ACTIVITY",
REQUESTS: 1,
1: "REQUESTS",
SETTINGS: 2,
2: "SETTINGS",
CONTENT_AND_SOCIAL: 3,
3: "CONTENT_AND_SOCIAL",
DATA_AND_PRIVACY: 4,
4: "DATA_AND_PRIVACY",
SCREEN_TIME_CONTROLS: 5,
5: "SCREEN_TIME_CONTROLS"
};
const r25 = {
SIDENAV: "SIDENAV",
SETTINGS: "SETTINGS"
};
const r24 = {
SIDENAV: 0,
0: "SIDENAV",
SETTINGS: 1,
1: "SETTINGS"
};
const r101 = {
TabChange: 0,
0: "TabChange",
ShowQRCodeModal: 1,
1: "ShowQRCodeModal",
RevealQRCode: 2,
2: "RevealQRCode",
ScanQRCodeButton: 3,
3: "ScanQRCodeButton",
ScanQRCode: 4,
4: "ScanQRCode",
LoadMore: 5,
5: "LoadMore",
SelectTeen: 6,
6: "SelectTeen",
HideQRCode: 7,
7: "HideQRCode",
NufConsentGateLinkCodeError: 8,
8: "NufConsentGateLinkCodeError",
ShareLink: 9,
9: "ShareLink",
CopyLink: 10,
10: "CopyLink"
};
const map = new Map([[r28.USER_INTERACTION, {
priority: 100,
tooltipHeader: () => intl.string(FamilyCenter_messages.kvTgWP),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.w4wmnb) : intl.string(FamilyCenter_messages.foTzbd),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages["4T3zWT"], {
count: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.w4wmnb) : intl.string(FamilyCenter_messages.foTzbd),
timestampFormatter: () => ({
today: intl.string(FamilyCenter_messages.fLBUx7),
yesterday: intl.string(FamilyCenter_messages.cHHgxI),
days: FamilyCenter_messages.qvKjp8
})
}], [r28.USER_CALLED, {
priority: 200,
tooltipHeader: () => intl.string(FamilyCenter_messages.D7Sngz),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.aiAhnQ) : intl.string(FamilyCenter_messages["4ufgdz"]),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages["0GE4Ni"], {
count: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.aiAhnQ) : intl.string(FamilyCenter_messages["4ufgdz"]),
timestampFormatter: () => ({
today: intl.string(FamilyCenter_messages.IHd5cZ),
yesterday: intl.string(FamilyCenter_messages.wOsfxv),
days: FamilyCenter_messages.oCk8c4
})
}], [r28.USER_ADD, {
priority: 300,
tooltipHeader: () => intl.string(FamilyCenter_messages.kIcKAj),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.BkVb1X) : intl.string(FamilyCenter_messages.mpHHfa),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages["TEvo+H"], {
count: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.BkVb1X) : intl.string(FamilyCenter_messages.mpHHfa),
timestampFormatter: () => ({
today: intl.string(FamilyCenter_messages.JUHIYZ),
yesterday: intl.string(FamilyCenter_messages.GiswUW),
days: FamilyCenter_messages["fwQgE/"]
})
}], [r28.GUILD_ADD, {
priority: 400,
tooltipHeader: () => intl.string(FamilyCenter_messages.uav9Bh),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.LVNgTD) : intl.string(FamilyCenter_messages.TA8GFt),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages["7feG7T"], {
count: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.LVNgTD) : intl.string(FamilyCenter_messages.TA8GFt)
}], [r28.GUILD_INTERACTION, {
priority: 500,
tooltipHeader: () => intl.string(FamilyCenter_messages.CcrbCw),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.BLgIrk) : intl.string(FamilyCenter_messages.sSJauZ),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages.rcPInc, {
count: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.BLgIrk) : intl.string(FamilyCenter_messages.sSJauZ)
}], [r28.TOTAL_VOICE_MINUTES, {
priority: 175,
tooltipHeader: () => intl.string(FamilyCenter_messages.eo4Fxh),
tooltipDescription: () => intl.string(FamilyCenter_messages["O/AElu"]),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages.eGFWUd, {
count: a0
}),
sectionDescription: () => intl.string(FamilyCenter_messages["O/AElu"])
}], [r28.PURCHASES, {
priority: 150,
tooltipHeader: () => intl.string(FamilyCenter_messages.NMYKsh),
tooltipDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.cqIdqZ) : intl.string(FamilyCenter_messages["85PtWu"]),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages.FPViWL, {
amount: a0
}),
sectionDescription: (a0) => a0 ? intl.string(FamilyCenter_messages.cqIdqZ) : intl.string(FamilyCenter_messages["85PtWu"])
}], [r28.GIFTS, {
priority: 600,
tooltipHeader: () => intl.string(FamilyCenter_messages.ULUspo),
tooltipDescription: () => intl.string(FamilyCenter_messages.nH8vlc),
sectionHeader: (a0) => intl.formatToPlainString(FamilyCenter_messages["0R6I/b"], {
amount: a0
}),
sectionDescription: () => intl.string(FamilyCenter_messages.nH8vlc)
}]]);
const r176 = {
CHECK: 0,
0: "CHECK",
X: 1,
1: "X"
};
const r179 = {
GENERIC_ERROR: 0,
0: "GENERIC_ERROR",
INELIGIBLE_FOR_FAMILY_CENTER: 1,
1: "INELIGIBLE_FOR_FAMILY_CENTER",
PENDING_REQUEST_EXISTS: 2,
2: "PENDING_REQUEST_EXISTS",
MAX_CONNECTIONS_REACHED: 3,
3: "MAX_CONNECTIONS_REACHED"
};
const r185 = {
290000: r179.INELIGIBLE_FOR_FAMILY_CENTER,
290002: null,
290005: null
};
r185[290002] = r179.MAX_CONNECTIONS_REACHED;
r185[290005] = r179.PENDING_REQUEST_EXISTS;
const r188 = {};
r188[r179.GENERIC_ERROR] = {
header: () => intl.string(FamilyCenter_messages.nGX8Co),
description: () => intl.string(FamilyCenter_messages.Uss2dn),
icon: r176.X
};
r188[r179.PENDING_REQUEST_EXISTS] = {
header: () => intl.string(FamilyCenter_messages.tu0MRv),
description: ({ email }) => email != null ? intl.formatToPlainString(FamilyCenter_messages.xNEkdx, {
email
}) : intl.string(FamilyCenter_messages.Xyjnwn),
icon: r176.CHECK
};
r188[r179.MAX_CONNECTIONS_REACHED] = {
header: (a0) => a0.isAdult ? intl.string(FamilyCenter_messages.bS5x94) : intl.string(FamilyCenter_messages.MzX4RP),
description: (a0) => a0.isAdult ? intl.format(FamilyCenter_messages.GKzqWi, {
link: "https://support.discord.com/hc/articles/14155043715735"
}) : intl.format(FamilyCenter_messages["69F+eS"], {
link: "https://support.discord.com/hc/articles/14155060633623"
}),
icon: r176.X
};
r188[r179.INELIGIBLE_FOR_FAMILY_CENTER] = {
header: () => intl.string(FamilyCenter_messages.W9JLJh),
description: () => intl.format(FamilyCenter_messages.On5iRI, {
link: "https://support.discord.com/hc/requests/new?ticket_form_id=360000029731"
}),
icon: r176.X
};
export const RESTRICTED_HOURS_LAYER_KEY = "RESTRICTED_HOURS_LAYER";
export { r10 as FAMILY_CENTER_REFETCH_COOLDOWN };
export { r11 as FAMILY_CENTER_AGE_VERIFICATION_RESUME_TIMEOUT };
export const MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS = 8;
export const MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS = 3;
export const FAMILY_CENTER_REQUEST_SECTION_HEIGHT = 26;
export const FAMILY_CENTER_REQUEST_ROW_HEIGHT = 64;
export const FAMILY_CENTER_LINK_REQUEST_REGEX = /\/feature\/family-center\/my-family\/(\w+)\/(\w+)/;
export const FAMILY_CENTER_REQUEST_QR_CODE_URL = (a0, a1) => `https://discord.com/feature/family-center/my-family/${a0}/${a1}`;
export const FAMILY_CENTER_ITEMS_SHOWN_INCREMENTS = 4;
export { r55 as QR_CODE_AUTO_HIDE_TIMEOUT };
export const PLACEHOLDER_QR_CODE_URL = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
export { r32 as FAMILY_CENTER_SUB_ROUTES };
export { r31 as TeenActionType };
export { r30 as UserLinkType };
export { r29 as UserLinkStatus };
export { r28 as TeenActionDisplayType };
export { r27 as FamilyCenterSubPages };
export { r26 as FamilyCenterSubPageAnalyticsIds };
export { r25 as FamilyCenterPageLocation };
export { r24 as FamilyCenterPageLocationAnalyticsIds };
export { r101 as FamilyCenterAction };
export { map as ACTION_TO_TEXT };
export { r176 as FamilyCenterIconType };
export { r179 as FamilyCenterFailureCode };
export { r185 as FAMILY_CENTER_ERROR_CODE_TO_FAILURE };
export { r188 as FAMILY_CENTER_LINK_REQUEST_ERROR_EXPERIENCES };
export const CONNECT_GUARDIAN_BOTTOM_SHEET_KEY = "ConnectGuardianBottomSheet";
export const PENDING_LINK_REQUEST_TIMESTAMP_FORMATTER = () => ({
seconds: intl.string(FamilyCenter_messages.CJdoee),
minutes: FamilyCenter_messages.InzMn3,
hours: FamilyCenter_messages.ErkYCI,
yesterday: intl.string(FamilyCenter_messages.GvfssA),
days: FamilyCenter_messages.pWig18,
date: FamilyCenter_messages.MP3khg
});
export const ACCEPTED_LINK_REQUEST_TIMESTAMP_FORMATTER = () => ({
seconds: intl.string(FamilyCenter_messages.Bqsamd),
minutes: FamilyCenter_messages.kX3wJg,
hours: FamilyCenter_messages.J18GbG,
yesterday: intl.string(FamilyCenter_messages.Ln9zMn),
days: FamilyCenter_messages.WRtySz,
date: FamilyCenter_messages.Y3ZYtM
});
@@ -0,0 +1,60 @@
// Metro module 5796 (f5797).
import { b64ToPreloadedUserSettingsProto, mergeTopLevelFields } from "../user_settings/UserSettingsUtils";
import { PreloadedUserSettings } from "../../_bundle/Module1306";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3609_2 = false;
let c3609_3 = {};
let c3609_4 = {};
class FamilyCenterControlledSettingsStore extends Module589.Store {
static displayName = "FamilyCenterControlledSettingsStore";
getSettings(a0) {
return c3609_3[a0];
}
getControlledSettings(a0) {
return c3609_3[a0];
}
hasSettingsForUser(a0) {
return c3609_3[a0] != null;
}
getConsents(a0) {
return c3609_4[a0];
}
hasConsented(a0, a1) {
if (a0 == null) {
return false;
}
const r4 = c3609_4[a0];
return r4 != null && (r4[a1] != null && r4[a1].consented);
}
get isLoading() {
return c3609_2;
}
}
const familyCenterControlledSettingsStore = new FamilyCenterControlledSettingsStore(Dispatcher, {
FAMILY_CENTER_TEEN_SETTINGS_FETCH_START: function handleTeenSettingsFetchStart() {
c3609_2 = true;
},
FAMILY_CENTER_TEEN_SETTINGS_AND_CONSENTS_FETCH_SUCCESS: function handleTeenSettingsAndConsentsFetchSuccess({ userId, settings, consents }) {
if (settings != null) {
c3609_3[userId] = b64ToPreloadedUserSettingsProto(settings);
}
if (consents != null) {
c3609_4[userId] = consents;
}
c3609_2 = false;
},
FAMILY_CENTER_TEEN_CONSENTS_UPDATE_SUCCESS: function handleTeenConsentsUpdateSuccess(a0) {
c3609_4[a0.userId] = a0.consents;
},
FAMILY_CENTER_TEEN_UPDATE_SETTINGS_SUCCESS: function handleTeenUpdateSettingsSuccess(a0) {
const userId = a0.userId;
c3609_3[userId] = mergeTopLevelFields(PreloadedUserSettings, c3609_3[userId], b64ToPreloadedUserSettingsProto(a0.settings));
},
LOGOUT: function handleLogout() {
c3609_3 = {};
c3609_4 = {};
c3609_2 = false;
}
});
export default familyCenterControlledSettingsStore;
@@ -0,0 +1,80 @@
// Metro module 13859 (f13860).
import { ExplicitContentRedaction } from "../../_bundle/Module1306";
import { ParentalControlledGoreContent, ParentalControlledExplicitContent, ParentalControlledLegacyExplicitContent } from "../user_settings/family_center/ParentalControlledUserSettings";
import { resolveGoreSettingWithDefaultsForTeen } from "../explicit_media_redaction/SensitiveMediaGoreRedactionSettingsUtils";
import { TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_FRIEND_DM, TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_NON_FRIEND_DM } from "../explicit_media_redaction/SensitiveMediaExplicitRedactionSettingsUtils";
let getExplicitContentSettingOrDefault;
const getGoreContentSettingOrDefault = function getGoreContentSettingOrDefault(selectedTeenId) {
let r14 = ParentalControlledGoreContent.getControlledSetting(selectedTeenId);
if (r14 == null) {
r14 = {};
}
let goreContentNonFriendDm = r14.goreContentNonFriendDm;
let goreContentFriendDm = r14.goreContentFriendDm;
if (!(goreContentNonFriendDm != null && goreContentNonFriendDm !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION)) {
goreContentNonFriendDm = resolveGoreSettingWithDefaultsForTeen({
isDm: true
});
}
if (!(goreContentFriendDm != null && goreContentFriendDm !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION)) {
goreContentFriendDm = resolveGoreSettingWithDefaultsForTeen({
isDm: true,
isFriend: true
});
}
return {
goreContentNonFriendDm,
goreContentFriendDm,
goreContentGuilds: ExplicitContentRedaction.BLUR
};
};
getExplicitContentSettingOrDefault = function getExplicitContentSettingOrDefault(selectedTeenId) {
const controlledSetting = ParentalControlledExplicitContent.getControlledSetting(selectedTeenId);
const r16 = {
teenId: selectedTeenId,
setting: controlledSetting?.explicitContentNonFriendDm
};
const teenId = r16.teenId;
let setting = r16.setting;
let isFriend = r16.isFriend;
if (isFriend === void 0) {
isFriend = false;
}
if (!(setting != null && setting !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION)) {
const controlledSetting2 = ParentalControlledLegacyExplicitContent.getControlledSetting(teenId);
setting = isFriend ? TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_FRIEND_DM[controlledSetting2] : TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_NON_FRIEND_DM[controlledSetting2];
}
let explicitContentFriendDm = controlledSetting?.explicitContentFriendDm;
if (!(explicitContentFriendDm != null && explicitContentFriendDm !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION)) {
explicitContentFriendDm = TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_FRIEND_DM[ParentalControlledLegacyExplicitContent.getControlledSetting(selectedTeenId)];
}
return {
explicitContentNonFriendDm: setting,
explicitContentFriendDm,
explicitContentGuilds: ExplicitContentRedaction.BLUR
};
};
export function isSetAndNotDefault(a0) {
return a0 != null && a0 !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION;
}
export { getGoreContentSettingOrDefault };
export function updateGoreContentSetting(a0, a1) {
ParentalControlledGoreContent.updateControlledSetting(a0, {
...getGoreContentSettingOrDefault(a0),
...a1
});
}
export function resolveExplicitContentSettingWithDefaultsForTeen({ teenId, setting, isFriend = false }) {
if (setting != null && setting !== ExplicitContentRedaction.UNSET_EXPLICIT_CONTENT_REDACTION) {
return setting;
}
const controlledSetting = ParentalControlledLegacyExplicitContent.getControlledSetting(teenId);
return isFriend ? TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_FRIEND_DM[controlledSetting] : TEEN_EXPLICIT_CONTENT_FILTER_TO_EXPLICIT_CONTENT_REDACTION_NON_FRIEND_DM[controlledSetting];
}
export { getExplicitContentSettingOrDefault };
export function updateExplicitContentSetting(a0, a1) {
ParentalControlledExplicitContent.updateControlledSetting(a0, {
...getExplicitContentSettingOrDefault(a0),
...a1
});
}
@@ -0,0 +1,70 @@
// Metro module 11109 (f11110).
import { FamilyCenterFailureCode } from "./FamilyCenterConstants";
import FamilyCenterActionCreators from "./FamilyCenterActionCreators";
let c7502_3, c7502_4;
const getConnectionPrereqTarget = function getConnectionPrereqTarget(a0) {
return "ready" in a0 ? {
section: c7502_3.REQUEST,
params: {
teenIdentity: a0.teen_identity
}
} : "invalid_link_code" in a0 ? {
section: c7502_3.INVALID_CODE
} : "verified_teen_blocked" in a0 ? {
section: c7502_3.MUST_BE_ADULT
} : "requires_adult_verification" in a0 ? {
section: c7502_3.CONFIRM_AGE,
params: {
teenIdentity: a0.teen_identity
}
} : c7502_4;
};
c7502_3 = Object.freeze({
PREREQ_LOADING: "PREREQ_LOADING",
CONFIRM_AGE: "CONFIRM_AGE",
VERIFYING: "VERIFYING",
REQUEST: "REQUEST",
SENT: "SENT",
ERROR: "ERROR",
INVALID_CODE: "INVALID_CODE",
MUST_BE_ADULT: "MUST_BE_ADULT",
TEEN_SCAN: "TEEN_SCAN"
});
c7502_4 = {
section: c7502_3.ERROR,
params: {
failureCode: FamilyCenterFailureCode.GENERIC_ERROR
}
};
export { c7502_3 as FamilyCenterModalRequestSections };
export { getConnectionPrereqTarget };
export async function resolveConnectionPrereqTarget(c26944_0, c26944_1) {
let r54, connectionPrereqTarget2;
let getConnectionPrereqTarget2;
let c26944_4 = 0;
try {
c26944_4 = 1;
getConnectionPrereqTarget2 = getConnectionPrereqTarget;
connectionPrereqTarget2 = getConnectionPrereqTarget2(await FamilyCenterActionCreators.getConnectionPrerequisites(c26944_0, c26944_1));
c26944_4 = 0;
} catch ($e) {
let r23 = $e;
if (c26944_4 !== 0) {
while (true) {
try {
c26944_4 = 0;
r54 = c7502_4;
} catch ($e) {
r23 = $e;
if (c26944_4 === 0) {
break;
}
continue;
}
return r54;
}
}
throw r23;
}
return connectionPrereqTarget2;
}
+235
View File
@@ -0,0 +1,235 @@
// Metro module 1895 (f1896).
import Record from "../../lib/Record";
import { DayOfWeek } from "../../_bundle/Module1892";
import { $callWithNewTarget } from "../../_hermes/prelude";
let c1590_2 = Object.freeze({
0: DayOfWeek.SUNDAY,
1: DayOfWeek.MONDAY,
2: DayOfWeek.TUESDAY,
3: DayOfWeek.WEDNESDAY,
4: DayOfWeek.THURSDAY,
5: DayOfWeek.FRIDAY,
6: DayOfWeek.SATURDAY
});
const r50 = Object;
const r52 = {};
r52[DayOfWeek.DAY_OF_WEEK_UNSPECIFIED] = 0;
r52[DayOfWeek.MONDAY] = 1;
r52[DayOfWeek.TUESDAY] = 2;
r52[DayOfWeek.WEDNESDAY] = 3;
r52[DayOfWeek.THURSDAY] = 4;
r52[DayOfWeek.FRIDAY] = 5;
r52[DayOfWeek.SATURDAY] = 6;
r52[DayOfWeek.SUNDAY] = 0;
let c1590_3 = r50.freeze(r52);
class ScheduleRuleRecord extends Record {
constructor(a0) {
super();
this.ruleId = a0.ruleId;
this.label = a0.label;
this.startTime = a0.startTime;
this.endTime = a0.endTime;
this.days = a0.days;
this.enabled = a0.enabled;
}
static fromServer(a0) {
const { rule_id, label } = a0;
let start_time = a0.start_time;
if (start_time == null) {
start_time = void 0;
}
let end_time = a0.end_time;
if (end_time == null) {
end_time = void 0;
}
const { days, enabled } = a0;
const prototypeOf = Object.getPrototypeOf(ScheduleRuleRecord);
const r17 = Object.create(ScheduleRuleRecord.prototype);
const r18 = $callWithNewTarget(prototypeOf, r17, ScheduleRuleRecord);
const r19 = r18 instanceof Object ? r18 : r17;
r19.ruleId = rule_id;
r19.label = label;
r19.startTime = start_time;
r19.endTime = end_time;
r19.days = days;
r19.enabled = enabled;
return r19;
}
static fromCache(a0) {
const prototypeOf = Object.getPrototypeOf(ScheduleRuleRecord);
const r2 = Object.create(ScheduleRuleRecord.prototype);
const r10 = $callWithNewTarget(prototypeOf, r2, ScheduleRuleRecord);
const r11 = r10 instanceof Object ? r10 : r2;
r11.ruleId = a0.ruleId;
r11.label = a0.label;
r11.startTime = a0.startTime;
r11.endTime = a0.endTime;
r11.days = a0.days;
r11.enabled = a0.enabled;
return r11;
}
isActiveAt(a0, a1) {
if (this.startTime != null && this.endTime != null && this.days.length !== 0 && this.enabled) {
const startTime = this.startTime;
const r18 = 60 * startTime.hours + startTime.minutes;
const endTime = this.endTime;
const r22 = 60 * endTime.hours + endTime.minutes;
const r23 = r18 > r22;
if (this.days.includes(a0)) {
if (r23) {
if (a1 >= r18) {
return true;
}
} else if (a1 >= r18 && a1 < r22) {
return true;
}
}
if (r23 && this.days.includes(a0 === DayOfWeek.MONDAY ? DayOfWeek.SUNDAY : a0 - 1) && a1 < r22) {
return true;
}
return false;
}
return false;
}
getEndMinutes() {
const endTime = this.endTime;
let r2 = null;
if (endTime != null) {
const endTime2 = this.endTime;
r2 = 60 * endTime2.hours + endTime2.minutes;
}
return r2;
}
getStartMinutes() {
const startTime = this.startTime;
let r2 = null;
if (startTime != null) {
const startTime2 = this.startTime;
r2 = 60 * startTime2.hours + startTime2.minutes;
}
return r2;
}
}
class RestrictedScheduleRecord extends Record {
constructor(a0) {
super();
this.rules = a0.rules;
}
static fromServer(a0) {
let r1 = null;
if (a0 != null) {
const rules = a0.rules.map(ScheduleRuleRecord.fromServer);
const prototypeOf = Object.getPrototypeOf(RestrictedScheduleRecord);
const r16 = Object.create(RestrictedScheduleRecord.prototype);
const r17 = $callWithNewTarget(prototypeOf, r16, RestrictedScheduleRecord);
const r18 = r17 instanceof Object ? r17 : r16;
r18.rules = rules;
r1 = r18;
}
return r1;
}
static fromCache(a0) {
let r1 = null;
if (a0 != null) {
const rules = a0.rules.map(ScheduleRuleRecord.fromCache);
const prototypeOf = Object.getPrototypeOf(RestrictedScheduleRecord);
const r16 = Object.create(RestrictedScheduleRecord.prototype);
const r17 = $callWithNewTarget(prototypeOf, r16, RestrictedScheduleRecord);
const r18 = r17 instanceof Object ? r17 : r16;
r18.rules = rules;
r1 = r18;
}
return r1;
}
isInRestrictedHours(r5 = new Date()) {
if (this.rules.length === 0) {
return false;
}
let c13282_0 = c1590_2[r5.getDay()];
let c13282_1 = 60 * r5.getHours() + r5.getMinutes();
return this.rules.some((rule) => rule.isActiveAt(c13282_0, c13282_1));
}
getNextStartInfo(r4 = new Date()) {
if (this.rules.length !== 0 && !this.isInRestrictedHours(r4)) {
const day = r4.getDay();
const r6 = 60 * r4.getHours() + r4.getMinutes();
let r45 = null;
for (const item of this.rules.filter((rule) => rule.enabled)) {
const rule = item;
const startMinutes = item.getStartMinutes();
if (startMinutes != null && rule.days.length !== 0) {
for (const day2 of rule.days) {
const r73 = (c1590_3[day2] - day + 7) % 7;
const minutesUntil = 24 * ((r73 === 0 ? startMinutes <= r6 : r73 === 0) ? 7 : r73) * 60 - r6 + startMinutes;
if (r45 == null || minutesUntil < r45.minutesUntil) {
r45 = {
minutesUntil,
rule
};
}
}
}
}
return r45;
}
return null;
}
getNextEndTime(r14 = new Date()) {
if (this.rules.length === 0) {
return null;
}
let c13283_0 = c1590_2[r14.getDay()];
const r44 = 60 * r14.getHours() + r14.getMinutes();
let c13283_1 = r44;
for (const item of this.rules.filter((rule) => rule.isActiveAt(c13283_0, c13283_1))) {
const endMinutes = item.getEndMinutes();
const startMinutes = item.getStartMinutes();
if (endMinutes == null) {
continue;
}
if (startMinutes == null) {
continue;
}
let r60 = startMinutes > endMinutes;
const date = new Date(r14);
const r70 = Math.floor(endMinutes / 60);
const r71 = endMinutes % 60;
if (r60) {
r60 = r44 >= startMinutes;
}
if (r60) {
date.setDate(date.getDate() + 1);
}
date.setHours(r70, r71, 0, 0);
return date;
}
return null;
}
}
export { c1590_2 as JS_DAY_TO_DAY_OF_WEEK };
export { ScheduleRuleRecord };
export { RestrictedScheduleRecord };
export function ensureRestrictedScheduleRecord(a0) {
let r17;
let r2 = null;
if (a0 != null) {
const r11 = a0 instanceof RestrictedScheduleRecord;
let r3 = a0;
if (!r11) {
if (a0.rules.length === 0) {
const rules = [];
const prototypeOf = Object.getPrototypeOf(RestrictedScheduleRecord);
const r24 = Object.create(RestrictedScheduleRecord.prototype);
const r25 = $callWithNewTarget(prototypeOf, r24, RestrictedScheduleRecord);
const r26 = r25 instanceof Object ? r25 : r24;
r26.rules = rules;
r17 = r26;
} else {
r17 = "ruleId" in a0.rules[0] ? RestrictedScheduleRecord.fromCache(a0) : RestrictedScheduleRecord.fromServer(a0);
}
r3 = r17;
}
r2 = r3;
}
return r2;
}
@@ -0,0 +1,32 @@
// Metro module 4406 (f4407).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c2636_0 = null;
class FamilyCenterPendingConnectionStore extends Module589.PersistedStore {
static displayName = "FamilyCenterPendingConnectionStore";
static persistKey = "FamilyCenterPendingConnectionStore";
initialize(a0) {
c2636_0 = a0 == null ? null : a0;
}
getState() {
return c2636_0;
}
getPendingConnection() {
return c2636_0;
}
}
const familyCenterPendingConnectionStore = new FamilyCenterPendingConnectionStore(Dispatcher, {
FAMILY_CENTER_PENDING_CONNECTION_SET: function handleSet(a0) {
c2636_0 = {
teenId: a0.teenId,
linkCode: a0.linkCode
};
},
FAMILY_CENTER_PENDING_CONNECTION_CLEAR: function handleClear() {
c2636_0 = null;
},
LOGOUT: function handleLogout() {
c2636_0 = null;
}
});
export default familyCenterPendingConnectionStore;
@@ -0,0 +1,160 @@
// Metro module 10247 (f10248).
import { DayOfWeek } from "../../_bundle/Module1892";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
let c6836_3, c6836_4, c6836_5, c6836_6, formatDays, getScheduleRuleDateRange;
const setsEqual = function setsEqual(set, a1) {
if (set.size !== a1.size) {
return false;
}
for (const item of set) {
if (a1.has(item)) {
continue;
}
return false;
}
return true;
};
formatDays = function formatDays(days) {
const set = new Set(days);
let c17802_0 = set;
if (setsEqual(set, c6836_6)) {
return intl.string(FamilyCenter_messages.bPjqd1);
}
if (setsEqual(set, c6836_4)) {
return intl.string(FamilyCenter_messages["4dr9L9"]);
}
if (setsEqual(set, c6836_5)) {
return intl.string(FamilyCenter_messages["6lTTJ+"]);
}
let c17802_1 = new Intl.DateTimeFormat(intl.currentLocale, {
weekday: "short"
});
return c6836_3.map((item, index) => c17802_0.has(item) ? c17802_1.format(new Date(2025, 0, 5 + index)) : null).filter((item) => item !== null).join(", ");
};
getScheduleRuleDateRange = function getScheduleRuleDateRange(rule) {
const r4 = rule.startTime != null;
let r23 = "";
if (r4) {
const r24 = rule.endTime != null;
r23 = "";
if (r24) {
const startTime = rule.startTime;
const r39 = new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}).format(new Date(2025, 0, 1, startTime.hours, startTime.minutes));
const endTime = rule.endTime;
r23 = `${r39} – ${new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}).format(new Date(2025, 0, 1, endTime.hours, endTime.minutes))}`;
}
}
return r23;
};
c6836_3 = [DayOfWeek.SUNDAY, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY];
c6836_4 = new Set(c6836_3.slice(1, 6));
c6836_5 = new Set([c6836_3[0], c6836_3[6]]);
c6836_6 = new Set(c6836_3);
export { c6836_3 as DAYS_ORDERED };
export function getShortDayLabels(a0) {
let c17803_0 = new Intl.DateTimeFormat(intl.currentLocale, {
weekday: a0
});
return c6836_3.map((item, index) => c17803_0.format(new Date(2025, 0, 5 + index)));
}
export function formatTime(a0) {
return new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}).format(new Date(2025, 0, 1, a0.hours, a0.minutes));
}
export { formatDays };
export function timeToMinutes(a0) {
return 60 * a0.hours + a0.minutes;
}
export function formatDuration(a0) {
const hours = a0 / 60;
return Number.isInteger(hours) ? intl.formatToPlainString(FamilyCenter_messages.hFDcmZ, {
hours
}) : intl.formatToPlainString(FamilyCenter_messages.wcrXLM, {
hours: Math.floor(hours)
});
}
export { getScheduleRuleDateRange };
export function formatRestrictedScheduleInAppSubtitle(a0) {
if (a0.startTime != null && a0.endTime != null) {
const days = formatDays(a0.days);
const startTime = a0.startTime;
const startTime3 = new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}).format(new Date(2025, 0, 1, startTime.hours, startTime.minutes));
const endTime = a0.endTime;
const endTime3 = new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit"
}).format(new Date(2025, 0, 1, endTime.hours, endTime.minutes));
const startTime2 = a0.startTime;
const r66 = 60 * startTime2.hours + startTime2.minutes;
const endTime2 = a0.endTime;
return intl.formatToPlainString(r66 > 60 * endTime2.hours + endTime2.minutes ? FamilyCenter_messages.OxveI8 : FamilyCenter_messages["ERTn+E"], {
days,
startTime: startTime3,
endTime: endTime3
});
}
return null;
}
export function sortRulesByStartTime(a0) {
return a0.slice().sort((a, b) => {
let r7 = a.startTime?.hours;
if (r7 == null) {
r7 = 0;
}
const r1 = 60 * r7;
let r12 = a.startTime?.minutes;
if (r12 == null) {
r12 = 0;
}
const r14 = r1 + r12;
let r16 = b.startTime?.hours;
if (r16 == null) {
r16 = 0;
}
const r17 = 60 * r16;
let r5 = b.startTime?.minutes;
if (r5 == null) {
r5 = 0;
}
return r14 - (r17 + r5);
});
}
export function toTimeProto(a0) {
return {
hours: a0.hours,
minutes: a0.minutes,
seconds: 0,
nanos: 0
};
}
export function computeOverlappingInfo(c17804_0, c17804_1, c17804_2) {
const conflictingEntries = [];
let c17804_3 = conflictingEntries;
c6836_3.forEach((item, index) => {
let c26639_0 = item;
if (c17804_0.has(item)) {
const r11 = c17804_1.find((item) => item.days.includes(c26639_0));
if (r11 != null) {
c17804_3.push({
dayLabel: c17804_2[index],
timeRange: getScheduleRuleDateRange(r11)
});
}
}
});
return {
conflictingEntries
};
}
+595
View File
@@ -0,0 +1,595 @@
// 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;
+137
View File
@@ -0,0 +1,137 @@
// Metro module 5855 (f5856).
import FamilyCenterStore from "./FamilyCenterStore";
import { ACTION_TO_TEXT, FAMILY_CENTER_ERROR_CODE_TO_FAILURE, FamilyCenterFailureCode, TeenActionDisplayType, UserLinkStatus, UserLinkType } from "./FamilyCenterConstants";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
import Module3771 from "../../_bundle/Module3771";
import FamilyCenterActionCreators from "./FamilyCenterActionCreators";
let $mk77226 = function() {
return (a0) => a0.link_status === UserLinkStatus.ACTIVE && a0.link_type === UserLinkType.PARENT;
};
let c3662_10 = 86400;
let c3662_11 = 172800;
export function getEmptyActivityFormatter() {
return {
today: intl.string(FamilyCenter_messages.VjIAQQ),
yesterday: intl.string(FamilyCenter_messages["2a8xHY"]),
days: FamilyCenter_messages.Xt6oND
};
}
export function getActivityWindowTimestampFormatter(a0) {
let r26;
const r2 = {
today: null,
yesterday: null,
days: null
};
if (a0) {
r2.today = intl.string(FamilyCenter_messages["2AtcIs"]);
r2.yesterday = intl.string(FamilyCenter_messages.stOECr);
r2.days = FamilyCenter_messages.n8n5Ba;
r26 = r2;
} else {
r2.today = intl.string(FamilyCenter_messages.g1ZX6m);
r2.yesterday = intl.string(FamilyCenter_messages.s3qSVt);
r2.days = FamilyCenter_messages.f1UJiC;
r26 = r2;
}
return r26;
}
export function formatUserActivityTimestamp(a0, a1, a2) {
let today;
const r13 = Module3771().diff(Module3771(a0), "s");
const r19 = a1();
Module3771(a0).format("LL");
if (r13 < c3662_10) {
today = r19.today;
} else if (r13 < c3662_11) {
today = r19.yesterday;
} else {
let r12 = a2;
const days = r19.days;
const r33 = Math;
const r37 = Math.floor(r13 / c3662_10);
if (a2 == null) {
r12 = 999;
}
today = intl.formatToPlainString(days, {
days: r33.min(r37, r12)
});
}
return today;
}
export function formatLinkTimestamp(a0, a1) {
const r14 = Module3771().diff(Module3771(a0), "s");
const r22 = a1();
const date = Module3771(a0).format("LL");
return r14 < 60 ? r22.seconds : r14 < 3600 ? intl.formatToPlainString(r22.minutes, {
count: Math.floor(r14 / 60)
}) : r14 < c3662_10 ? intl.formatToPlainString(r22.hours, {
count: Math.floor(r14 / 3600)
}) : r14 < c3662_11 ? r22.yesterday : r14 < 604800 ? intl.formatToPlainString(r22.days, {
count: Math.floor(r14 / c3662_10)
}) : intl.formatToPlainString(r22.date, {
date
});
}
export function isUserAction(a0) {
return a0.display_type === TeenActionDisplayType.USER_ADD || a0.display_type === TeenActionDisplayType.USER_INTERACTION || a0.display_type === TeenActionDisplayType.USER_CALLED;
}
export function isGuildAction(a0) {
return a0.display_type === TeenActionDisplayType.GUILD_ADD || a0.display_type === TeenActionDisplayType.GUILD_INTERACTION;
}
export function isPurchase(a0) {
return a0.display_type === TeenActionDisplayType.PURCHASES;
}
export function isGift(a0) {
return a0.display_type === TeenActionDisplayType.GIFTS;
}
export function displayTypeFromString(a0) {
for (const item of Object.values(TeenActionDisplayType)) {
if (item.toString() !== a0) {
continue;
}
return item;
}
}
export function getFailureCodeForAPIError(a0) {
let r5 = FAMILY_CENTER_ERROR_CODE_TO_FAILURE[a0.code];
if (r5 == null) {
r5 = FamilyCenterFailureCode.GENERIC_ERROR;
}
return r5;
}
export function getSortedActivityTypeConfigs() {
const map = new Map(ACTION_TO_TEXT);
return map.size === 0 ? [] : Array.from(map.entries()).sort((a, b) => a[1].priority - b[1].priority);
}
export function getActivityTypeTextConfigs() {
return new Map(ACTION_TO_TEXT);
}
export function formatTotalTime(a0) {
const r7 = Math.floor(a0 / 60);
const r13 = a0 % 60;
return r7 > 0 ? `${r7}h ${r13}m` : `${r13}m`;
}
export function getOrFetchLinkedUsers() {
if (FamilyCenterStore.getAreLinkedUsersProcessed()) {
return FamilyCenterStore.getLinkedUsers();
}
FamilyCenterActionCreators.fetchLinkedUsers();
}
export function hasActiveParentLinks() {
return Object.values(FamilyCenterStore.getLinkedUsers()).some($mk77226());
}
export function isParentallyControlled() {
return Object.values(FamilyCenterStore.getLinkedUsers()).some($mk77226());
}
export function getTopUserOrGuildDescription(a0, a1) {
return a1 > 0 && a0 === 0 ? intl.formatToPlainString(FamilyCenter_messages["L/Cj7S"], {
callCount: a1
}) : a0 > 0 && a1 === 0 ? intl.formatToPlainString(FamilyCenter_messages["6X1F0i"], {
messageCount: a0
}) : intl.formatToPlainString(FamilyCenter_messages.IYqGMG, {
messageCount: a0,
callCount: a1
});
}
@@ -0,0 +1,28 @@
// Metro module 5856 (f5857).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-01-family-center-v3",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export default apexExperiment;
export function getIsFamilyCenterV3Enabled(a0) {
return apexExperiment.getConfig({
location: a0.location
}).enabled;
}
export function useIsFamilyCenterV3Enabled(a0) {
return apexExperiment.useConfig({
location: a0.location
}).enabled;
}
@@ -0,0 +1,39 @@
// Metro module 14872 (f14873).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c10511_1;
let shouldShowGuardianConnect = false;
class ParentalConsentStore extends Module589.PersistedStore {
static displayName = "ParentalConsentStore";
static persistKey = "ParentalConsentStore";
initialize(a0) {
let r4 = a0?.shouldShowGuardianConnect;
if (r4 == null) {
r4 = false;
}
shouldShowGuardianConnect = r4;
}
getShouldShowGuardianConnect() {
return shouldShowGuardianConnect;
}
getState() {
return {
shouldShowGuardianConnect
};
}
}
c10511_1 = new ParentalConsentStore(Dispatcher, {
GUARDIAN_CONNECT_REQUIRED: function handleGuardianConnectRequired(a0) {
shouldShowGuardianConnect = a0.shouldShowGuardianConnect === true;
c10511_1.persist();
},
GUARDIAN_CONNECT_CLEARED: function handleGuardianConnectCleared() {
shouldShowGuardianConnect = false;
c10511_1.persist();
},
NUF_COMPLETE: function handleNUFCompleted() {
shouldShowGuardianConnect = false;
c10511_1.persist();
}
});
export default c10511_1;
@@ -0,0 +1,194 @@
// Metro module 16297 (f16298).
import ParentalConsentWarningStore from "./ParentalConsentWarningStore";
import { Logger } from "../../_bundle/log";
import Backoff from "../../_bundle/Backoff";
import Durations from "../../utils/Durations";
import { isParentalConsentWarningFetchEnabled } from "./ParentalConsentWarningFetchExperiment";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
import SentryUtils_native from "../../utils/SentryUtils.native";
function $mk117263($env) {
return function scheduleRetry() {
const r2 = $env;
if (r2[8] == null) {
const r4 = setTimeout;
const r7 = c11716_6.fail();
r2[8] = r4($mk118544(r2), r7);
}
};
}
function $mk118544($env) {
return () => {
$env[8] = null;
(0, maybeFetchWarning)();
};
}
let fetchWarning, maybeFetchWarning, c11716_5, c11716_6;
let env11716 = {};
const clearPendingRetry = function clearPendingRetry() {
if (env11716[8] != null) {
clearTimeout(env11716[8]);
env11716[8] = null;
}
};
fetchWarning = function fetchWarning() {
if (isParentalConsentWarningFetchEnabled("parental_consent_warning_manager")) {
if (env11716[7] != null) {
return env11716[7];
}
let c22954_0 = env11716[9];
const r20 = (async () => {
let c28331_0, c28331_1, c28331_2;
let c28331_3 = 0;
const r13 = void 0;
const r12 = env11716;
L17: {
L14: {
try {
let env31026;
c28331_1 = r13;
const r32 = env31026 = {
$parent: r12
};
c28331_0 = r32;
env31026[0] = void 0;
env31026[1] = void 0;
c28331_3 = 2;
env31026[0] = await HTTP.get({
url: "/users/@me/parental-consent/warning",
rejectWithError: true
});
if (c22954_0 !== env11716[9]) {
c28331_3 = 0;
if (c22954_0 !== env11716[9]) {
break L17;
}
env11716[7] = null;
break L17;
}
env31026[1] = (function normalizeWarning(a0) {
return {
inGrace: a0.in_grace === true,
daysRemaining: typeof a0.days_remaining === "number" ? a0.days_remaining : null,
surfaces: Array.isArray(a0.surfaces) ? a0.surfaces : []
};
})(env31026[0].body);
c11716_6.succeed();
(0, clearPendingRetry)();
Dispatcher.dispatch({
type: "PARENTAL_CONSENT_WARNING_FETCH_SUCCESS",
warning: env31026[1]
});
c28331_3 = 1;
c28331_3 = 0;
if (c22954_0 === env11716[9]) {
env11716[7] = null;
}
} catch ($e) {
const r30 = $e;
let r7 = r30;
c28331_2 = r30;
let r31 = c28331_3;
if (r31 !== 0) {
while (true) {
if (r31 !== 1) {
try {
const r90 = c28331_2;
c28331_3 = 1;
env31026[2] = r90;
if (c22954_0 === env11716[9]) {
c11716_5.error("Failed to fetch parental-consent warning", env31026[2]);
SentryUtils_native.captureException(env31026[2], {
tags: {
source: "parental_consent_warning",
step: "fetch_warning"
}
});
$mk117263(env11716)();
c28331_3 = 0;
if (c22954_0 !== env11716[9]) {
break L14;
}
env11716[7] = null;
break L14;
}
c28331_3 = 0;
if (c22954_0 === env11716[9]) {
env11716[7] = null;
}
} catch (r87) {
r7 = r87;
c28331_2 = r87;
r31 = c28331_3;
if (r31 === 0) {
break;
}
continue;
}
return void 0;
}
try {
const r121 = c28331_2;
c28331_3 = 0;
if (c22954_0 === env11716[9]) {
env11716[7] = null;
}
throw r121;
} catch (r119) {
r7 = r119;
c28331_2 = r119;
r31 = c28331_3;
if (r31 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
})();
env11716[7] = r20;
return r20;
}
return Promise.resolve();
};
maybeFetchWarning = async function maybeFetchWarning() {
L15: {
if (env11716[7] == null && env11716[8] == null && ParentalConsentWarningStore.shouldFetchToday()) {
await fetchWarning();
break L15;
}
return void 0;
}
};
c11716_5 = new Logger("ParentalConsentWarning");
c11716_6 = new Backoff(5 * Durations.Millis.SECOND, 5 * Durations.Millis.MINUTE, true);
env11716[7] = null;
env11716[8] = null;
env11716[9] = 0;
export { maybeFetchWarning };
export async function forceFetchWarning() {
clearPendingRetry();
if (env11716[7] != null) {
env11716[9] = env11716[9] + 1;
env11716[7] = null;
}
await fetchWarning();
}
export function resetFetchState() {
env11716[9] = env11716[9] + 1;
if (env11716[8] != null) {
clearTimeout(env11716[8]);
env11716[8] = null;
}
env11716[7] = null;
c11716_6.succeed();
}
export function clearWarning() {
Dispatcher.dispatch({
type: "PARENTAL_CONSENT_WARNING_CLEARED"
});
}
@@ -0,0 +1,19 @@
// Metro module 16298 (f16299).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-07-parental-consent-warning-fetch",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export function isParentalConsentWarningFetchEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).enabled;
}
@@ -0,0 +1,101 @@
// Metro module 13898 (f13899).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c9695_3;
const time = null;
const time2 = null;
let warning = null;
class ParentalConsentWarningStore extends Module589.PersistedStore {
static displayName = "ParentalConsentWarningStore";
static persistKey = "ParentalConsentWarningStore";
static migrations = [(a0) => {
let lastWarningFetchDayStart = a0?.lastWarningFetchDayStart;
if (lastWarningFetchDayStart == null) {
lastWarningFetchDayStart = null;
}
let lastModalShownDayStart = a0?.lastModalShownDayStart;
if (lastModalShownDayStart == null) {
lastModalShownDayStart = null;
}
let warning2 = a0?.warning;
if (warning2 == null) {
warning2 = null;
}
return {
lastWarningFetchDayStart,
lastModalShownDayStart,
warning: warning2
};
}];
initialize(a0) {
let r3 = a0?.lastWarningFetchDayStart;
if (r3 == null) {
r3 = null;
}
time = r3;
let r7 = a0?.lastModalShownDayStart;
if (r7 == null) {
r7 = null;
}
time2 = r7;
let r9 = a0?.warning;
if (r9 == null) {
r9 = null;
}
warning = r9;
}
getWarning() {
return warning;
}
shouldFetchToday() {
let r11 = time == null;
if (!r11) {
const date = new Date();
date.setHours(0, 0, 0, 0);
r11 = time !== date.getTime();
}
return r11;
}
hasShownModalToday() {
let r11 = time2 != null;
if (r11) {
const date = new Date();
date.setHours(0, 0, 0, 0);
r11 = time2 === date.getTime();
}
return r11;
}
getState() {
return {
lastWarningFetchDayStart: time,
lastModalShownDayStart: time2,
warning
};
}
}
c9695_3 = new ParentalConsentWarningStore(Dispatcher, {
PARENTAL_CONSENT_WARNING_FETCH_SUCCESS: function handleFetchSuccess(a0) {
warning = a0.warning;
const date = new Date();
date.setHours(0, 0, 0, 0);
time = date.getTime();
c9695_3.persist();
},
PARENTAL_CONSENT_WARNING_MODAL_SHOWN: function handleModalShown() {
const date = new Date();
date.setHours(0, 0, 0, 0);
time2 = date.getTime();
c9695_3.persist();
},
PARENTAL_CONSENT_WARNING_CLEARED: function handleWarningCleared() {
warning = null;
c9695_3.persist();
},
LOGOUT: function handleLogout() {
time = null;
time2 = null;
warning = null;
c9695_3.persist();
}
});
export default c9695_3;
@@ -0,0 +1,6 @@
// Metro module 13899 (f13900).
const r11 = Object.freeze({
BANNER: "banner",
MODAL: "modal"
});
export { r11 as ParentalConsentWarningSurface };
@@ -0,0 +1,16 @@
// Metro module 16112 (f16113).
import ModalActionCreators from "../../actions/ModalActionCreators";
let c11537_4;
const closeRestrictedHoursModal = function closeRestrictedHoursModal() {
ModalActionCreators.popWithKey(c11537_4);
};
c11537_4 = "RESTRICTED_HOURS_MODAL_KEY";
export function openRestrictedHoursModal() {
ModalActionCreators.pushLazy(async () => (await import("./native/RestrictedHoursModal")).default, {
onClose: closeRestrictedHoursModal
}, c11537_4, {
animation: "none",
presentation: "fullScreenModal"
});
}
export { closeRestrictedHoursModal };
@@ -0,0 +1,154 @@
// Metro module 16117 (f16118).
import NotificationSettingsStore from "../../stores/NotificationSettingsStore";
import UserStore from "../../stores/UserStore";
import FamilyCenterStore from "./FamilyCenterStore";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
import { JS_DAY_TO_DAY_OF_WEEK } from "./FamilyCenterModels";
import { formatDays, getScheduleRuleDateRange } from "./FamilyCenterRestrictedHoursUtils";
import Dispatcher from "../../Dispatcher";
import { getIsFamilyCenterV3Enabled } from "./FamilyCenterV3Experiment";
import { openRestrictedHoursModal, closeRestrictedHoursModal } from "./RestrictedHoursActionCreators.native";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
let isCurrentUserInRestrictedHours, c11541_7, c11541_8, c11541_9, checkAndUpdateModal, handleLogout, handleScheduleUpdate, handleScreenDowntimeReminderChanged;
const scheduleUpcomingWarning = function scheduleUpcomingWarning() {
if (c11541_8 != null) {
clearTimeout(c11541_8);
c11541_8 = null;
}
const date = new Date();
const isFamilyCenterV3Enabled = getIsFamilyCenterV3Enabled({
location: "RestrictedHoursManager"
});
let r33 = null;
if (isFamilyCenterV3Enabled) {
r33 = null;
if (NotificationSettingsStore.screenDowntimeReminder) {
const restrictedSchedule = UserStore.getCurrentUser()?.restrictedSchedule;
const r40 = restrictedSchedule == null;
r33 = null;
if (!r40) {
const nextStartInfo = restrictedSchedule.getNextStartInfo(date);
r33 = nextStartInfo == null ? null : {
minutesUntil: nextStartInfo.minutesUntil,
startAtMs: new Date(date).setSeconds(0, 0) + 60 * nextStartInfo.minutesUntil * 1000,
rule: nextStartInfo.rule
};
}
}
}
if (r33 != null) {
if (r33.minutesUntil <= 16) {
const r79 = `${r33.rule.ruleId}:${r33.startAtMs}`;
if (r79 !== c11541_9) {
const { rule, startAtMs } = r33;
Dispatcher.dispatch({
type: "RESTRICTED_HOURS_WARNING",
title: intl.string(FamilyCenter_messages["0JlDg0"]),
subtitle: `${formatDays([JS_DAY_TO_DAY_OF_WEEK[new Date(startAtMs).getDay()]])} ${getScheduleRuleDateRange(rule)}`.trim()
});
c11541_9 = r79;
}
c11541_8 = setTimeout(() => {
c11541_8 = null;
scheduleUpcomingWarning();
}, 60000);
} else {
c11541_8 = setTimeout(() => {
c11541_8 = null;
scheduleUpcomingWarning();
}, Math.max(0, 60 * (r33.minutesUntil - 16) * 1000));
}
}
};
checkAndUpdateModal = function checkAndUpdateModal() {
const isCurrentUserInRestrictedHours2 = FamilyCenterStore.isCurrentUserInRestrictedHours();
if (isCurrentUserInRestrictedHours2 !== isCurrentUserInRestrictedHours) {
isCurrentUserInRestrictedHours = isCurrentUserInRestrictedHours2;
Dispatcher.dispatch({
type: "RESTRICTED_HOURS_STATE_CHANGE",
isInRestrictedHours: isCurrentUserInRestrictedHours
});
if (isCurrentUserInRestrictedHours) {
openRestrictedHoursModal();
} else {
closeRestrictedHoursModal();
}
scheduleUpcomingWarning();
}
};
handleLogout = function handleLogout() {
isCurrentUserInRestrictedHours = false;
c11541_9 = null;
Dispatcher.dispatch({
type: "RESTRICTED_HOURS_STATE_CHANGE",
isInRestrictedHours: false
});
if (c11541_8 != null) {
clearTimeout(c11541_8);
c11541_8 = null;
}
};
handleScheduleUpdate = function handleScheduleUpdate() {
const isCurrentUserInRestrictedHours2 = FamilyCenterStore.isCurrentUserInRestrictedHours();
if (isCurrentUserInRestrictedHours2 !== isCurrentUserInRestrictedHours) {
isCurrentUserInRestrictedHours = isCurrentUserInRestrictedHours2;
Dispatcher.dispatch({
type: "RESTRICTED_HOURS_STATE_CHANGE",
isInRestrictedHours: isCurrentUserInRestrictedHours
});
if (isCurrentUserInRestrictedHours) {
openRestrictedHoursModal();
} else {
closeRestrictedHoursModal();
}
scheduleUpcomingWarning();
}
scheduleUpcomingWarning();
};
handleScreenDowntimeReminderChanged = function handleScreenDowntimeReminderChanged() {
scheduleUpcomingWarning();
};
isCurrentUserInRestrictedHours = false;
c11541_7 = null;
c11541_8 = null;
c11541_9 = null;
class RestrictedHoursManager extends AutomaticLifecycleManager {
stores = new Map().set(UserStore, handleScheduleUpdate).set(FamilyCenterStore, handleScheduleUpdate);
actions = {
POST_CONNECTION_OPEN: handleScheduleUpdate,
CURRENT_USER_UPDATE: handleScheduleUpdate,
NOTIFICATIONS_SET_SCREEN_DOWNTIME_REMINDER: handleScreenDowntimeReminderChanged,
LOGOUT: handleLogout
};
_initialize() {
isCurrentUserInRestrictedHours = FamilyCenterStore.isCurrentUserInRestrictedHours();
Dispatcher.dispatch({
type: "RESTRICTED_HOURS_STATE_CHANGE",
isInRestrictedHours: isCurrentUserInRestrictedHours
});
if (isCurrentUserInRestrictedHours) {
openRestrictedHoursModal();
}
c11541_7 = setInterval(checkAndUpdateModal, 60000);
scheduleUpcomingWarning();
}
_terminate() {
if (c11541_7 != null) {
clearInterval(c11541_7);
c11541_7 = null;
}
if (c11541_8 != null) {
clearTimeout(c11541_8);
c11541_8 = null;
}
c11541_9 = null;
closeRestrictedHoursModal();
isCurrentUserInRestrictedHours = false;
}
}
const restrictedHoursManager = new RestrictedHoursManager();
export default restrictedHoursManager;
export function getCurrentRestrictedHoursState() {
return FamilyCenterStore.isCurrentUserInRestrictedHours();
}
@@ -0,0 +1,50 @@
// Metro module 13967 (f13968).
import { Endpoints } from "../../Constants";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
export async function addRestrictedScheduleRule(c27600_0, body) {
let c27600_3;
c27600_3 = void 0;
let c30681_0 = c27600_0;
let c30681_1 = (await HTTP.post({
url: Endpoints.FAMILY_CENTER_RESTRICTED_SCHEDULE_RULE(c27600_0),
body,
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "USER_RESTRICTED_SCHEDULE_UPDATE",
userId: c30681_0,
restrictedSchedule: c30681_1
});
return c30681_1;
}
export async function updateRestrictedScheduleRule(c27601_0, c27601_1, body2) {
let c27601_4;
c27601_4 = void 0;
let c30682_0 = c27601_0;
let c30682_1 = (await HTTP.patch({
url: Endpoints.FAMILY_CENTER_RESTRICTED_SCHEDULE_RULES(c27601_0, c27601_1),
body: body2,
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "USER_RESTRICTED_SCHEDULE_UPDATE",
userId: c30682_0,
restrictedSchedule: c30682_1
});
return c30682_1;
}
export async function deleteRestrictedScheduleRule(c27602_0, c27602_1) {
let c27602_3;
c27602_3 = void 0;
let c30683_0 = c27602_0;
let c30683_1 = (await HTTP.del({
url: Endpoints.FAMILY_CENTER_RESTRICTED_SCHEDULE_RULES(c27602_0, c27602_1),
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "USER_RESTRICTED_SCHEDULE_UPDATE",
userId: c30683_0,
restrictedSchedule: c30683_1
});
}
@@ -0,0 +1,183 @@
// Metro module 10246 (f10247).
import Module12 from "../../_bundle/Module12";
import FamilyCenter_messages from "./FamilyCenter.messages";
import { intl } from "../../intl/index.native";
import { formatRestrictedScheduleInAppSubtitle } from "./FamilyCenterRestrictedHoursUtils";
function $mk84248($env) {
return (a0) => $env[0].has(a0);
}
let c6835_3, c6835_4, c6835_6;
const isOnlyDayLoss = function isOnlyDayLoss(oldRule, newRule) {
if (oldRule.label !== newRule.label) {
return false;
}
if (Module12.isEqual(oldRule.startTime, newRule.startTime)) {
if (Module12.isEqual(oldRule.endTime, newRule.endTime)) {
let env17800;
const r25 = env17800 = {};
env17800[0] = new Set(oldRule.days);
return newRule.days.length < oldRule.days.length && newRule.days.every($mk84248(r25));
}
return false;
}
return false;
};
c6835_3 = {
Created: "created",
Enabled: "enabled",
Disabled: "disabled",
Updated: "updated",
Removed: "removed",
Multiple: "multiple"
};
c6835_4 = new Map();
const r28 = {};
r28[c6835_3.Created] = FamilyCenter_messages["5V7eBH"];
r28[c6835_3.Enabled] = FamilyCenter_messages.iefrVg;
r28[c6835_3.Disabled] = FamilyCenter_messages["k+s9cM"];
r28[c6835_3.Updated] = FamilyCenter_messages.Nm6hZV;
r28[c6835_3.Multiple] = FamilyCenter_messages.Nm6hZV;
r28[c6835_3.Removed] = FamilyCenter_messages.jR6uOs;
c6835_6 = r28;
export { c6835_3 as RestrictedScheduleNotificationKind };
export { c6835_4 as EMPTY_SCHEDULE_SNAPSHOT };
export function toScheduleSnapshot(a0) {
return a0 != null && a0.rules.length !== 0 ? new Map(a0.rules.map((rule) => [rule.ruleId, rule])) : c6835_4;
}
export function diffSchedules(a0, a1) {
let kind, rule, rule2, rule3, c17801_4, c17801_5, c17801_6, c17801_7, c17801_8;
const record = function record(a0, a1) {
const r0 = c17801_4;
if (r0 === 0) {
kind = a0;
rule = a1;
}
c17801_4 = r0 + 1;
if (a0 === c6835_3.Removed) {
c17801_5 = c17801_5 + 1;
} else if (a0 === c6835_3.Created) {
rule2 = a1;
c17801_6 = c17801_6 + 1;
} else if (a0 === c6835_3.Updated) {
rule3 = a1;
c17801_7 = c17801_7 + 1;
} else if ([c6835_3.Enabled, c6835_3.Disabled].includes(a0)) {
c17801_8 = c17801_8 + 1;
}
};
kind = null;
rule = null;
rule2 = null;
rule3 = null;
c17801_4 = 0;
c17801_5 = 0;
c17801_6 = 0;
c17801_7 = 0;
c17801_8 = 0;
const r1 = [];
const r5 = Set;
const r36 = [...a0.keys(), ...a1.keys()];
for (const item of new r5(r36)) {
const oldRule = a0.get(item);
const r52 = a1.get(item);
if (r52 == null) {
if (oldRule?.enabled) {
record(c6835_3.Removed, oldRule);
}
} else if (oldRule == null) {
if (r52.enabled) {
record(c6835_3.Created, r52);
}
} else if (oldRule.enabled !== r52.enabled) {
record(r52.enabled ? c6835_3.Enabled : c6835_3.Disabled, r52.enabled ? r52 : oldRule);
} else {
const enabled = r52.enabled;
let r61 = !enabled;
if (enabled) {
r61 = oldRule.label === r52.label && Module12.isEqual(oldRule.startTime, r52.startTime) && Module12.isEqual(oldRule.endTime, r52.endTime) && Module12.isEqual([...oldRule.days].sort(), [...r52.days].sort());
}
if (!r61) {
const Updated = c6835_3.Updated;
record(Updated, r52);
r1.push({
oldRule,
newRule: r52
});
}
}
}
if (c17801_4 === 0) {
return null;
}
const r135 = r1.every(({ oldRule, newRule }) => {
let env26638;
const r4 = env26638 = {};
env26638[0] = void 0;
const label2 = oldRule.label;
const label = newRule.label;
let r15 = false;
if (label2 === label) {
const isEqual = Module12.isEqual(oldRule.startTime, newRule.startTime);
r15 = false;
if (isEqual) {
const isEqual2 = Module12.isEqual(oldRule.endTime, newRule.endTime);
r15 = false;
if (isEqual2) {
env26638[0] = new Set(oldRule.days);
r15 = newRule.days.length < oldRule.days.length && newRule.days.every($mk84248(r4));
}
}
}
return r15;
});
const r136 = c17801_6;
if (r136 === 1 && c17801_8 === 0 && r135) {
return {
kind: c6835_3.Created,
rule: rule2
};
}
const r139 = c17801_7;
if (r139 === 1 && r136 === 0 && 1 <= c17801_5 && c17801_8 === 0) {
return {
kind: c6835_3.Updated,
rule: rule3
};
}
if (r139 === 2 && r136 === 0 && c17801_5 === 0 && c17801_8 === 0) {
const r145 = r1[0];
const r146 = r1[1];
if (isOnlyDayLoss(r145.oldRule, r145.newRule)) {
return {
kind: c6835_3.Updated,
rule: r146.newRule
};
}
if (isOnlyDayLoss(r146.oldRule, r146.newRule)) {
return {
kind: c6835_3.Updated,
rule: r145.newRule
};
}
}
return 1 < c17801_4 ? {
kind: c6835_3.Multiple,
rule: null
} : {
kind,
rule
};
}
export function getRestrictedScheduleNotificationTitle(a0) {
return intl.string(c6835_6[a0]);
}
export function getRestrictedScheduleNotificationSubtitle(a0) {
let r2 = a0 != null ? formatRestrictedScheduleInAppSubtitle(a0) : null;
if (r2 == null) {
r2 = intl.string(FamilyCenter_messages["8OlpoY"]);
}
return r2;
}
export function restrictedScheduleNotificationKey(a0) {
return `restricted-schedule-${a0}`;
}
@@ -0,0 +1,64 @@
// Metro module 13940 (f13941).
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import FamilyCenterStore from "./FamilyCenterStore";
import { SubscriptionIntervalTypes } from "../premium/PremiumConstants";
import { useStateFromStores } from "../../_bundle/Module589";
import { spendingLimitEqual } from "./SpendingLimitUtils";
import { formatRate, formatPrice } from "../../utils/PriceUtils";
import { CurrencyExponents } from "../../_bundle/convertToMajorCurrencyUnits";
import { intl } from "../../intl/index.native";
import FamilyCenter_messages from "./FamilyCenter.messages";
const getSpendingLimitDisplayState = function getSpendingLimitDisplayState(a0, a1) {
if (a0 == null) {
return {
kind: "off"
};
}
if (a0.amount === 0) {
return {
kind: "blocked"
};
}
const currency = a0.currency;
const monthlyText = formatRate(formatPrice(a0.amount, currency), SubscriptionIntervalTypes.MONTH, 1);
if (a1 >= a0.amount) {
return {
kind: "spent",
monthlyText
};
}
let r31 = CurrencyExponents[a0.currency];
if (r31 == null) {
r31 = 2;
}
const r33 = a0.amount - a1;
return r33 <= 10 * 10 ** r31 ? {
kind: "close-to-limit",
monthlyText,
remainingText: intl.formatToPlainString(FamilyCenter_messages["+Q+bU1"], {
amount: formatPrice(r33, currency)
})
} : {
kind: "on",
monthlyText
};
};
export function useSpendingLimitFromUserSettings() {
return useStateFromStores([UserSettingsProtoStore], () => {
const safetySettings = UserSettingsProtoStore.settings.safetySettings;
const r4 = safetySettings == null ? void 0 : safetySettings.spendingLimitSettings?.oneTimePurchaseLimit;
return r4 == null ? null : {
amount: Number(r4.amount),
currency: r4.currency
};
}, void 0, spendingLimitEqual);
}
export const CLOSE_TO_LIMIT_THRESHOLD_MAJOR_UNITS = 10;
export { getSpendingLimitDisplayState };
export function useSpendingLimitDisplayState(a0) {
let r15 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getMonthlyPurchases())?.total_amount;
if (r15 == null) {
r15 = 0;
}
return getSpendingLimitDisplayState(a0, r15);
}
@@ -0,0 +1,44 @@
// Metro module 13858 (f13859).
export function spendingLimitEqual(a0, a1) {
return a0 == null && a1 == null || a0 != null && a1 != null && (a0.amount === a1.amount && a0.currency === a1.currency);
}
export function getNextRenewalDateLabel() {
const date = new Date();
const date2 = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1));
return new Intl.DateTimeFormat(void 0, {
dateStyle: "short",
timeZone: "UTC"
}).format(date2);
}
export function getCurrencySymbol(a0) {
let r11;
try {
const NumberFormat = Intl.NumberFormat;
const r2 = {
style: "currency",
currency: a0.toUpperCase()
};
r11 = void 0;
const r19 = new NumberFormat(void 0, r2).formatToParts(0).find((item) => item.type === "currency");
if (r19 != null) {
r11 = r19.value;
}
if (r11 == null) {
r11 = a0.toUpperCase();
}
} catch ($e) {
return a0.toUpperCase();
}
return r11;
}
export function sanitizeAmountInput(a0, a1) {
if (a1 === 0) {
return a0.replace(/[^0-9]/g, "");
}
let r10 = a0.replace(/[^0-9.]/g, "");
const r4 = r10.split(".");
if (r4.length !== 1) {
r10 = `${r4[0]}.${r4.slice(1).join("").slice(0, a1)}`;
}
return r10;
}
@@ -0,0 +1,5 @@
// Metro module 11113 (f11114).
import useIsInAdultAgeGroup from "./useIsInAdultAgeGroup";
export function useAgeSpecificText(a0, a1) {
return useIsInAdultAgeGroup() ? a1 : a0;
}
@@ -0,0 +1,56 @@
// Metro module 16280 (f16281).
import { useState, useRef, useCallback } from "react";
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStoresObject } from "../../../_bundle/Module589";
import { getLinkCodeForCurrentUser } from "../FamilyCenterActionCreators";
import useMountEffect from "../../../hooks/useMountEffect";
export function useConnectGuardianGate() {
let ref;
const stateFromStoresObject = useStateFromStoresObject([FamilyCenterStore], () => ({
linkCode: FamilyCenterStore.getLinkCode(),
expiresAt: FamilyCenterStore.getLinkCodeExpiresAt()
}));
const { linkCode, expiresAt } = stateFromStoresObject;
const [state, setState] = useState(false);
const [state2, setState2] = useState(() => {
const linkCodeExpiresAt = FamilyCenterStore.getLinkCodeExpiresAt();
return FamilyCenterStore.getLinkCode() != null && linkCodeExpiresAt != null && linkCodeExpiresAt > Date.now();
});
ref = useRef(0);
const callback = useCallback(() => {
const current = ref.current + 1;
ref.current = current;
let c28317_0 = current;
setState(false);
getLinkCodeForCurrentUser().then(() => {
if (c28317_0 === ref.current) {
setState(false);
setState2(true);
}
}).catch(() => {
L6: {
if (c28317_0 === ref.current) {
const linkCodeExpiresAt = FamilyCenterStore.getLinkCodeExpiresAt();
if (FamilyCenterStore.getLinkCode() != null && linkCodeExpiresAt != null && linkCodeExpiresAt > Date.now()) {
setState2(true);
break L6;
}
setState(true);
}
}
});
}, []);
useMountEffect(callback);
return state ? {
state: "error"
} : state2 ? linkCode != null && expiresAt != null ? {
state: "gate",
linkCode,
expiresAt,
refresh: callback
} : {
state: "error"
} : {
state: "loading"
};
}
@@ -0,0 +1,680 @@
// Metro module 11110 (f11111).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useCallback } from "react";
import FamilyCenterStore from "../FamilyCenterStore";
import { UserLinkStatus } from "../FamilyCenterConstants";
import FamilyCenterActionCreators, { updateLinkForUserId, removeLinkForUserId, getLinkCodeForCurrentUser } from "../FamilyCenterActionCreators";
import { APIError } from "../../../errors/index";
let env7503 = {};
export function useFamilyCenterActions(a0) {
const r4 = a0 == null ? {} : a0;
let env18545 = {
$parent: env7503
};
const onError = r4.onError;
env18545[0] = onError;
const onSuccess = r4.onSuccess;
env18545[1] = onSuccess;
const r28 = _slicedToArray(useState(false), 2);
const isAcceptLoading = r28[0];
env18545[2] = r28[1];
const r32 = _slicedToArray(useState(false), 2);
const isDeclineLoading = r32[0];
env18545[3] = r32[1];
const r36 = _slicedToArray(useState(false), 2);
const isDisconnectLoading = r36[0];
env18545[4] = r36[1];
const r40 = _slicedToArray(useState(false), 2);
const isCancelLoading = r40[0];
env18545[5] = r40[1];
const r44 = _slicedToArray(useState(false), 2);
const isGetLinkCodeLoading = r44[0];
env18545[6] = isGetLinkCodeLoading;
env18545[7] = r44[1];
const r48 = _slicedToArray(useState(false), 2);
const isRequestingLink = r48[0];
env18545[8] = isRequestingLink;
env18545[9] = r48[1];
const r52 = _slicedToArray(useState(false), 2);
const isSelectTeenUserLoading = r52[0];
env18545[10] = isSelectTeenUserLoading;
env18545[11] = r52[1];
const r56 = _slicedToArray(useState(false), 2);
const isMoreLoading = r56[0];
env18545[12] = isMoreLoading;
env18545[13] = r56[1];
const r15 = isAcceptLoading || isDeclineLoading || isDisconnectLoading || isCancelLoading || isRequestingLink || isMoreLoading;
let c18547_0;
let c18548_0;
let c18549_0;
let c18550_0;
let c18551_0;
let c18552_0;
env18545[14] = r15;
let c18546_0 = async (c30350_0) => {
let c30350_3;
let c30350_4 = 0;
let c31608_0, c31608_1;
L16: {
L15: {
try {
c31608_0 = void 0;
if (env18545[14]) {
break L16;
}
(0, env18545[2])(true);
c30350_4 = 2;
await updateLinkForUserId(c30350_0, UserLinkStatus.ACTIVE);
const r64 = env18545[1];
if (r64 != null) {
r64();
}
c30350_4 = 1;
c30350_4 = 0;
(0, env18545[2])(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30350_3 = r29;
let r30 = c30350_4;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r101 = c30350_3;
c30350_4 = 0;
(0, env18545[2])(false);
throw r101;
} catch (r99) {
r7 = r99;
c30350_3 = r99;
r30 = c30350_4;
if (r30 === 0) {
break;
}
}
} else {
try {
const r77 = c30350_3;
c30350_4 = 1;
c31608_1 = r77;
c31608_0 = new APIError(c31608_1);
const r88 = env18545[0];
if (r88 != null) {
r88(c31608_0);
}
c30350_4 = 0;
(0, env18545[2])(false);
break L15;
} catch (r74) {
r7 = r74;
c30350_3 = r74;
r30 = c30350_4;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback4 = useCallback(function() {
return c18546_0.apply(this, arguments);
}, [r15, onError, onSuccess]);
c18547_0 = void 0;
c18547_0 = async (c30351_0) => {
let c30351_3;
let c30351_4 = 0;
let c31609_0, c31609_1;
L16: {
L15: {
try {
c31609_0 = void 0;
if (env18545[14]) {
break L16;
}
(0, env18545[3])(true);
c30351_4 = 2;
await updateLinkForUserId(c30351_0, UserLinkStatus.DECLINED);
const r64 = env18545[1];
if (r64 != null) {
r64();
}
c30351_4 = 1;
c30351_4 = 0;
(0, env18545[3])(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30351_3 = r29;
let r30 = c30351_4;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r101 = c30351_3;
c30351_4 = 0;
(0, env18545[3])(false);
throw r101;
} catch (r99) {
r7 = r99;
c30351_3 = r99;
r30 = c30351_4;
if (r30 === 0) {
break;
}
}
} else {
try {
const r77 = c30351_3;
c30351_4 = 1;
c31609_1 = r77;
c31609_0 = new APIError(c31609_1);
const r88 = env18545[0];
if (r88 != null) {
r88(c31609_0);
}
c30351_4 = 0;
(0, env18545[3])(false);
break L15;
} catch (r74) {
r7 = r74;
c30351_3 = r74;
r30 = c30351_4;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback3 = useCallback(function() {
return c18547_0.apply(this, arguments);
}, [r15, onError, onSuccess]);
c18548_0 = void 0;
c18548_0 = async (c30352_0) => {
let c30352_3;
let c30352_4 = 0;
let c31610_0, c31610_1;
L16: {
L15: {
try {
c31610_0 = void 0;
if (env18545[14]) {
break L16;
}
(0, env18545[4])(true);
c30352_4 = 2;
await updateLinkForUserId(c30352_0, UserLinkStatus.INACTIVE);
const r64 = env18545[1];
if (r64 != null) {
r64();
}
c30352_4 = 1;
c30352_4 = 0;
(0, env18545[4])(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30352_3 = r29;
let r30 = c30352_4;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r101 = c30352_3;
c30352_4 = 0;
(0, env18545[4])(false);
throw r101;
} catch (r99) {
r7 = r99;
c30352_3 = r99;
r30 = c30352_4;
if (r30 === 0) {
break;
}
}
} else {
try {
const r77 = c30352_3;
c30352_4 = 1;
c31610_1 = r77;
c31610_0 = new APIError(c31610_1);
const r88 = env18545[0];
if (r88 != null) {
r88(c31610_0);
}
c30352_4 = 0;
(0, env18545[4])(false);
break L15;
} catch (r74) {
r7 = r74;
c30352_3 = r74;
r30 = c30352_4;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback2 = useCallback(function() {
return c18548_0.apply(this, arguments);
}, [r15, onError, onSuccess]);
c18549_0 = void 0;
c18549_0 = async (c30353_0) => {
let c30353_3;
let c30353_4 = 0;
let c31611_0, c31611_1;
L16: {
L15: {
try {
c31611_0 = void 0;
if (env18545[14]) {
break L16;
}
(0, env18545[5])(true);
c30353_4 = 2;
await removeLinkForUserId(c30353_0);
const r62 = env18545[1];
if (r62 != null) {
r62();
}
c30353_4 = 1;
c30353_4 = 0;
(0, env18545[5])(false);
} catch ($e) {
const r28 = $e;
let r7 = r28;
c30353_3 = r28;
let r29 = c30353_4;
if (r29 !== 0) {
while (true) {
if (r29 === 1) {
try {
const r98 = c30353_3;
c30353_4 = 0;
(0, env18545[5])(false);
throw r98;
} catch (r96) {
r7 = r96;
c30353_3 = r96;
r29 = c30353_4;
if (r29 === 0) {
break;
}
}
} else {
try {
const r75 = c30353_3;
c30353_4 = 1;
c31611_1 = r75;
c31611_0 = new APIError(c31611_1);
const r85 = env18545[0];
if (r85 != null) {
r85(c31611_0);
}
c30353_4 = 0;
(0, env18545[5])(false);
break L15;
} catch (r72) {
r7 = r72;
c30353_3 = r72;
r29 = c30353_4;
if (r29 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback = useCallback(function() {
return c18549_0.apply(this, arguments);
}, [r15, onError, onSuccess]);
const callback5 = useCallback(async () => {
let c30354_0, c30354_1;
let c26945_2;
let c26945_3 = 0;
L16: {
L15: {
try {
c30354_0 = void 0;
if (env18545[6]) {
break L16;
}
(0, env18545[7])(true);
c26945_3 = 2;
await getLinkCodeForCurrentUser();
const r59 = env18545[1];
if (r59 != null) {
r59();
}
c26945_3 = 1;
c26945_3 = 0;
(0, env18545[7])(false);
} catch ($e) {
const r27 = $e;
let r7 = r27;
c26945_2 = r27;
let r28 = c26945_3;
if (r28 !== 0) {
while (true) {
if (r28 === 1) {
try {
const r91 = c26945_2;
c26945_3 = 0;
(0, env18545[7])(false);
throw r91;
} catch (r89) {
r7 = r89;
c26945_2 = r89;
r28 = c26945_3;
if (r28 === 0) {
break;
}
}
} else {
try {
const r70 = c26945_2;
c26945_3 = 1;
c30354_1 = r70;
c30354_0 = new APIError(c30354_1);
const r79 = env18545[0];
if (r79 != null) {
r79(c30354_0);
}
c26945_3 = 0;
(0, env18545[7])(false);
break L15;
} catch (r68) {
r7 = r68;
c26945_2 = r68;
r28 = c26945_3;
if (r28 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
}, [isGetLinkCodeLoading, onError, onSuccess]);
c18550_0 = void 0;
c18550_0 = async (c30355_0) => {
let c30355_3;
let c30355_4 = 0;
let c31612_0, c31612_1;
L16: {
L15: {
try {
c31612_0 = void 0;
if (env18545[10]) {
break L16;
}
(0, env18545[11])(true);
c30355_4 = 2;
await FamilyCenterActionCreators.fetchTeenActivity(c30355_0);
const r62 = env18545[1];
if (r62 != null) {
r62();
}
c30355_4 = 1;
c30355_4 = 0;
(0, env18545[11])(false);
} catch ($e) {
const r28 = $e;
let r7 = r28;
c30355_3 = r28;
let r29 = c30355_4;
if (r29 !== 0) {
while (true) {
if (r29 === 1) {
try {
const r98 = c30355_3;
c30355_4 = 0;
(0, env18545[11])(false);
throw r98;
} catch (r96) {
r7 = r96;
c30355_3 = r96;
r29 = c30355_4;
if (r29 === 0) {
break;
}
}
} else {
try {
const r75 = c30355_3;
c30355_4 = 1;
c31612_1 = r75;
c31612_0 = new APIError(c31612_1);
const r85 = env18545[0];
if (r85 != null) {
r85(c31612_0);
}
c30355_4 = 0;
(0, env18545[11])(false);
break L15;
} catch (r72) {
r7 = r72;
c30355_3 = r72;
r29 = c30355_4;
if (r29 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback6 = useCallback(function() {
return c18550_0.apply(this, arguments);
}, [isSelectTeenUserLoading, onError, onSuccess]);
c18551_0 = void 0;
c18551_0 = async (c30356_0, c30356_1) => {
let c30356_4;
let c30356_5 = 0;
let c31613_0, c31613_1;
L16: {
L15: {
try {
c31613_0 = void 0;
if (env18545[8]) {
break L16;
}
(0, env18545[9])(true);
c30356_5 = 2;
await FamilyCenterActionCreators.requestLink(c30356_0, c30356_1);
const r63 = env18545[1];
if (r63 != null) {
r63();
}
c30356_5 = 1;
c30356_5 = 0;
(0, env18545[9])(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30356_4 = r29;
let r30 = c30356_5;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r100 = c30356_4;
c30356_5 = 0;
(0, env18545[9])(false);
throw r100;
} catch (r98) {
r7 = r98;
c30356_4 = r98;
r30 = c30356_5;
if (r30 === 0) {
break;
}
}
} else {
try {
const r76 = c30356_4;
c30356_5 = 1;
c31613_1 = r76;
c31613_0 = new APIError(c31613_1);
const r87 = env18545[0];
if (r87 != null) {
r87(c31613_0);
}
c30356_5 = 0;
(0, env18545[9])(false);
break L15;
} catch (r73) {
r7 = r73;
c30356_4 = r73;
r30 = c30356_5;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
const callback7 = useCallback(function() {
return c18551_0.apply(this, arguments);
}, [isRequestingLink, onError, onSuccess]);
c18552_0 = void 0;
c18552_0 = async (c30357_0) => {
let c30357_3;
let c30357_4 = 0;
let c31614_0, c31614_1;
L16: {
L15: {
try {
c31614_0 = void 0;
const actionsForDisplayType = FamilyCenterStore.getActionsForDisplayType(c30357_0);
const r39 = actionsForDisplayType[actionsForDisplayType.length - 1];
const startId = FamilyCenterStore.getStartId();
const selectedTeenId = FamilyCenterStore.getSelectedTeenId();
if (env18545[12]) {
break L16;
}
if (startId == null) {
break L16;
}
if (selectedTeenId == null) {
break L16;
}
(0, env18545[13])(true);
c30357_4 = 2;
await FamilyCenterActionCreators.fetchMoreTeenActivity(selectedTeenId, c30357_0, startId, r39.event_id);
c30357_4 = 1;
c30357_4 = 0;
(0, env18545[13])(false);
} catch ($e) {
const r33 = $e;
let r7 = r33;
c30357_3 = r33;
let r34 = c30357_4;
if (r34 !== 0) {
while (true) {
if (r34 === 1) {
try {
const r110 = c30357_3;
c30357_4 = 0;
(0, env18545[13])(false);
throw r110;
} catch (r108) {
r7 = r108;
c30357_3 = r108;
r34 = c30357_4;
if (r34 === 0) {
break;
}
}
} else {
try {
const r83 = c30357_3;
c30357_4 = 1;
c31614_1 = r83;
c31614_0 = new APIError(c31614_1);
const r97 = env18545[0];
if (r97 != null) {
r97(c31614_0);
}
c30357_4 = 0;
(0, env18545[13])(false);
break L15;
} catch (r80) {
r7 = r80;
c30357_3 = r80;
r34 = c30357_4;
if (r34 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
};
return {
acceptLinkRequest: callback4,
declineLinkRequest: callback3,
disconnectLinkRequest: callback2,
cancelLinkRequest: callback,
selectTeenUser: callback6,
getLinkCode: callback5,
requestLink: callback7,
loadMore: useCallback(function() {
return c18552_0.apply(this, arguments);
}, [isMoreLoading, onError]),
isAcceptLoading,
isDeclineLoading,
isDisconnectLoading,
isCancelLoading,
isGetLinkCodeLoading,
isSelectTeenUserLoading,
isRequestingLink,
isMoreLoading
};
}
@@ -0,0 +1,48 @@
// Metro module 13925 (f13926).
import FamilyCenterStore from "../FamilyCenterStore";
import { TeenActionDisplayType } from "../FamilyCenterConstants";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import { formatTotalTime } from "../FamilyCenterUtils";
import { shortenAndFormatPrice } from "../../../utils/PriceUtils";
function $mk92281($env) {
return () => $env.$parent[2].getTotalForDisplayType($env[0]);
}
let env9716 = {};
export function useActionsForDisplayType(c20789_0) {
return useStateFromStoresArray([FamilyCenterStore], () => FamilyCenterStore.getActionsForDisplayType(c20789_0));
}
export function useActionTotalsForDisplayType(a0) {
let env20788;
const r1 = env20788 = {
$parent: env9716
};
env20788[0] = a0;
return useStateFromStores([FamilyCenterStore], $mk92281(r1));
}
export function useHasActionForAnyDisplayType() {
return useStateFromStores([FamilyCenterStore], () => Object.values(TeenActionDisplayType).some((item) => FamilyCenterStore.getTotalForDisplayType(item) > 0));
}
export function useFormattedTotalForDisplayType(a0) {
let env20790;
const r5 = env20790 = {
$parent: env9716
};
env20790[0] = a0;
let r14 = useStateFromStores([FamilyCenterStore], $mk92281(r5));
if (r14 == null) {
r14 = 0;
}
if (a0 === TeenActionDisplayType.TOTAL_VOICE_MINUTES) {
return formatTotalTime(r14);
}
if (a0 === TeenActionDisplayType.PURCHASES) {
const totalSpendAmount = FamilyCenterStore.getTotalSpendAmount();
const totalSpendCurrency = FamilyCenterStore.getTotalSpendCurrency();
return totalSpendAmount != null ? totalSpendCurrency != null ? shortenAndFormatPrice(totalSpendAmount, totalSpendCurrency) : r14 : r14;
}
if (a0 === TeenActionDisplayType.GIFTS) {
const totalGiftValue = FamilyCenterStore.getTotalGiftValue();
return totalGiftValue != null ? shortenAndFormatPrice(totalGiftValue.amount, totalGiftValue.currency) : r14;
}
return r14;
}
@@ -0,0 +1,20 @@
// Metro module 16114 (f16115).
import UserStore from "../../../stores/UserStore";
import { intl } from "../../../intl/index.native";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useFormattedEndTime() {
return useStateFromStores([UserStore], () => {
const currentUser = UserStore.getCurrentUser();
const r1 = currentUser == null;
let r5 = void 0;
if (!r1) {
const restrictedSchedule = currentUser.restrictedSchedule;
r5 = restrictedSchedule == null ? void 0 : restrictedSchedule.getNextEndTime();
}
return r5 == null ? null : new Intl.DateTimeFormat(intl.currentLocale, {
hour: "numeric",
minute: "2-digit",
weekday: "long"
}).format(r5);
});
};
@@ -0,0 +1,49 @@
// Metro module 10162 (f10163).
import { useEffect } from "react";
import LocaleStore from "../../user_settings/LocaleStore";
import FamilyCenterStore from "../FamilyCenterStore";
import useIsInAdultAgeGroup from "./useIsInAdultAgeGroup";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
function $mk84111($env) {
return () => {
if ($env[0] == null) {
const r4 = $env.$parent;
(0, r4[0])(r4[2][5]).fetchUserCountryCode();
}
};
}
let $mk84109 = function() {
return () => FamilyCenterStore.getUserCountry();
}, $mk84110 = function() {
return () => LocaleStore.locale;
};
let env6775 = {};
const c6775_6 = new Set(["US"]);
const c6775_7 = new Set(["en-US", "es-ES"]);
export function useShouldShowHelplineLink() {
let env17739;
const r1 = env17739 = {
$parent: env6775
};
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const stateFromStores = useStateFromStores([FamilyCenterStore], $mk84109());
env17739[0] = stateFromStores;
const stateFromStores2 = useStateFromStores([LocaleStore], $mk84110());
useEffect($mk84111(r1), [stateFromStores]);
return (isInAdultAgeGroup ? !isInAdultAgeGroup : stateFromStores != null) && c6775_6.has(stateFromStores.alpha2) && c6775_7.has(stateFromStores2);
}
export function useShouldShowThroughlineLink() {
let env17740;
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const r13 = env17740 = {
$parent: env6775
};
env17740[0] = void 0;
const isInAdultAgeGroup2 = useIsInAdultAgeGroup();
const stateFromStores = useStateFromStores([FamilyCenterStore], $mk84109());
env17740[0] = stateFromStores;
const stateFromStores2 = useStateFromStores([LocaleStore], $mk84110());
useEffect($mk84111(r13), [stateFromStores]);
const r32 = (isInAdultAgeGroup2 ? !isInAdultAgeGroup2 : stateFromStores != null) && c6775_6.has(stateFromStores.alpha2) && c6775_7.has(stateFromStores2);
return isInAdultAgeGroup ? !isInAdultAgeGroup : !r32;
}
@@ -0,0 +1,6 @@
// Metro module 6256 (f6257).
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useIsInAdultAgeGroup() {
return useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getAgeGroup()) === "adult";
};
@@ -0,0 +1,8 @@
// Metro module 16116 (f16117).
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getCurrentRestrictedHoursState } from "../RestrictedHoursManager";
export default function useIsInRestrictedHours() {
return useStateFromStores([UserStore, FamilyCenterStore], getCurrentRestrictedHoursState);
};
@@ -0,0 +1,63 @@
// Metro module 15824 (f15825).
import { useState, useEffect } from "react";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
let c11318_4;
const getIsOnMainSurface = function getIsOnMainSurface() {
const rootNavigationRef2 = getRootNavigationRef();
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
const rootState = rootNavigationRef2.getRootState();
const r3 = rootState != null;
let r16 = void 0;
if (r3) {
const length = rootState.routes.length;
r16 = void 0;
if (length !== 0) {
const routes = rootState.routes;
let index = rootState.index;
if (index == null) {
index = rootState.routes.length - 1;
}
r16 = routes[index];
}
}
if (r16?.name !== "main") {
return false;
}
const state = r16.state;
const r27 = state != null;
let r28 = void 0;
if (r27) {
const length2 = state.routes.length;
r28 = void 0;
if (length2 !== 0) {
const routes2 = state.routes;
let index2 = state.index;
if (index2 == null) {
index2 = state.routes.length - 1;
}
r28 = routes2[index2];
}
}
return r28 != null && c11318_4.has(r28.name);
}
return false;
};
c11318_4 = new Set(["tabs", "channel"]);
export function useIsOnMainSurface() {
const [state, setState] = useState(getIsOnMainSurface);
useEffect(() => {
let rootNavigationRef;
const handleNavigationChange2 = function handleNavigationChange() {
return setState(getIsOnMainSurface());
};
rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
setState(getIsOnMainSurface());
rootNavigationRef.addListener("state", handleNavigationChange2);
return () => {
rootNavigationRef.removeListener("state", handleNavigationChange2);
};
}
}, []);
return state;
}
@@ -0,0 +1,36 @@
// Metro module 13911 (f13912).
import { useRef, useEffect } from "react";
import FamilyCenterStore from "../FamilyCenterStore";
import { usePendingRequestCount } from "./useUserLinks";
import { useStateFromStores } from "../../../_bundle/Module589";
import useMountEffect from "../../../hooks/useMountEffect";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
export default function useOnNewPendingRequest(a0) {
let ref, ref2;
const current = a0;
const pendingRequestCount = usePendingRequestCount();
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getAreLinkedUsersProcessed());
useMountEffect(() => {
if (!FamilyCenterStore.getAreLinkedUsersProcessed()) {
FamilyCenterActionCreators.fetchLinkedUsers().catch(() => {});
}
});
ref = useRef(a0);
useEffect(() => {
ref.current = current;
}, [a0]);
ref2 = useRef(null);
useEffect(() => {
if (stateFromStores) {
if (ref2.current != null) {
const r8 = pendingRequestCount > ref2.current;
ref2.current = pendingRequestCount;
if (r8) {
ref.current();
}
} else {
ref2.current = pendingRequestCount;
}
}
}, [stateFromStores, pendingRequestCount]);
};
@@ -0,0 +1,131 @@
// Metro module 13855 (f13856).
import { useMemo, useCallback } from "react";
import FamilyCenterControlledSettingsStore from "../FamilyCenterControlledSettingsStore";
import { SafetyToastType } from "../../safety_common/Constants";
import { useSelectedTeen, useSelectedTeenId } from "./useSelectedTeen";
import { ParentalControlledExplicitContent, ParentalControlledGoreContent, ParentalControlledDefaultGuildsRestricted, ParentalControlledDefaultGuildsRestrictedV2, ParentalControlledFriendSourceFlags } from "../../user_settings/family_center/ParentalControlledUserSettings";
import { resolveExplicitContentSettingWithDefaultsForTeen, isSetAndNotDefault } from "../FamilyCenterControlledSettingsUtils";
import { ExplicitContentRedaction } from "../../../_bundle/Module1306";
import { resolveGoreSettingWithDefaultsForTeen } from "../../explicit_media_redaction/SensitiveMediaGoreRedactionSettingsUtils";
import { computeFlags } from "../../../utils/UserSettingsUtils";
import { useHasActiveParentLinks } from "./useUserLinks";
import { useStateFromStores } from "../../../_bundle/Module589";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import SafetyToastsActionCreators_native from "../../safety_common/SafetyToastsActionCreators.native";
let env9655 = {};
export function useParentalControlledExplicitContentSettings() {
const selectedTeen = useSelectedTeen();
const controlledSetting2 = ParentalControlledExplicitContent.useControlledSetting(selectedTeen?.id);
return selectedTeen == null ? null : {
explicitContentNonFriendDm: resolveExplicitContentSettingWithDefaultsForTeen({
teenId: selectedTeen?.id,
setting: controlledSetting2?.explicitContentNonFriendDm
}),
explicitContentFriendDm: resolveExplicitContentSettingWithDefaultsForTeen({
teenId: selectedTeen?.id,
setting: controlledSetting2?.explicitContentFriendDm,
isFriend: true
}),
explicitContentGuilds: ExplicitContentRedaction.BLUR
};
}
export function useParentalControlledGoreContentSettings() {
const selectedTeen = useSelectedTeen();
let r16 = ParentalControlledGoreContent.useControlledSetting(selectedTeen?.id);
if (selectedTeen == null) {
return null;
}
if (r16 == null) {
r16 = {};
}
let goreContentNonFriendDm = r16.goreContentNonFriendDm;
let goreContentFriendDm = r16.goreContentFriendDm;
if (!isSetAndNotDefault(goreContentNonFriendDm)) {
goreContentNonFriendDm = resolveGoreSettingWithDefaultsForTeen({
isDm: true
});
}
if (!isSetAndNotDefault(goreContentFriendDm)) {
goreContentFriendDm = resolveGoreSettingWithDefaultsForTeen({
isDm: true,
isFriend: true
});
}
return {
goreContentNonFriendDm,
goreContentFriendDm,
goreContentGuilds: ExplicitContentRedaction.BLUR
};
}
export function useDefaultGuildsRestricted() {
const selectedTeen = useSelectedTeen();
const controlledSetting2 = ParentalControlledDefaultGuildsRestricted.useControlledSetting(selectedTeen?.id);
let r22 = ParentalControlledDefaultGuildsRestrictedV2.useControlledSetting(selectedTeen?.id);
if (r22 == null) {
r22 = !!controlledSetting2 || controlledSetting2;
}
return r22;
}
export function useAllowFriendsFromMutualGuildsOnlyForTeen() {
const id = useSelectedTeen()?.id;
const controlledSetting = ParentalControlledFriendSourceFlags.useControlledSetting(id);
const memo = useMemo(() => computeFlags(controlledSetting), [controlledSetting]);
return memo.mutualGuilds && !memo.all;
}
export function useIsParentallyControlled() {
return useHasActiveParentLinks();
}
export function useParentalControlledConsent(a0) {
let env20758;
let c20759_0;
const selectedTeenId = useSelectedTeenId();
const stateFromStores = useStateFromStores([FamilyCenterControlledSettingsStore], () => FamilyCenterControlledSettingsStore.hasConsented(selectedTeenId, a0));
env20758 = {
$parent: env9655
};
env20758[0] = a0;
env20758[1] = void 0;
const selectedTeenId2 = useSelectedTeenId();
env20758[1] = selectedTeenId2;
c20759_0 = void 0;
c20759_0 = async (c31701_0) => {
let c31701_4 = 0;
L19: {
try {
const r18 = env20758[1];
if (r18 != null) {
const r17 = c31701_0 ? [env20758[0]] : [];
const r31 = c31701_0 ? [] : [env20758[0]];
c31701_4 = 1;
await FamilyCenterActionCreators.updateTeenConsents(r18, r17, r31);
c31701_4 = 0;
break L19;
}
} catch ($e) {
let r7 = $e;
if (c31701_4 !== 0) {
while (true) {
try {
c31701_4 = 0;
SafetyToastsActionCreators_native.showFailedToast(SafetyToastType.GENERIC_ERROR);
break L19;
} catch ($e) {
r7 = $e;
if (c31701_4 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
return {
hasConsented: stateFromStores,
updateConsent: useCallback(function() {
return c20759_0.apply(this, arguments);
}, [selectedTeenId2, a0])
};
}
@@ -0,0 +1,17 @@
// Metro module 13908 (f13909).
import { useEffect } from "react";
import useStableCallback from "../../../hooks/useStableCallback";
export default function useRefreshLinkCodeOnExpiry(a0, a1) {
const stableCallback = useStableCallback(a1);
let c20779_1 = stableCallback;
useEffect(() => {
if (a0 != null) {
const r8 = a0 - Date.now();
if (!(r8 <= 0)) {
let c27589_0 = setTimeout(c20779_1, r8);
return () => clearTimeout(c27589_0);
}
c20779_1();
}
}, [a0, stableCallback]);
};
@@ -0,0 +1,23 @@
// Metro module 13941 (f13942).
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
export default function useScheduleTimeControlsRowProps(a0) {
if (a0.length === 0) {
return {
subLabel: <Text variant="text-xs/medium" color="text-muted">
{intl.string(FamilyCenter_messages.fOBIZH)}
</Text>,
trailing: void 0
};
}
const r6 = a0.some((item) => item.enabled);
return {
subLabel: intl.formatToPlainString(FamilyCenter_messages.XfwcpX, {
count: a0.length
}),
trailing: <Text variant="text-sm/medium" color="text-muted">
{r6 ? intl.string(FamilyCenter_messages["8vDHRq"]) : intl.string(FamilyCenter_messages["4z9fN+"])}
</Text>
};
};
@@ -0,0 +1,27 @@
// Metro module 13902 (f13903).
import FamilyCenterStore from "../FamilyCenterStore";
import { FamilyCenterAction, FamilyCenterSubPages } from "../FamilyCenterConstants";
import { AnalyticEvents } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
const r21 = {};
r21[FamilyCenterSubPages.ACTIVITY] = "family_center_activity_tab";
r21[FamilyCenterSubPages.REQUESTS] = "family_center_requests_tab";
r21[FamilyCenterSubPages.SETTINGS] = "family_center_settings_tab";
r21[FamilyCenterSubPages.CONTENT_AND_SOCIAL] = "family_center_content_and_social_panel";
r21[FamilyCenterSubPages.DATA_AND_PRIVACY] = "family_center_data_and_privacy_panel";
r21[FamilyCenterSubPages.SCREEN_TIME_CONTROLS] = "family_center_screen_time_controls_panel";
export default function useSelectedMyFamilyTab() {
return {
selectedTab: useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getSelectedTab()),
handleTabChange: function handleTabChange(a0) {
FamilyCenterActionCreators.selectTab(a0);
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.TabChange,
tab: a0
});
}
};
};
export { r21 as FAMILY_CENTER_TAB_ANALYTICS_LABELS };
@@ -0,0 +1,11 @@
// Metro module 6257 (f6258).
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
export function useSelectedTeen() {
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getSelectedTeenId());
return useStateFromStores([UserStore], () => stateFromStores !== null ? UserStore.getUser(stateFromStores) : void 0);
}
export function useSelectedTeenId() {
return useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getSelectedTeenId());
}
@@ -0,0 +1,33 @@
// Metro module 13924 (f13925).
import UserStore from "../../../stores/UserStore";
import FamilyCenterControlledSettingsStore from "../FamilyCenterControlledSettingsStore";
import FamilyCenterStore from "../FamilyCenterStore";
import useIsInAdultAgeGroup from "./useIsInAdultAgeGroup";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/defaultAreStatesEqual";
export function useSelectedTeenUser() {
let c20785_0 = useIsInAdultAgeGroup();
return useStateFromStores([FamilyCenterStore, UserStore], () => {
if (c20785_0 !== true) {
return UserStore.getCurrentUser();
}
const selectedTeenId2 = FamilyCenterStore.getSelectedTeenId();
return selectedTeenId2 !== null ? UserStore.getUser(selectedTeenId2) : void 0;
});
}
export function useTeenUserForId(c20786_0) {
return useStateFromStores([UserStore], () => {
const user = UserStore.getUser(c20786_0);
if (user != null) {
return user;
}
});
}
export function useShouldLoadSettingsForSelectedTeenUser() {
const selectedTeenId = FamilyCenterStore.getSelectedTeenId();
const stateFromStoresObject = useStateFromStoresObject([FamilyCenterControlledSettingsStore], () => ({
hasLoadedSettings: selectedTeenId != null && FamilyCenterControlledSettingsStore.hasSettingsForUser(selectedTeenId),
isLoading: FamilyCenterControlledSettingsStore.isLoading
}));
const { hasLoadedSettings, isLoading } = stateFromStoresObject;
return selectedTeenId !== null && (hasLoadedSettings ? !hasLoadedSettings : !isLoading);
}
@@ -0,0 +1,10 @@
// Metro module 13966 (f13967).
import { useState } from "react";
import * as _FamilyCenterRestrictedHoursUtils from "../FamilyCenterRestrictedHoursUtils";
export default function useTimeValue({ initial, defaultValue }) {
return useState(() => initial != null ? {
hours: initial.hours,
minutes: initial.minutes
} : defaultValue);
};
export const timeToMinutes = _FamilyCenterRestrictedHoursUtils.timeToMinutes;
@@ -0,0 +1,6 @@
// Metro module 13901 (f13902).
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useUserAgeGroup() {
return useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getAgeGroup());
};
@@ -0,0 +1,6 @@
// Metro module 11068 (f11069).
import UserStore from "../../../stores/UserStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useUserIsConsideredAdult() {
return useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.nsfwAllowed);
};
@@ -0,0 +1,6 @@
// Metro module 13942 (f13943).
import FamilyCenterStore from "../FamilyCenterStore";
import { useStateFromStores } from "../../../_bundle/Module589";
export default function useUserIsTeenAgeGroup() {
return useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getAgeGroup()) === "teen";
};
+161
View File
@@ -0,0 +1,161 @@
// Metro module 6255 (f6256).
import { useMemo } from "react";
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { UserLinkStatus, UserLinkType, FAMILY_CENTER_REQUEST_QR_CODE_URL, MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS, MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS, PENDING_LINK_REQUEST_TIMESTAMP_FORMATTER, ACCEPTED_LINK_REQUEST_TIMESTAMP_FORMATTER } from "../FamilyCenterConstants";
import { useStateFromStores, useStateFromStoresArray } from "../../../_bundle/defaultAreStatesEqual";
import useIsInAdultAgeGroup from "./useIsInAdultAgeGroup";
import { useSelectedTeenId } from "./useSelectedTeen";
import { formatUserActivityTimestamp, formatLinkTimestamp } from "../FamilyCenterUtils";
function $mk78094($env) {
return () => {
const r1 = $env;
return Object.values(r1[1]).filter($mk105016(r1)).sort((a, b) => new Date(a.updated_at).getTime() - new Date(b.updated_at).getTime()).map((item) => item.user_id).filter((item) => item != null);
};
}
function $mk78095($env) {
return () => $env[0].map($mk105020($env.$parent));
}
function $mk78096() {
return (a0) => a0 != null;
}
function $mk105016($env) {
return (a0) => a0 != null && a0.link_status === $env[0];
}
function $mk105020($env) {
return (a0) => $env[4].getUser(a0);
}
let $mk78093 = function() {
return () => FamilyCenterStore.getLinkedUsers();
};
let env3973 = {};
export function useUserIdsForLinkStatus(a0) {
let env15621;
const r1 = env15621 = {
$parent: env3973
};
env15621[0] = a0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15621[1] = stateFromStores3;
return useMemo($mk78094(r1), [stateFromStores3, a0]);
}
export function useUsersForLinkStatus(a0) {
let env15622;
let env15623;
const r1 = env15622 = {
$parent: env3973
};
const r5 = env15623 = {
$parent: env3973
};
env15623[0] = a0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15623[1] = stateFromStores3;
env15622[0] = useMemo($mk78094(r5), [stateFromStores3, a0]);
return useStateFromStoresArray([UserStore], $mk78095(r1)).filter($mk78096());
}
export function useActiveLinkUserIds() {
let env15624;
const ACTIVE = UserLinkStatus.ACTIVE;
const r8 = env15624 = {
$parent: env3973
};
env15624[0] = ACTIVE;
env15624[1] = void 0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15624[1] = stateFromStores3;
return useMemo($mk78094(r8), [stateFromStores3, ACTIVE]);
}
export function getActiveLinkUserIds() {
return Object.values(FamilyCenterStore.getLinkedUsers()).filter((item) => item != null && item.link_status === UserLinkStatus.ACTIVE).sort((a, b) => new Date(a.updated_at).getTime() - new Date(b.updated_at).getTime()).map((item) => item.user_id).filter((item) => item != null);
}
export function useActiveLinkUsers() {
let env15625;
let env15626;
const ACTIVE = UserLinkStatus.ACTIVE;
const r11 = env15625 = {
$parent: env3973
};
env15625[0] = void 0;
const r5 = env15626 = {
$parent: env3973
};
env15626[0] = ACTIVE;
env15626[1] = void 0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15626[1] = stateFromStores3;
env15625[0] = useMemo($mk78094(r5), [stateFromStores3, ACTIVE]);
return useStateFromStoresArray([UserStore], $mk78095(r11)).filter($mk78096());
}
export function useHasActiveLinks() {
let env15627;
const ACTIVE = UserLinkStatus.ACTIVE;
const r9 = env15627 = {
$parent: env3973
};
env15627[0] = ACTIVE;
env15627[1] = void 0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15627[1] = stateFromStores3;
return useMemo($mk78094(r9), [stateFromStores3, ACTIVE]).length > 0;
}
export function useHasActiveParentLinks() {
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkedUsers());
return useMemo(() => Object.values(stateFromStores).some((item) => item != null && item.link_status === UserLinkStatus.ACTIVE && item.link_type === UserLinkType.PARENT), [stateFromStores]);
}
export function useUserQRLinkUrl() {
const stateFromStores3 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCode());
const stateFromStores4 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
return stateFromStores3 == null ? null : stateFromStores4 == null ? null : (0, FAMILY_CENTER_REQUEST_QR_CODE_URL)(stateFromStores4.id, stateFromStores3);
}
export function useHasMaxConnections() {
let env15629;
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const ACTIVE = UserLinkStatus.ACTIVE;
const r12 = env15629 = {
$parent: env3973
};
env15629[0] = ACTIVE;
env15629[1] = void 0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15629[1] = stateFromStores3;
return useMemo($mk78094(r12), [stateFromStores3, ACTIVE]).length >= (isInAdultAgeGroup ? MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS : MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS);
}
export function usePendingRequestCount() {
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const stateFromStores3 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkedUsers());
return stateFromStores2 == null ? 0 : Object.values(stateFromStores3).filter((item) => item != null && item.link_status === UserLinkStatus.PENDING && stateFromStores2.id !== item.requestor_id).length;
}
export function useRequiresParentalConsent(a0) {
const stateFromStores3 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkedUsers());
let r14 = a0 != null;
if (r14) {
let r16 = stateFromStores3[a0]?.teen_requires_parental_consent;
if (r16 == null) {
r16 = false;
}
r14 = r16;
}
return r14;
}
export function useAcceptedRequestsCount() {
let env15631;
const ACTIVE = UserLinkStatus.ACTIVE;
const r8 = env15631 = {
$parent: env3973
};
env15631[0] = ACTIVE;
env15631[1] = void 0;
const stateFromStores3 = useStateFromStores([FamilyCenterStore], $mk78093());
env15631[1] = stateFromStores3;
return useMemo($mk78094(r8), [stateFromStores3, ACTIVE]).length;
}
export function useActivityWindowTimeStamp(c15632_0) {
const selectedTeenId = useSelectedTeenId();
const stateFromStores3 = useStateFromStores([FamilyCenterStore], () => selectedTeenId != null ? FamilyCenterStore.getRangeStartTimestamp() : null);
return stateFromStores3 != null ? formatUserActivityTimestamp(new Date(stateFromStores3).getTime(), () => c15632_0, 7) : null;
}
export function useLinkTimestampText(c15633_0, a1) {
const stateFromStores3 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkTimestamp(c15633_0));
return stateFromStores3 != null ? formatLinkTimestamp(Date.parse(stateFromStores3), a1 === UserLinkStatus.PENDING ? PENDING_LINK_REQUEST_TIMESTAMP_FORMATTER : ACCEPTED_LINK_REQUEST_TIMESTAMP_FORMATTER) : null;
}
@@ -0,0 +1,157 @@
// Metro module 13938 (f13939).
import { useMemo } from "react";
import { View, StyleSheet } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { WarningIcon } from "../../../design/components/Icon/native/redesign/generated/WarningIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { useChangeSpendingLimitFormState } from "../ChangeSpendingLimitFormState";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { formatPrice } from "../../../utils/PriceUtils";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { TextInput } from "../../../design/components/TextInput/native/TextInput.native";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const ChangeSpendingLimitScreen = function ChangeSpendingLimitScreen(props) {
let save;
const teenId3 = props.teenId;
save = void 0;
let _handleSave2 = function _handleSave() {
const r9 = async () => {
let c30678_2 = 0;
L10: {
try {
c30678_2 = 1;
await save();
ToastActionCreators.open({
key: "SPENDING_CONTROLS_CHANGED",
content: intl.string(FamilyCenter_messages["2WKfG1"]),
IconComponent: CircleCheckIcon,
iconColor: "status-positive"
});
ModalActionCreators.pop();
c30678_2 = 0;
} catch ($e) {
let r25 = $e;
if (c30678_2 !== 0) {
while (true) {
try {
c30678_2 = 0;
presentFailedToast(intl.string(FamilyCenter_messages.Wu8BK2));
break L10;
} catch ($e) {
r25 = $e;
if (c30678_2 === 0) {
break;
}
}
}
}
throw r25;
}
}
};
_handleSave2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const changeSpendingLimitFormState = useChangeSpendingLimitFormState(teenId3);
const { amountInput, handleAmountChange, currency, currencySymbol, exponent, isClearingCap, isOverspending, canSave, isSubmitting, renewalDate, monthlySpend } = changeSpendingLimitFormState;
save = changeSpendingLimitFormState.save;
const amount = monthlySpend != null ? monthlySpend > 0 ? formatPrice(monthlySpend, currency) : null : null;
const r48 = amountInput.length > 0;
const r71 = [<Text variant="text-sm/normal">
{intl.string(FamilyCenter_messages.IFguF2)}
</Text>, ,];
const r90 = [<Text variant="text-sm/semibold" color="text-subtle">
{intl.string(FamilyCenter_messages["1fHSu2"])}
</Text>, <View>
<TextInput accessibilityLabel={intl.string(FamilyCenter_messages["1fHSu2"])} value={amountInput} onChange={handleAmountChange} leadingText={r48 ? currencySymbol : void 0} placeholder={intl.string(FamilyCenter_messages.DjSv82)} keyboardType={exponent > 0 ? "decimal-pad" : "number-pad"} isClearable />
{isOverspending ? <View style={styles.warningOverlay} pointerEvents="none" /> : null}
</View>, ,];
const r122 = amount == null ? null : isOverspending ? <View style={styles.warningRow}>
<WarningIcon size="xs" color={Module712.colors.ICON_FEEDBACK_WARNING} />
<Text variant="text-sm/normal" style={styles.warningText}>
{intl.formatToPlainString(FamilyCenter_messages.Tk6x4X, {
amount,
date: renewalDate
})}
</Text>
</View> : <Text variant="text-sm/normal" color="text-muted">
{intl.formatToPlainString(FamilyCenter_messages.pfAlRY, {
amount
})}
</Text>;
const handleSave = function handleSave() {
return _handleSave2.apply(this, arguments);
};
r90[2] = r122;
r71[1] = <Stack spacing={Module712.space.PX_8}>{r90}</Stack>;
return <ModalScreen>
<ModalContent>
<Stack spacing={Module712.space.PX_16}>{r71}</Stack>
</ModalContent>
<ModalFooter>
<ButtonGroup>
<Button {...isClearingCap ? {
variant: "destructive",
text: intl.string(FamilyCenter_messages.JZDGJ8),
onPress: handleSave,
disabled: isSubmitting,
loading: isSubmitting
} : {
text: intl.string(t["R3BPH+"]),
onPress: handleSave,
disabled: canSave ? isSubmitting : !canSave,
loading: isSubmitting
}} />
<Button variant="tertiary" text={intl.string(t["ETE/oC"])} onPress={ModalActionCreators.pop} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
useStyles = createStyles({
warningOverlay: {
...StyleSheet.absoluteFillObject,
borderRadius: Module712.modules.mobile.INPUT_FIELD_RADIUS_LG,
borderWidth: 1,
borderColor: Module712.colors.ICON_FEEDBACK_WARNING,
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_WARNING
},
warningRow: {
flexDirection: "row",
gap: Module712.space.PX_8,
alignItems: "flex-start"
},
warningText: {
flex: 1,
color: Module712.colors.ICON_FEEDBACK_WARNING
}
});
export default function ChangeSpendingLimitModal(props) {
const teenId = props.teenId;
return <Modal initialRouteName="CHANGE_SPENDING_LIMIT" screens={useMemo(() => {
const teenId2 = teenId;
return {
CHANGE_SPENDING_LIMIT: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => <Text variant="text-md/semibold">
{intl.string(FamilyCenter_messages.xMRO6A)}
</Text>,
render: () => <ChangeSpendingLimitScreen teenId={teenId2} />
}
};
}, [teenId])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,69 @@
// Metro module 13910 (f13911).
import { useCallback } from "react";
import { View } from "react-native";
import FamilyCenterStore from "../FamilyCenterStore";
import { CONNECT_GUARDIAN_BOTTOM_SHEET_KEY } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import useOnNewPendingRequest from "../hooks/useOnNewPendingRequest";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { ConnectGuardianCard } from "./ConnectGuardianCard";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_24,
paddingVertical: Module712.space.PX_24,
gap: Module712.space.PX_24
},
info: {
alignItems: "center",
gap: Module712.space.PX_8
},
centered: {
textAlign: "center"
},
cardContainer: {
alignItems: "center"
}
});
export default function ConnectGuardianBottomSheet(props) {
const { linkCode, expiresAt, onRefresh } = props;
let title = props.title;
let body = props.body;
const styles = useStyles();
let linkCode2 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCode());
let expiresAt2 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCodeExpiresAt());
const callback = useCallback(() => {
ActionSheetActionCreators.hideActionSheet(CONNECT_GUARDIAN_BOTTOM_SHEET_KEY);
}, []);
useOnNewPendingRequest(callback);
if (title == null) {
title = intl.string(FamilyCenter_messages.aCUVfL);
}
const r59 = [<Text style={styles.centered} accessibilityRole="header" variant="heading-xl/bold" color="mobile-text-heading-primary">{title}</Text>, ,];
if (body == null) {
body = intl.format(FamilyCenter_messages["2O6ltn"], {
link: "https://support.discord.com/hc/articles/14155060633623"
});
}
r59[1] = <Text style={styles.centered} variant="text-md/medium" color="text-default">{body}</Text>;
const r74 = [<View style={styles.info}>{r59}</View>, , ,];
if (linkCode2 == null) {
linkCode2 = linkCode;
}
if (expiresAt2 == null) {
expiresAt2 = expiresAt;
}
r74[1] = <View style={styles.cardContainer}>
<ConnectGuardianCard linkCode={linkCode2} expiresAt={expiresAt2} onRefresh={onRefresh} />
</View>;
r74[2] = <Button variant="secondary" size="md" text={intl.string(FamilyCenter_messages.Hsm5IF)} onPress={callback} />;
return <BottomSheet startExpanded>
<View style={styles.container}>{r74}</View>
</BottomSheet>;
};
@@ -0,0 +1,123 @@
// Metro module 13912 (f13913).
import { useCallback } from "react";
import { View } from "react-native";
import UserStore from "../../../stores/UserStore";
import { FAMILY_CENTER_REQUEST_QR_CODE_URL } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useCountdown from "../../../hooks/useCountdown";
import useRefreshLinkCodeOnExpiry from "../hooks/useRefreshLinkCodeOnExpiry";
import { shareGuardianConnectLink } from "./shareGuardianConnectLink";
import { copy } from "../../../utils/ClipboardUtils.native";
import { presentLinkCopied } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { QRCodeWithOverlay } from "../../../components_native/QRCode";
import { Text } from "../../../design/components/Text/native/Text";
import { getTimeFormat } from "../../../utils/native/TimeUtils";
import { Button } from "../../../design/components/Button/native/Button.native";
import { ShareIcon } from "../../../design/components/Icon/native/redesign/generated/ShareIcon";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_16
},
compactContainer: {
alignSelf: "center",
gap: Module712.space.PX_16
},
card: {
alignSelf: "center",
padding: Module712.space.PX_12,
borderWidth: 1,
borderRadius: Module712.radii.lg,
borderColor: Module712.colors.BORDER_NORMAL
},
countdown: {
textAlign: "center"
},
divider: {
flexDirection: "row",
alignItems: "center",
paddingHorizontal: Module712.space.PX_8
},
compactDividerFlush: {
paddingHorizontal: 0
},
dividerLine: {
flex: 1,
height: 1,
backgroundColor: Module712.colors.BORDER_NORMAL
},
dividerText: {
marginHorizontal: Module712.space.PX_8
},
buttonGroup: {
paddingTop: 0
}
});
export function ConnectGuardianCard(props) {
let r173;
let id;
const { linkCode, expiresAt, onRefresh, shareActions = "none" } = props;
id = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
id = stateFromStores?.id;
const countdown = useCountdown(expiresAt);
const { days, hours, minutes, seconds } = countdown;
useRefreshLinkCodeOnExpiry(expiresAt, onRefresh);
const callback2 = useCallback(() => {
if (stateFromStores != null && linkCode !== "") {
shareGuardianConnectLink(stateFromStores, linkCode);
}
}, [stateFromStores, linkCode]);
const callback = useCallback(() => {
if (id != null && linkCode !== "") {
copy(FAMILY_CENTER_REQUEST_QR_CODE_URL(id, linkCode), presentLinkCopied);
}
}, [id, linkCode]);
if (id == null) {
return null;
}
const r97 = <View style={styles.card}>
<Stack align="center" spacing={Module712.space.PX_8}>
<QRCodeWithOverlay size={160} text={FAMILY_CENTER_REQUEST_QR_CODE_URL(id, linkCode)} />
<Text style={styles.countdown} variant="text-xs/normal">
{`${intl.string(FamilyCenter_messages.RfkLDs)} ${getTimeFormat(86400 * days + 3600 * hours + 60 * minutes + seconds)}`}
</Text>
</Stack>
</View>;
if (shareActions === "none") {
return r97;
}
const r100 = shareActions === "compact";
const r126 = <View style={[styles.divider, r100 && styles.compactDividerFlush]}>
<View style={styles.dividerLine} />
<Text style={styles.dividerText} variant="text-sm/medium" color="text-muted">
{intl.string(r100 ? FamilyCenter_messages.XhROZk : FamilyCenter_messages.lggBOi)}
</Text>
<View style={styles.dividerLine} />
</View>;
if (r100) {
r173 = <View style={styles.compactContainer}>
{r97}
{r126}
<Button variant="secondary" size="md" text={intl.string(t.Ej3B3Y)} icon={<ShareIcon size="md" color={Module712.colors.CONTROL_SECONDARY_TEXT_DEFAULT} />} disabled={linkCode === ""} onPress={callback2} />
</View>;
} else {
const text = intl.string(t.Ej3B3Y);
const disabled = linkCode === "";
r173 = <Stack spacing={Module712.space.PX_32} style={styles.container}>
{r97}
{r126}
<ButtonGroup style={styles.buttonGroup}>
<Button variant="secondary" size="md" text={text} disabled={disabled} onPress={callback2} />
<Button variant="secondary" size="md" text={intl.string(t.WqhZss)} disabled={disabled} onPress={callback} />
</ButtonGroup>
</Stack>;
}
return r173;
}
@@ -0,0 +1,91 @@
// Metro module 16296 (f16297).
import { useCallback, useEffect, useMemo } from "react";
import { View } from "react-native";
import FamilyCenterStore from "../FamilyCenterStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useSyncMessages, intl, t } from "../../../intl/index.native";
import FamilyCenter_messages, { messagesLoader } from "../FamilyCenter.messages";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useOnNewPendingRequest from "../hooks/useOnNewPendingRequest";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../design/components/Text/native/Text";
import { ConnectGuardianCard } from "./ConnectGuardianCard";
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import { getHeaderBackButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const ConnectGuardianShareScreen = function ConnectGuardianShareScreen() {
const styles = useStyles();
useSyncMessages(messagesLoader);
const getLinkCode = useFamilyCenterActions({
onError: useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
ModalActionCreators.pop();
}, [])
}).getLinkCode;
const stateFromStores2 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCode());
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCodeExpiresAt());
useEffect(() => {
getLinkCode();
}, []);
useOnNewPendingRequest(ModalActionCreators.pop);
return <ModalScreen>
<ModalContent>
<Stack spacing={Module712.space.PX_40}>
<Stack spacing={Module712.space.PX_8}>
<Text style={styles.title} variant="heading-xl/bold" color="mobile-text-heading-primary" accessibilityRole="header">
{intl.string(FamilyCenter_messages.ITlV6p)}
</Text>
<Text style={styles.body} variant="text-sm/medium" color="text-muted">
{intl.format(FamilyCenter_messages.F4GT2S, {
link: "https://support.discord.com/hc/articles/14155060633623"
})}
</Text>
</Stack>
<Stack spacing={Module712.space.PX_24} style={styles.cardSection}>
<Text style={styles.qrLabel} variant="text-md/semibold" color="mobile-text-heading-primary">
{intl.string(FamilyCenter_messages.pojgfk)}
</Text>
{stateFromStores2 != null && stateFromStores != null ? <ConnectGuardianCard shareActions="full" linkCode={stateFromStores2} expiresAt={stateFromStores} onRefresh={getLinkCode} /> : <View style={styles.loading}>
<ActivityIndicator />
</View>}
</Stack>
</Stack>
</ModalContent>
</ModalScreen>;
};
useStyles = createStyles({
title: {
textAlign: "center"
},
body: {
textAlign: "center"
},
qrLabel: {
textAlign: "center"
},
cardSection: {
alignItems: "center"
},
loading: {
alignItems: "center",
justifyContent: "center",
paddingVertical: Module712.space.PX_24
}
});
export default function ConnectGuardianShareModal() {
return <Modal initialRouteName="CONNECT_GUARDIAN_SHARE" screens={useMemo(() => ({
CONNECT_GUARDIAN_SHARE: {
headerShown: true,
headerLeft: getHeaderBackButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <ConnectGuardianShareScreen />
}
}), [])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,79 @@
// Metro module 13946 (f13947).
import { View } from "react-native";
import { MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS, MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { useActiveLinkUsers } from "../hooks/useUserLinks";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenterEmpty from "./FamilyCenterEmpty";
import FamilyCenterLinkRow from "./FamilyCenterLinkRow";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { Icon } from "../../../design/void/native";
import Module13954 from "../../../_bundle/Module13954";
let useStyles, useStyles2;
const FamilyCenterAcceptedLinkRow = function FamilyCenterAcceptedLinkRow(props) {
const otherUser = props.otherUser;
const styles2 = useStyles2();
return otherUser !== void 0 ? <FamilyCenterLinkRow otherUser={otherUser} actions={<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(FamilyCenter_messages.T7DUoU, {
name: otherUser == null ? void 0 : otherUser.toString()
})} onPress={function onPress() {
ModalActionCreators.pushLazy(import("./FamilyCenterModalDisconnect"), {
otherUser
});
}} style={styles2.actionButton}>
<Icon size={Icon.Sizes.SMALL} disableColor source={Module13954} />
</PressableOpacity>} /> : null;
};
useStyles = createStyles({
container: {
marginTop: 24
},
content: {
display: "flex",
justifyContent: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderRadius: Module712.radii.md
},
empty: {
padding: 20,
alignSelf: "center"
},
header: {
marginBottom: 10
}
});
useStyles2 = createStyles({
actionButton: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
borderRadius: Module712.radii.round,
alignItems: "center",
justifyContent: "center",
height: 32,
width: 32
}
});
export default function FamilyCenterAcceptedLinks() {
const styles = useStyles();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const activeLinkUsers = useActiveLinkUsers();
const r9 = {
count: activeLinkUsers.length,
max: isInAdultAgeGroup ? MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS : MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS
};
return <View style={styles.container}>
<Text style={styles.header} variant="eyebrow" color="text-default">
{useAgeSpecificText(intl.formatToPlainString(FamilyCenter_messages["+tnO34"], r9), intl.formatToPlainString(FamilyCenter_messages["pu6/U0"], r9))}
</Text>
<View style={styles.content}>
{activeLinkUsers.length === 0 ? <View style={styles.empty}>
<FamilyCenterEmpty text={intl.string(FamilyCenter_messages.C4ScLD)} />
</View> : activeLinkUsers.map((activeLinkUser) => <FamilyCenterAcceptedLinkRow key={`accepted-${activeLinkUser.id}`} otherUser={activeLinkUser} />)}
</View>
</View>;
};
@@ -0,0 +1,82 @@
// Metro module 13906 (f13907).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useHasActiveLinks, useHasMaxConnections } from "../hooks/useUserLinks";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { FamilyCenterParentQRCodeButton, FamilyCenterTeenQRCodeButton } from "./FamilyCenterBannerButton";
import Module712 from "../../../_bundle/Module712";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import Module13914 from "../../../_bundle/Module13914";
import Module13915 from "../../../_bundle/Module13915";
import { Text } from "../../../design/components/Text/native/Text";
let useStyles, useStyles2;
const FamilyCenterActivityBannerButton = function FamilyCenterActivityBannerButton() {
let r19;
L7: {
const styles = useStyles();
const hasActiveLinks = useHasActiveLinks();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const hasMaxConnections = useHasMaxConnections();
r19 = null;
if (!hasMaxConnections) {
if (isInAdultAgeGroup) {
r19 = null;
if (hasActiveLinks) {
break L7;
}
}
r19 = <View style={styles.container}>
{isInAdultAgeGroup ? <FamilyCenterParentQRCodeButton /> : <FamilyCenterTeenQRCodeButton />}
</View>;
}
}
return r19;
};
useStyles = createStyles({
container: {
width: "100%"
}
});
useStyles2 = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
marginTop: 16,
padding: 24,
alignItems: "center",
borderRadius: Module712.radii.md,
elevation: 2
},
art: {
maxWidth: 243,
maxHeight: 119,
marginBottom: Module712.space.PX_8
},
header: {
marginBottom: Module712.space.PX_8,
textAlign: "center"
},
description: {
textAlign: "center"
}
});
export default function FamilyCenterActivityBanner() {
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const styles2 = useStyles2();
const hasMaxConnections = useHasMaxConnections();
return <View style={styles2.container}>
<Image2 source={isInAdultAgeGroup ? Module13914 : Module13915} style={styles2.art} />
<Text style={styles2.header} variant="heading-lg/semibold">
{useAgeSpecificText(intl.string(FamilyCenter_messages["T7GyW+"]), intl.string(FamilyCenter_messages.goKE2b))}
</Text>
<Text style={styles2.description} variant="text-sm/medium" color="text-muted">
{useAgeSpecificText(intl.format(FamilyCenter_messages.MXjDSv, {
articleLink: "https://support.discord.com/hc/articles/14155060633623"
}), intl.format(FamilyCenter_messages.EMCf6j, {
articleLink: "https://support.discord.com/hc/articles/14155043715735"
}))}
</Text>
{hasMaxConnections ? null : <FamilyCenterActivityBannerButton />}
</View>;
};
@@ -0,0 +1,269 @@
// Metro module 13920 (f13921).
import * as Module19 from "react";
import { useMemo } from "react";
import { View } from "react-native";
import { FamilyCenterAction, TeenActionDisplayType } from "../FamilyCenterConstants";
import { AnalyticEvents } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { useActiveLinkUserIds, useActivityWindowTimeStamp, useActiveLinkUsers } from "../hooks/useUserLinks";
import { getActivityWindowTimestampFormatter, getSortedActivityTypeConfigs } from "../FamilyCenterUtils";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Icon, AVATAR_SIZE_MAP, AvatarSizes, Avatar } from "../../../design/void/native";
import Module13921 from "../../../_bundle/Module13921";
import { Text } from "../../../design/components/Text/native/Text";
import TouchableHitBox from "../../../design/void/TouchableHitBox/native/TouchableHitBox";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import Module6550 from "../../../_bundle/Module6550";
import FamilyCenterUsernameHeader from "./FamilyCenterUsernameHeader";
import { useSelectedTeenUser } from "../hooks/useSelectedTeenUser";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import UserUtils from "../../../utils/UserUtils";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import Module10737 from "../../../_bundle/Module10737";
import { useHasActionForAnyDisplayType } from "../hooks/useFamilyCenterActivities";
import FamilyCenterActivityTotal from "./FamilyCenterActivityTotal";
import FamilyCenterTopActivity from "./FamilyCenterTopActivity";
import FamilyCenterActivitySection from "./FamilyCenterActivitySection";
import FamilyCenterSettingsControls from "./FamilyCenterSettingsControls";
let c9712_10, useStyles, FamilyCenterHeaderSubText, useStyles2, Component, FamilyCenterActivityCardHeader, useStyles3, FamilyCenterActivityCardAccountSelect, useStyles4;
const FamilyCenterActivityCardPrefaceText = function FamilyCenterActivityCardPrefaceText() {
const styles2 = useStyles();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const activeLinkUserIds = useActiveLinkUserIds();
const activityWindowTimeStamp = useActivityWindowTimeStamp(getActivityWindowTimestampFormatter(!!isInAdultAgeGroup));
const ageSpecificText = useAgeSpecificText(intl.formatToPlainString(FamilyCenter_messages.tazvHQ, {
activeLinks: activeLinkUserIds.length
}), intl.string(FamilyCenter_messages.KrLnkE));
return <View style={styles2.container}>
{isInAdultAgeGroup ? null : <Icon color={styles2.icon.color} source={Module13921} style={styles2.icon} />}
<Text style={styles2.text} variant="text-xs/semibold" color="text-subtle">
{activeLinkUserIds.length > 1 ? isInAdultAgeGroup ? activityWindowTimeStamp : ageSpecificText : ageSpecificText}
</Text>
<TouchableHitBox onPress={function onPress() {
ModalActionCreators.pushLazy(import("./FamilyCenterModalDataTooltip"));
}}>
<Icon color={styles2.icon.color} source={Module6550} size={Icon.Sizes.EXTRA_SMALL} style={styles2.icon} />
</TouchableHitBox>
</View>;
};
FamilyCenterHeaderSubText = function FamilyCenterHeaderSubText() {
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const activeLinkUserIds = useActiveLinkUserIds();
const activityWindowTimeStamp = useActivityWindowTimeStamp(getActivityWindowTimestampFormatter(!!isInAdultAgeGroup));
return isInAdultAgeGroup ? activeLinkUserIds.length > 1 ? null : <Text variant="text-sm/medium" color="text-muted">{activityWindowTimeStamp}</Text> : <Text variant="text-sm/medium" color="text-muted">{activityWindowTimeStamp}</Text>;
};
FamilyCenterActivityCardHeader = function FamilyCenterActivityCardHeader() {
const activeLinkUserIds = useActiveLinkUserIds();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const selectedTeenUser2 = useSelectedTeenUser();
return selectedTeenUser2 !== void 0 ? isInAdultAgeGroup && activeLinkUserIds.length !== 1 ? <FamilyCenterActivityCardAccountSelect /> : <View>
<Component user={selectedTeenUser2} />
</View> : null;
};
FamilyCenterActivityCardAccountSelect = function FamilyCenterActivityCardAccountSelect() {
let memo;
const styles3 = useStyles3();
const activeLinkUsers = useActiveLinkUsers();
const selectedTeenUser = useSelectedTeenUser();
const selectTeenUser = useFamilyCenterActions({
onSuccess: () => ActionSheetActionCreators.hideActionSheet(c9712_10),
onError: () => presentFailedToast(intl.string(FamilyCenter_messages.Wu8BK2))
}).selectTeenUser;
memo = useMemo(() => activeLinkUsers.map((activeLinkUser) => ({
label: `${UserUtils.getName(activeLinkUser)} (${UserUtils.getUserTag(activeLinkUser)})`,
value: activeLinkUser.id
})), [activeLinkUsers]);
return selectedTeenUser !== void 0 ? <View>
<TouchableHitBox style={styles3.touch} accessibilityRole="spinbutton" onPress={function onPress() {
if (selectedTeenUser !== void 0) {
ActionSheetActionCreators.openLazy(import("../../../components_native/common/ItemSelectorActionSheet"), c9712_10, {
title: intl.string(FamilyCenter_messages.vORl9Q),
items: memo,
onItemSelect: (a0) => {
if (a0 != null && a0 !== selectedTeenUser.id) {
selectTeenUser(a0);
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.SelectTeen
});
}
setImmediate(() => {
ActionSheetActionCreators.hideActionSheet(c9712_10);
});
},
selectedItem: selectedTeenUser.id,
hasIcons: false
});
}
}}>
<Component user={selectedTeenUser} inSelector />
<Icon style={styles3.icon} size={Icon.Sizes.MEDIUM} source={Module10737} />
</TouchableHitBox>
</View> : null;
};
c9712_10 = "FamilyCenterTeenAccountSelect";
useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
icon: {
color: Module712.colors.ICON_SUBTLE,
width: Module712.space.PX_16,
height: Module712.space.PX_16
},
text: {
marginHorizontal: Module712.space.PX_4
}
});
useStyles2 = createStyles({
header: {
display: "flex",
flexDirection: "row",
alignItems: "center",
padding: Module712.space.PX_12,
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
borderTopLeftRadius: Module712.radii.md,
borderTopRightRadius: Module712.radii.md
},
avatar: {
borderRadius: AVATAR_SIZE_MAP[AvatarSizes.NORMAL] / 2,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
avatarContainer: {
marginRight: Module712.space.PX_12,
alignItems: "flex-start"
},
userHeader: {
display: "flex",
flexDirection: "column",
width: "100%",
paddingRight: Module712.space.PX_16
},
nonSelectorHeader: {
flex: 1,
paddingRight: Module712.space.PX_16
}
});
Component = Module19.memo(({ user, inSelector }) => {
const styles2 = useStyles2();
return <View style={styles2.header}>
<View style={styles2.avatarContainer}>
<Avatar avatarStyle={styles2.avatar} user={user} guildId={void 0} disablePlaceholder avatarDecoration={user.avatarDecoration} size={inSelector ? AvatarSizes.SMALL : AvatarSizes.NORMAL} />
</View>
<View style={[styles2.userHeader, inSelector ? void 0 : styles2.nonSelectorHeader]}>
<FamilyCenterUsernameHeader user={user} />
<FamilyCenterHeaderSubText />
</View>
</View>;
});
Component.displayName = "FamilyCenterActivityCardAccount";
useStyles3 = createStyles({
touch: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
...Module712.shadows.SHADOW_LOW
},
icon: {
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
width: Module712.space.PX_24,
height: Module712.space.PX_24,
transform: [{
rotate: "90deg"
}],
marginHorizontal: Module712.space.PX_8
}
});
useStyles4 = createStyles({
card: {
marginTop: Module712.space.PX_16
},
preface: {
display: "flex",
marginBottom: Module712.space.PX_12
},
container: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.md
},
content: {
padding: Module712.space.PX_16,
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_32
},
totals: {
display: "flex",
flexDirection: "row",
flexWrap: "wrap",
justifyContent: "space-between",
gap: Module712.space.PX_8
},
first: {
width: "100%"
},
other: {
width: "48.5%"
},
activities: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_32
},
settingsControls: {
marginTop: Module712.space.PX_24
}
});
export default function FamilyCenterActivityCard() {
const styles = useStyles4();
const selectedTeenUser2 = useSelectedTeenUser();
const hasActionForAnyDisplayType = useHasActionForAnyDisplayType();
if (selectedTeenUser2 === void 0) {
return null;
}
const sortedActivityTypeConfigs = getSortedActivityTypeConfigs();
return <View style={styles.card}>
<View style={styles.preface}>
<FamilyCenterActivityCardPrefaceText />
</View>
<View style={styles.container}>
<FamilyCenterActivityCardHeader />
<View style={styles.content}>
<View style={styles.totals}>
{sortedActivityTypeConfigs.filter((sortedActivityTypeConfig) => {
const [r8] = sortedActivityTypeConfig;
return r8 !== TeenActionDisplayType.GIFTS;
}).map((item, index) => {
const [displayType, , ] = item;
return <View key={`total-${displayType}`} style={index === 0 ? styles.first : styles.other}>
<FamilyCenterActivityTotal displayType={displayType} />
</View>;
})}
</View>
<FamilyCenterTopActivity />
{hasActionForAnyDisplayType ? <View style={styles.activities}>
{sortedActivityTypeConfigs.map((sortedActivityTypeConfig) => {
const [displayType, , ] = sortedActivityTypeConfig;
return <FamilyCenterActivitySection key={`section-${displayType}`} displayType={displayType} />;
})}
</View> : null}
</View>
</View>
<View style={styles.settingsControls}>
<FamilyCenterSettingsControls />
</View>
</View>;
};
export { Component as FamilyCenterActivityCardAccount };
export { FamilyCenterActivityCardHeader };
export { FamilyCenterActivityCardAccountSelect };
@@ -0,0 +1,57 @@
// Metro module 13936 (f13937).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useCollectiblesData from "../../collectibles/hooks/useCollectiblesData";
import { useTeenUserForId } from "../hooks/useSelectedTeenUser";
import { getPurchaseDisplayInfo } from "../FamilyCenterActivityPurchaseRowUtils";
import { getGiftSubtext } from "../FamilyCenterActivityGiftRowUtils";
import UserUtils from "../../../utils/UserUtils";
import FamilyCenterActivityItemPreview from "./FamilyCenterActivityItemPreview";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
alignItems: "center",
borderBottomColor: Module712.colors.BORDER_SUBTLE,
borderBottomWidth: 1,
paddingVertical: 12
},
textContainer: {
display: "flex",
flexDirection: "column",
flexShrink: 1
}
});
export default function FamilyCenterActivityGiftRow(props) {
const { skuId, subscriptionPlanId, price, gifterUserId, claimed, offeredAt, claimedAt } = props;
const styles = useStyles();
let product = useCollectiblesData(skuId).product;
const teenUserForId = useTeenUserForId(gifterUserId);
const purchaseDisplayInfo = getPurchaseDisplayInfo(product == null ? null : product, subscriptionPlanId);
const { displayName, isSubscription } = purchaseDisplayInfo;
if (skuId != null && !isSubscription && product == null) {
return null;
}
if (displayName == null) {
return null;
}
const giftSubtext = getGiftSubtext({
claimed,
price,
gifterName: teenUserForId != null ? UserUtils.getName(teenUserForId) : null,
offeredAt,
claimedAt
});
if (product == null) {
product = null;
}
return <View style={styles.container}>
<FamilyCenterActivityItemPreview displayName={displayName} product={product} isSubscription={isSubscription} subscriptionPlanId={subscriptionPlanId} />
<View style={styles.textContainer}>
<Text variant="text-md/semibold" color="interactive-text-active" ellipsizeMode="tail" lineClamp={1}>{displayName}</Text>
<Text variant="text-xs/medium" color="text-muted">{giftSubtext}</Text>
</View>
</View>;
};
@@ -0,0 +1,141 @@
// Metro module 13934 (f13935).
import { Image as Image2, View } from "react-native";
import { PROFILE_FRAME_ASPECT_RATIO } from "../../collectibles/profile_frames/native/ProfileFrameConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { getAvatarDecorationPreviewUrl, getProfileEffectPreviewUrl, PREVIEW_SIZE, isGuildBoostSubscription, NAMEPLATE_ASPECT_RATIO } from "../FamilyCenterActivityPurchaseRowUtils";
import Module712 from "../../../_bundle/Module712";
import { getNameplateAssets } from "../../collectibles/nameplates/native/NameplateUtils";
import useMaybeFetchProfileFrame from "../../collectibles/profile_frames/hooks/useMaybeFetchProfileFrame";
import ProfileFrameSamplePreview from "../../collectibles/profile_frames/native/previews/ProfileFrameSamplePreview";
import { ShopIcon } from "../../../design/components/Icon/native/redesign/generated/ShopIcon";
import { BoostGemIcon } from "../../../design/components/Icon/native/redesign/generated/BoostGemIcon";
import { NitroWheelIcon } from "../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
import { CollectiblesItemType } from "../../../_bundle/Module1901";
import { getNameplateDataFromProductRecord } from "../../collectibles/nameplates/utils";
let useStyles, NameplatePreviewImage, ProfileEffectPreviewImage, ProfileFramePreviewImage, SubscriptionPreview, CollectiblePreview;
const AvatarDecorationPreviewImage = function AvatarDecorationPreviewImage(props) {
const { product, styles } = props;
const avatarDecorationPreviewUrl = getAvatarDecorationPreviewUrl(product);
return avatarDecorationPreviewUrl != null ? <Image2 source={{
uri: avatarDecorationPreviewUrl
}} style={styles.avatarDecorationPreview} fadeDuration={0} /> : null;
};
NameplatePreviewImage = function NameplatePreviewImage(props) {
const { nameplateData, styles } = props;
const staticImageUrl = getNameplateAssets(nameplateData).staticImageUrl;
return staticImageUrl != null ? <View style={styles.nameplateContainer}>
<Image2 source={{
uri: staticImageUrl
}} style={styles.nameplatePreview} resizeMode="cover" fadeDuration={0} />
</View> : null;
};
ProfileEffectPreviewImage = function ProfileEffectPreviewImage(props) {
const { product, styles } = props;
const profileEffectPreviewUrl = getProfileEffectPreviewUrl(product);
return profileEffectPreviewUrl != null ? <Image2 source={{
uri: profileEffectPreviewUrl
}} style={styles.avatarDecorationPreview} fadeDuration={0} /> : null;
};
ProfileFramePreviewImage = function ProfileFramePreviewImage(props) {
const { product, styles } = props;
const maybeFetchProfileFrame = useMaybeFetchProfileFrame(product.skuId, "FamilyCenterActivityItemPreview");
return maybeFetchProfileFrame != null ? <View style={styles.profileFrameContainer}>
<ProfileFrameSamplePreview profileFrame={maybeFetchProfileFrame} previewWidth={PREVIEW_SIZE * PROFILE_FRAME_ASPECT_RATIO} previewHeight={PREVIEW_SIZE} profileBackgroundColor={Module712.colors.BACKGROUND_BASE_LOW} />
</View> : null;
};
SubscriptionPreview = function SubscriptionPreview(props) {
const { subscriptionPlanId, styles } = props;
if (subscriptionPlanId == null) {
return <View style={styles.purchasePlaceholder}>
<ShopIcon size="custom" style={{
width: 20,
height: 20
}} />
</View>;
}
return <View style={styles.purchasePlaceholder}>
{isGuildBoostSubscription(subscriptionPlanId) ? <BoostGemIcon size="custom" style={{
width: 20,
height: 20
}} /> : <NitroWheelIcon size="custom" style={{
width: 20,
height: 20
}} />}
</View>;
};
CollectiblePreview = function CollectiblePreview(props) {
const { product, styles } = props;
if (product == null) {
return <View style={styles.purchasePlaceholder}>
<ShopIcon size="custom" style={{
width: 20,
height: 20
}} />
</View>;
}
const type = product.type;
if (CollectiblesItemType.AVATAR_DECORATION === type) {
return <AvatarDecorationPreviewImage product={product} styles={styles} />;
}
if (CollectiblesItemType.NAMEPLATE === type) {
const nameplateDataFromProductRecord = getNameplateDataFromProductRecord(product);
return nameplateDataFromProductRecord != null ? <NameplatePreviewImage nameplateData={nameplateDataFromProductRecord} styles={styles} /> : null;
}
if (CollectiblesItemType.PROFILE_EFFECT === type) {
return <ProfileEffectPreviewImage product={product} styles={styles} />;
}
if (CollectiblesItemType.PROFILE_FRAME === type) {
return <ProfileFramePreviewImage product={product} styles={styles} />;
}
return <View style={styles.purchasePlaceholder}>
<ShopIcon size="custom" style={{
width: 20,
height: 20
}} />
</View>;
};
useStyles = createStyles({
purchasePlaceholder: {
width: PREVIEW_SIZE,
height: PREVIEW_SIZE,
borderRadius: Module712.radii.xs,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
display: "flex",
alignItems: "center",
justifyContent: "center",
marginRight: 12
},
avatarDecorationPreview: {
width: PREVIEW_SIZE,
height: PREVIEW_SIZE,
marginRight: 12
},
nameplateContainer: {
width: PREVIEW_SIZE,
height: PREVIEW_SIZE,
marginRight: 12,
borderRadius: Module712.radii.xs,
overflow: "hidden",
position: "relative"
},
nameplatePreview: {
position: "absolute",
right: 0,
width: PREVIEW_SIZE * NAMEPLATE_ASPECT_RATIO,
height: PREVIEW_SIZE
},
profileFrameContainer: {
width: PREVIEW_SIZE,
height: PREVIEW_SIZE,
marginRight: 12,
alignItems: "center",
justifyContent: "center"
}
});
export default function FamilyCenterActivityItemPreview(props) {
const { displayName, product, isSubscription, subscriptionPlanId } = props;
const styles = useStyles();
return <View accessible accessibilityLabel={displayName}>
{isSubscription ? <SubscriptionPreview subscriptionPlanId={subscriptionPlanId} styles={styles} /> : <CollectiblePreview product={product} styles={styles} />}
</View>;
};
@@ -0,0 +1,40 @@
// Metro module 13903 (f13904).
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useActiveLinkUserIds } from "../hooks/useUserLinks";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import FamilyCenterParentalConsentNotice from "./FamilyCenterParentalConsentNotice";
import FamilyCenterActivityBanner from "./FamilyCenterActivityBanner";
import FamilyCenterFeatureRow from "./FamilyCenterFeatureRow";
import FamilyCenterDataConfirmation from "./FamilyCenterDataConfirmation";
import FamilyCenterActivityCard from "./FamilyCenterActivityCard";
const useStyles = createStyles({
scrollView: {
flex: 1
},
dataConfirmation: {
marginTop: Module712.space.PX_8
},
container: {
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16
}
});
export default function FamilyCenterActivityPage() {
const styles = useStyles();
return <ScrollView style={styles.scrollView}>
<SafeAreaPaddingView bottom>
<View style={styles.container}>
<FamilyCenterParentalConsentNotice />
{useActiveLinkUserIds().length === 0 ? <>
<FamilyCenterActivityBanner />
<FamilyCenterFeatureRow />
<View style={styles.dataConfirmation}>
<FamilyCenterDataConfirmation />
</View>
</> : <FamilyCenterActivityCard />}
</View>
</SafeAreaPaddingView>
</ScrollView>;
};
@@ -0,0 +1,49 @@
// Metro module 13932 (f13933).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useCollectiblesData from "../../collectibles/hooks/useCollectiblesData";
import { getPurchaseDisplayInfo } from "../FamilyCenterActivityPurchaseRowUtils";
import { formatPrice } from "../../../utils/PriceUtils";
import FamilyCenterActivityItemPreview from "./FamilyCenterActivityItemPreview";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
alignItems: "center",
borderBottomColor: Module712.colors.BORDER_SUBTLE,
borderBottomWidth: 1,
paddingVertical: 12
},
textContainer: {
display: "flex",
flexDirection: "column",
flexShrink: 1
}
});
export default function FamilyCenterActivityPurchaseRow(props) {
const { skuId, subscriptionPlanId, total, currency } = props;
const styles = useStyles();
let product = useCollectiblesData(skuId).product;
const purchaseDisplayInfo = getPurchaseDisplayInfo(product == null ? null : product, subscriptionPlanId);
const { displayName, typeName, isSubscription } = purchaseDisplayInfo;
if (skuId != null && !isSubscription && product == null) {
return null;
}
if (displayName == null) {
return null;
}
const r28 = formatPrice(total, currency);
const r29 = typeName != null ? `${displayName} • ${typeName}` : displayName;
if (product == null) {
product = null;
}
return <View style={styles.container}>
<FamilyCenterActivityItemPreview displayName={displayName} product={product} isSubscription={isSubscription} subscriptionPlanId={subscriptionPlanId} />
<View style={styles.textContainer}>
<Text variant="text-md/semibold" color="interactive-text-active" ellipsizeMode="tail" lineClamp={1}>{r29}</Text>
<Text variant="text-xs/medium" color="text-muted">{r28}</Text>
</View>
</View>;
};
@@ -0,0 +1,164 @@
// Metro module 13931 (f13932).
import { memo } from "react";
import { View } from "react-native";
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { ACTION_TO_TEXT } from "../FamilyCenterConstants";
import { GuildFeatures } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { AVATAR_SIZE_MAP, AvatarSizes, Avatar } from "../../../design/void/native";
import Module38 from "../../../_bundle/Module38";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { Text } from "../../../design/components/Text/native/Text";
import UserUtils from "../../../utils/UserUtils";
import { formatUserActivityTimestamp, isUserAction, isGuildAction, isPurchase, isGift } from "../FamilyCenterUtils";
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
import GuildBadge from "../../guild/native/GuildBadge";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import FamilyCenterActivityPurchaseRow from "./FamilyCenterActivityPurchaseRow";
import { getGiftRowDisplayInfo } from "../FamilyCenterActivityGiftRowUtils";
import FamilyCenterActivityGiftRow from "./FamilyCenterActivityGiftRow";
let useStyles2, Component2;
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
borderBottomColor: Module712.colors.BORDER_SUBTLE,
borderBottomWidth: 1,
paddingVertical: 12
},
avatar: {
borderRadius: AVATAR_SIZE_MAP[AvatarSizes.NORMAL] / 2,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
avatarContainer: {
marginRight: 12,
alignItems: "flex-start"
},
textContainer: {
display: "flex",
flexDirection: "column",
flexShrink: 1
},
text: {
display: "flex",
flexDirection: "row",
flexShrink: 1
}
});
let Component = memo(({ action }) => {
const styles = useStyles();
const r12 = ACTION_TO_TEXT.get(action.display_type);
Module38(r12 != null, "No text for action type");
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(action.entity_id));
if (stateFromStores == null) {
return null;
}
const r17 = SnowflakeUtils.extractTimestamp(action.event_id);
return <View style={styles.container}>
<View style={styles.avatarContainer}>
<Avatar avatarStyle={styles.avatar} user={stateFromStores} guildId={void 0} disablePlaceholder avatarDecoration={stateFromStores.avatarDecoration} />
</View>
<View style={styles.textContainer}>
<Text style={styles.text} variant="text-md/semibold" color="interactive-text-active" ellipsizeMode="tail" lineClamp={1}>
{UserUtils.getName(stateFromStores)}
</Text>
<Text variant="text-xs/medium" color="channels-default">
{formatUserActivityTimestamp(new Date(r17).getTime(), r12.timestampFormatter)}
</Text>
</View>
</View>;
});
Component.displayName = "FamilyCenterActivityRowUser";
useStyles2 = createStyles({
container: {
display: "flex",
alignItems: "center",
flexDirection: "row",
borderBottomColor: Module712.colors.BORDER_SUBTLE,
borderBottomWidth: 1,
paddingVertical: 12
},
avatar: {
borderRadius: Module712.radii.md,
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
height: 40,
width: 40,
margin: 0,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
marginRight: 12
},
avatarText: {
color: Module712.colors.TEXT_DEFAULT
},
text: {
display: "flex",
flexDirection: "column",
flexShrink: 1
},
headerContainer: {
display: "flex",
flexDirection: "row"
},
badge: {
marginRight: 4
},
header: {
paddingRight: 16
},
headerAndIconContainer: {
display: "flex",
flexDirection: "row",
alignItems: "center"
}
});
Component2 = memo(({ action: action2 }) => {
const styles2 = useStyles2();
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getGuild(action2.entity_id));
Module38(ACTION_TO_TEXT.get(action2.display_type) != null, "No text for action type");
if (stateFromStores === void 0) {
return null;
}
return <View style={styles2.container}>
<GuildIcon style={styles2.avatar} textStyle={styles2.avatarText} guild={stateFromStores} size={GuildIconSizes.NORMAL} animate />
<View style={styles2.text}>
<View style={styles2.headerContainer}>
<View style={styles2.headerAndIconContainer}>
{stateFromStores.features.has(GuildFeatures.VERIFIED) || stateFromStores.features.has(GuildFeatures.PARTNERED) ? <GuildBadge style={styles2.badge} guild={stateFromStores} size={GuildBadge.Sizes.SMALL} disableColor /> : null}
<Text style={styles2.header} variant="text-md/semibold" color="interactive-text-active" ellipsizeMode="tail" lineClamp={1}>{stateFromStores.name}</Text>
</View>
</View>
{stateFromStores.approximateMemberCount !== void 0 ? <Text variant="text-xs/medium" color="channels-default">
{intl.format(FamilyCenter_messages["5JmNgg"], {
members: stateFromStores.approximateMemberCount
})}
</Text> : null}
</View>
</View>;
});
Component2.displayName = "FamilyCenterActivityRowGuild";
export default function FamilyCenterActivityRow(props) {
const action3 = props.action;
if (!isUserAction(action3) && !isGuildAction(action3) && !isPurchase(action3) && !isGift(action3)) {
return null;
}
if (isPurchase(action3)) {
const purchaseInfo = FamilyCenterStore.getPurchaseInfo(action3.entity_id);
return purchaseInfo != null ? <FamilyCenterActivityPurchaseRow skuId={purchaseInfo.sku_id} subscriptionPlanId={purchaseInfo.subscription_plan_id} total={purchaseInfo.total} currency={purchaseInfo.currency} /> : null;
}
if (isGift(action3)) {
const giftInfo = FamilyCenterStore.getGiftInfo(action3.entity_id);
if (giftInfo == null) {
return null;
}
const giftRowDisplayInfo = getGiftRowDisplayInfo(giftInfo);
const { skuId, subscriptionPlanId, price } = giftRowDisplayInfo;
return <FamilyCenterActivityGiftRow skuId={skuId} subscriptionPlanId={subscriptionPlanId} price={price} gifterUserId={giftRowDisplayInfo.gifterUserId} claimed={giftRowDisplayInfo.claimed} offeredAt={giftRowDisplayInfo.offeredAt} claimedAt={giftRowDisplayInfo.claimedAt} />;
}
return <View>
{isUserAction(action3) ? <Component action={action3} /> : <Component2 action={action3} />}
</View>;
};
@@ -0,0 +1,116 @@
// Metro module 13930 (f13931).
import { useState, useCallback } from "react";
import { ActivityIndicator, View } from "react-native";
import { FAMILY_CENTER_ITEMS_SHOWN_INCREMENTS, TeenActionDisplayType } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { getActivityTypeTextConfigs } from "../FamilyCenterUtils";
import { useActionsForDisplayType, useFormattedTotalForDisplayType, useActionTotalsForDisplayType } from "../hooks/useFamilyCenterActivities";
import { Text } from "../../../design/components/Text/native/Text";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import FamilyCenterActivityRow from "./FamilyCenterActivityRow";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
let useStyles, useStyles2;
const FamilyCenterActivitySectionHeader = function FamilyCenterActivitySectionHeader(props) {
let r31;
const displayType2 = props.displayType;
const styles = useStyles();
let r17 = useIsInAdultAgeGroup();
const r11 = getActivityTypeTextConfigs().get(displayType2);
const actionsForDisplayType = useActionsForDisplayType(displayType2);
const formattedTotalForDisplayType = useFormattedTotalForDisplayType(displayType2);
if (!(displayType2 !== TeenActionDisplayType.PURCHASES && displayType2 !== TeenActionDisplayType.GIFTS)) {
r31 = formattedTotalForDisplayType;
if (r31 === null) {
r31 = actionsForDisplayType.length;
}
} else {
r31 = actionsForDisplayType.length;
}
const r34 = r11 == null ? void 0 : r11.sectionHeader(r31);
const sectionDescription = r11?.sectionDescription;
let r38 = null;
if (sectionDescription !== void 0) {
const r39 = r11 == null;
let r40 = void 0;
if (!r39) {
if (r17 == null) {
r17 = false;
}
r40 = r11.sectionDescription(r17);
}
r38 = r40;
}
return <View>
<Text variant="text-sm/semibold" style={styles.header}>{r34}</Text>
{r38 !== null ? <Text variant="text-sm/medium" color="text-muted" style={styles.description}>{r38}</Text> : null}
</View>;
};
useStyles = createStyles({
header: {
marginBottom: Module712.space.PX_4
},
description: {
marginBottom: Module712.space.PX_8
}
});
useStyles2 = createStyles({
container: {
display: "flex"
},
loadMoreContainer: {
display: "flex",
flexDirection: "row",
flex: 1,
alignItems: "center",
justifyContent: "center",
width: "100%"
},
loadMore: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
borderBottomRightRadius: Module712.radii.sm,
borderBottomLeftRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE,
width: "60%"
},
loadMoreButton: {
paddingVertical: 4
}
});
export default function FamilyCenterActivitySection(props) {
const displayType = props.displayType;
const styles2 = useStyles2();
const actionsForDisplayType = useActionsForDisplayType(displayType);
const actionTotalsForDisplayType = useActionTotalsForDisplayType(displayType);
const familyCenterActions = useFamilyCenterActions({});
const { loadMore, isMoreLoading } = familyCenterActions;
const [state, setState] = useState(FAMILY_CENTER_ITEMS_SHOWN_INCREMENTS);
const r38 = actionsForDisplayType.slice(0, state);
const callback = useCallback(() => {
setState((prevState) => prevState + FAMILY_CENTER_ITEMS_SHOWN_INCREMENTS);
loadMore(displayType);
}, [loadMore, displayType]);
if (actionsForDisplayType.length === 0) {
return null;
}
const accessibilityLabel = intl.formatToPlainString(FamilyCenter_messages["7dMmJY"], {
pageSize: Math.min(actionTotalsForDisplayType - r38.length, FAMILY_CENTER_ITEMS_SHOWN_INCREMENTS)
});
return <View style={styles2.container}>
<FamilyCenterActivitySectionHeader displayType={displayType} />
{r38.map((item) => <FamilyCenterActivityRow key={item.event_id} action={item} />)}
{r38.length < actionTotalsForDisplayType ? <View style={styles2.loadMoreContainer}>
{isMoreLoading ? <View style={styles2.loadMore}>
<ActivityIndicator style={styles2.loadMoreButton} animating color="#fff" size="small" />
</View> : <PressableOpacity style={styles2.loadMore} accessibilityLabel={accessibilityLabel} accessibilityRole="button" onPress={callback}>
<Text style={styles2.loadMoreButton} variant="text-xs/semibold" color="text-overlay-light">{accessibilityLabel}</Text>
</PressableOpacity>}
</View> : null}
</View>;
};
@@ -0,0 +1,34 @@
// Metro module 13926 (f13927).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useActionTotalsForDisplayType, useFormattedTotalForDisplayType } from "../hooks/useFamilyCenterActivities";
import { getActivityTypeTextConfigs } from "../FamilyCenterUtils";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
display: "flex",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST,
padding: 12,
justifyContent: "center",
alignItems: "center",
borderRadius: Module712.radii.md,
...Module712.shadows.SHADOW_LEDGE
}
});
export default function FamilyCenterActivityTotal(props) {
const displayType = props.displayType;
const styles = useStyles();
const actionTotalsForDisplayType = useActionTotalsForDisplayType(displayType);
let r13 = useFormattedTotalForDisplayType(displayType);
const color = actionTotalsForDisplayType > 0 ? "text-brand" : "text-muted";
const r26 = getActivityTypeTextConfigs().get(displayType);
const r28 = r26 == null ? void 0 : r26.tooltipHeader();
if (r13 == null) {
r13 = 0;
}
return <View style={styles.container}>
<Text variant="heading-xxl/medium" color={color}>{r13}</Text>
<Text variant="text-sm/semibold">{r28}</Text>
</View>;
};
@@ -0,0 +1,33 @@
// Metro module 13953 (f13954).
import { View } from "react-native";
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import { Avatar, AvatarSizes, Icon } from "../../../design/void/native";
const useStyles = createStyles({
avatars: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.round,
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
padding: 8
},
icon: {
height: 24,
width: 24,
marginHorizontal: 16
}
});
export default function FamilyCenterAvatarPair(props) {
const { otherUser, iconSrc, iconStyles } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
return stateFromStores !== void 0 ? otherUser !== void 0 ? <View style={styles.avatars}>
<Avatar size={AvatarSizes.LARGE_48} user={stateFromStores} guildId={void 0} avatarDecoration={stateFromStores.avatarDecoration} />
<Icon style={[styles.icon, iconStyles]} size={Icon.Sizes.EXTRA_SMALL} source={iconSrc} />
<Avatar size={AvatarSizes.LARGE_48} user={otherUser} guildId={void 0} avatarDecoration={otherUser.avatarDecoration} />
</View> : null : null;
};
@@ -0,0 +1,148 @@
// Metro module 13907 (f13908).
import { useCallback, useEffect } from "react";
import { View } from "react-native";
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { CONNECT_GUARDIAN_BOTTOM_SHEET_KEY, FAMILY_CENTER_LINK_REQUEST_REGEX, FamilyCenterAction } from "../FamilyCenterConstants";
import { AnalyticEvents } from "../../../Constants";
import { NativePermissionTypes } from "../../native_permissions/NativePermissionConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useUserQRLinkUrl, useHasMaxConnections } from "../hooks/useUserLinks";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useRefreshLinkCodeOnExpiry from "../hooks/useRefreshLinkCodeOnExpiry";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { shareGuardianConnectLink } from "./shareGuardianConnectLink";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { ShareIcon } from "../../../design/components/Icon/native/redesign/generated/ShareIcon";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { QrCodeIcon } from "../../../design/components/Icon/native/redesign/generated/QrCodeIcon";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import URLUtils from "../../../utils/URLUtils";
import { handleFamilyCenterQRCodeScan } from "./FamilyCenterNativeUtils";
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
import NativePermissionUtils from "../../native_permissions/NativePermissionUtils";
let useStyles, useStyles2, FamilyCenterBannerButton;
const FamilyCenterTeenQRCodeButtonInner = function FamilyCenterTeenQRCodeButtonInner() {
let getLinkCode, getLinkCode2, stateFromStores, stateFromStores2, stateFromStores3;
const styles = useStyles();
const callback = useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
}, []);
getLinkCode = useFamilyCenterActions().getLinkCode;
getLinkCode2 = useFamilyCenterActions({
onError: callback
}).getLinkCode;
stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
stateFromStores2 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCode());
stateFromStores3 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getLinkCodeExpiresAt());
const userQRLinkUrl = useUserQRLinkUrl();
useEffect(() => {
getLinkCode();
}, []);
useRefreshLinkCodeOnExpiry(stateFromStores3, getLinkCode);
const disabled = userQRLinkUrl == null || stateFromStores2 == null || stateFromStores3 == null;
const callback2 = useCallback(() => {
if (stateFromStores != null && stateFromStores2 != null) {
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.ShareLink
});
shareGuardianConnectLink(stateFromStores, stateFromStores2);
}
}, [stateFromStores, stateFromStores2]);
const callback3 = useCallback(() => {
if (stateFromStores2 != null && stateFromStores3 != null) {
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.ShowQRCodeModal
});
ActionSheetActionCreators.openLazy(import("./ConnectGuardianBottomSheet"), CONNECT_GUARDIAN_BOTTOM_SHEET_KEY, {
linkCode: stateFromStores2,
expiresAt: stateFromStores3,
onRefresh: getLinkCode2
});
}
}, [stateFromStores2, stateFromStores3, getLinkCode2]);
return <Stack direction="horizontal" spacing={Module712.space.PX_8} style={styles.container}>
<Button grow shrink size="md" variant="primary" text={intl.string(t.Ej3B3Y)} disabled={disabled} onPress={callback2} icon={<ShareIcon size="sm" color="control-primary-text-default" />} iconPosition="start" />
<Button grow shrink size="md" variant="secondary" text={intl.string(FamilyCenter_messages.wd4yrz)} disabled={disabled} onPress={callback3} icon={<QrCodeIcon size="sm" color="control-secondary-text-default" />} iconPosition="start" />
</Stack>;
};
FamilyCenterBannerButton = function FamilyCenterBannerButton(props) {
const { onPress: onPress2, text, loading } = props;
const styles2 = useStyles2();
return <View style={styles2.button}>
<Button grow shrink size="md" variant="primary" text={text} onPress={onPress2} loading={loading} icon={<QrCodeIcon style={styles2.art} size="custom" color="white" />} iconPosition="start" />
</View>;
};
useStyles = createStyles({
container: {
marginTop: Module712.space.PX_16
}
});
useStyles2 = createStyles({
button: {
height: 50,
width: "100%",
marginTop: 16
},
art: {
width: 18,
height: 18,
marginRight: 6
}
});
export default FamilyCenterBannerButton;
export function FamilyCenterTeenQRCodeButton() {
return useHasMaxConnections() ? null : <FamilyCenterTeenQRCodeButtonInner />;
}
export function FamilyCenterParentQRCodeButton() {
const handleQrCodeScanSucess2 = function handleQrCodeScanSucess(a0) {
ModalActionCreators.pop();
let r15 = URLUtils.toURLSafe(a0);
if (r15 == null) {
r15 = {};
}
const { hostname, pathname } = r15;
const r1 = hostname != null;
let r0 = null;
if (r1) {
const r18 = pathname != null;
r0 = null;
if (r18) {
const isDiscordHostname = URLUtils.isDiscordHostname(hostname);
r0 = null;
if (isDiscordHostname) {
const r25 = pathname.match(FAMILY_CENTER_LINK_REQUEST_REGEX);
let r26 = null;
if (r25 !== null) {
handleFamilyCenterQRCodeScan(pathname, "FamilyCenterQRCodeScan");
r26 = void 0;
}
r0 = r26;
}
}
}
return r0;
};
if (useHasMaxConnections()) {
return null;
}
return <FamilyCenterBannerButton text={intl.string(FamilyCenter_messages.z4a9HP)} onPress={() => {
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.ScanQRCodeButton
});
NativePermissionUtils.requestPermission(isMetaQuest() ? NativePermissionTypes.HEADSET_CAMERA : NativePermissionTypes.CAMERA).then((result) => {
if (result) {
ModalActionCreators.pushLazy(import("../../../components_native/QRScannerModal"), {
showHelp: false,
onScanSuccess: handleQrCodeScanSucess2
});
}
});
}} />;
}
@@ -0,0 +1,96 @@
// Metro module 11112 (f11113).
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../design/components/Text/native/Text";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { UserPlusIcon } from "../../../design/components/Icon/native/redesign/generated/UserPlusIcon";
import { ServerIcon } from "../../../design/components/Icon/native/redesign/generated/ServerIcon";
import { ForumIcon } from "../../../design/components/Icon/native/redesign/generated/ForumIcon";
import { PhoneIcon } from "../../../design/components/Icon/native/redesign/generated/PhoneIcon";
import { CreditCardIcon } from "../../../design/components/Icon/native/redesign/generated/CreditCardIcon";
import { GiftIcon } from "../../../design/components/Icon/native/redesign/generated/GiftIcon";
import { FlagIcon } from "../../../design/components/Icon/native/redesign/generated/FlagIcon";
import { ClockIcon } from "../../../design/components/Icon/native/redesign/generated/ClockIcon";
import { PiggyBankIcon } from "../../../design/components/Icon/native/redesign/generated/PiggyBankIcon";
import { SettingsIcon } from "../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
const RowGroup = function RowGroup(props) {
return <Stack spacing={8}>
<Text accessibilityRole="header" variant="text-sm/semibold" color="text-muted">{props.title}</Text>
<TableRowGroup hasIcons>
{props.rows.map((row) => {
const header = row.header;
return <TableRow key={header} label={header} subLabel={row.description} icon={<TableRow.Icon variant={row.negative === true ? "text-status-dnd" : "default"} IconComponent={row.IconComponent} />} />;
})}
</TableRowGroup>
</Stack>;
};
export default function FamilyCenterDataConfirmation() {
const title3 = intl.string(FamilyCenter_messages.CI1Env);
const title2 = intl.string(FamilyCenter_messages["ksze+o"]);
const title = intl.string(FamilyCenter_messages["n73g+V"]);
const ageSpecificText5 = useAgeSpecificText(intl.string(FamilyCenter_messages["5x3taM"]), intl.string(FamilyCenter_messages.WZwGFX));
const ageSpecificText4 = useAgeSpecificText(intl.string(FamilyCenter_messages.FcKkcr), intl.string(FamilyCenter_messages.PQtDFk));
const ageSpecificText3 = useAgeSpecificText(intl.string(FamilyCenter_messages["dES/2r"]), intl.string(FamilyCenter_messages.ep6mdN));
const ageSpecificText2 = useAgeSpecificText(intl.string(FamilyCenter_messages.GWPcQg), intl.string(FamilyCenter_messages.yFnKIg));
const ageSpecificText = useAgeSpecificText(intl.string(FamilyCenter_messages["30+sih"]), intl.string(FamilyCenter_messages["0cuLn1"]));
const ageSpecificText6 = useAgeSpecificText(intl.string(FamilyCenter_messages.tHTyRh), intl.string(FamilyCenter_messages.TeNlMb));
const ageSpecificText7 = useAgeSpecificText(intl.string(FamilyCenter_messages.PfveQ6), intl.string(FamilyCenter_messages["f7ofm/"]));
const ageSpecificText8 = useAgeSpecificText(intl.string(FamilyCenter_messages.MKeCj3), intl.string(FamilyCenter_messages.HdcGGl));
const ageSpecificText9 = useAgeSpecificText(intl.string(FamilyCenter_messages.wZejZr), intl.string(FamilyCenter_messages.tdgcf1));
const ageSpecificText10 = useAgeSpecificText(intl.string(FamilyCenter_messages.ASf7XN), intl.string(FamilyCenter_messages["82y87X"]));
const ageSpecificText11 = useAgeSpecificText(intl.string(FamilyCenter_messages["0QDVFN"]), intl.string(FamilyCenter_messages["1xBHHV"]));
return <Stack spacing={24}>
<RowGroup title={title3} rows={[{
header: intl.string(FamilyCenter_messages["/zMYZX"]),
description: ageSpecificText5,
IconComponent: UserPlusIcon
}, {
header: intl.string(FamilyCenter_messages["44NEx6"]),
description: ageSpecificText4,
IconComponent: ServerIcon
}, {
header: intl.string(FamilyCenter_messages["Z3G+8h"]),
description: intl.string(FamilyCenter_messages.KBgArX),
IconComponent: ForumIcon
}, {
header: intl.string(FamilyCenter_messages.GNs2ZH),
description: intl.string(FamilyCenter_messages.Ief2xc),
IconComponent: PhoneIcon
}, {
header: intl.string(FamilyCenter_messages.PjM3r5),
description: ageSpecificText3,
IconComponent: CreditCardIcon
}, {
header: intl.string(FamilyCenter_messages.Fv3n8L),
description: ageSpecificText2,
IconComponent: GiftIcon
}, {
header: ageSpecificText,
description: ageSpecificText6,
IconComponent: FlagIcon
}]} />
<RowGroup title={title2} rows={[{
header: intl.string(FamilyCenter_messages.kyT6pZ),
description: ageSpecificText7,
IconComponent: ClockIcon
}, {
header: intl.string(FamilyCenter_messages["52ld7c"]),
description: ageSpecificText8,
IconComponent: PiggyBankIcon
}, {
header: intl.string(FamilyCenter_messages.UCuHM8),
description: ageSpecificText9,
IconComponent: SettingsIcon
}]} />
<RowGroup title={title} rows={[{
header: ageSpecificText10,
description: ageSpecificText11,
IconComponent: XSmallIcon,
negative: true
}]} />
</Stack>;
};
@@ -0,0 +1,23 @@
// Metro module 13947 (f13948).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module13948 from "../../../_bundle/Module13948";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
art: {
marginBottom: 10,
width: 243
},
empty: {
display: "flex",
alignItems: "center"
}
});
export default function FamilyCenterEmpty(props) {
const text = props.text;
const styles = useStyles();
return <View style={styles.empty}>
<Image2 source={Module13948} style={styles.art} resizeMethod="scale" />
<Text variant="text-sm/medium" color="text-muted">{text}</Text>
</View>;
};
@@ -0,0 +1,58 @@
// Metro module 13916 (f13917).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import Module13917 from "../../../_bundle/Module13917";
import { ChatCheckIcon } from "../../../design/components/Icon/native/redesign/generated/ChatCheckIcon";
import Module11475 from "../../../_bundle/Module11475";
import { EyeIcon } from "../../../design/components/Icon/native/redesign/generated/EyeIcon";
import Module12239 from "../../../_bundle/Module12239";
import { QrCodeIcon } from "../../../design/components/Icon/native/redesign/generated/QrCodeIcon";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../design/components/Text/native/Text";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
const useStyles = createStyles({
tableGroup: {
marginTop: 20,
marginBottom: Module712.space.PX_24
}
});
export default function FamilyCenterFeatureRows() {
const styles = useStyles();
const ageSpecificText = useAgeSpecificText(intl.string(FamilyCenter_messages.qITXhY), intl.string(FamilyCenter_messages.bmhCnL));
const ageSpecificText2 = useAgeSpecificText(intl.string(FamilyCenter_messages.t7SkFy), intl.string(FamilyCenter_messages["68zfxD"]));
const ageSpecificText3 = useAgeSpecificText(intl.string(FamilyCenter_messages["+pi4Yt"]), intl.string(FamilyCenter_messages["1xPTwE"]));
const r84 = [{
icon: Module13917,
IconComponent: ChatCheckIcon,
header: intl.string(FamilyCenter_messages["001l3m"]),
description: ageSpecificText
}, {
icon: Module11475,
IconComponent: EyeIcon,
header: intl.string(FamilyCenter_messages.yipAeP),
description: ageSpecificText2
}, {
icon: Module12239,
IconComponent: QrCodeIcon,
header: intl.string(FamilyCenter_messages.hhOuMe),
description: ageSpecificText3
}];
return <View style={styles.tableGroup}>
<Stack spacing={8}>
<Text accessibilityRole="header" variant="text-sm/semibold" color="text-muted">
{intl.string(FamilyCenter_messages["6JkHSg"])}
</Text>
<TableRowGroup hasIcons>
{r84.map((item) => {
const header = item.header;
return <TableRow key={header} label={header} subLabel={item.description} icon={<TableRow.Icon source={item.icon} IconComponent={item.IconComponent} />} />;
})}
</TableRowGroup>
</Stack>
</View>;
};
@@ -0,0 +1,30 @@
// Metro module 13905 (f13906).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { WarningIcon } from "../../../design/components/Icon/native/redesign/generated/WarningIcon";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
flexDirection: "row",
alignItems: "flex-start",
gap: Module712.space.PX_8,
padding: Module712.space.PX_12,
borderWidth: 1,
borderColor: Module712.colors.BORDER_FEEDBACK_WARNING,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_WARNING
},
text: {
flex: 1,
paddingRight: Module712.space.PX_8
}
});
export default function FamilyCenterInlineWarningNotice(props) {
const { text, style } = props;
const styles = useStyles();
return <View style={[styles.container, style]}>
<WarningIcon size="sm" color={Module712.colors.ICON_FEEDBACK_WARNING} />
<Text variant="text-sm/medium" color="text-strong" style={styles.text}>{text}</Text>
</View>;
};
@@ -0,0 +1,21 @@
// Metro module 13949 (f13950).
import { View } from "react-native";
import { UserLinkStatus } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import FamilyCenterLinkWrapper from "./FamilyCenterLinkWrapper";
import FamilyCenterRequestorDetails from "./FamilyCenterRequestorDetails";
const useStyles = createStyles({
actionContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-end",
height: "100%"
}
});
export default function FamilyCenterLinkRow(props) {
const { otherUser, actions } = props;
return <FamilyCenterLinkWrapper userId={otherUser.id}>
<FamilyCenterRequestorDetails otherUser={otherUser} status={UserLinkStatus.PENDING} />
<View style={useStyles().actionContainer}>{actions}</View>
</FamilyCenterLinkWrapper>;
};
@@ -0,0 +1,29 @@
// Metro module 13950 (f13951).
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import showUserProfileActionSheet from "../../user_profile/native/showUserProfileActionSheet";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
alignItems: "center",
paddingTop: 14,
paddingBottom: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_12
}
});
export default function FamilyCenterLinkRowWrapper(props) {
const { userId, children } = props;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
return userId !== void 0 ? <PressableOpacity style={styles.container} onPress={function onPress() {
showUserProfileActionSheet({
userId,
disableCalls: true,
disableMessage: true,
sourceAnalyticsLocations: analyticsLocations
});
}}>{children}</PressableOpacity> : null;
};
@@ -0,0 +1,117 @@
// Metro module 13944 (f13945).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import Module13945 from "../../../_bundle/Module13945";
import { Text } from "../../../design/components/Text/native/Text";
import { FamilyCenterParentQRCodeButton, FamilyCenterTeenQRCodeButton } from "./FamilyCenterBannerButton";
let useStyles, useStyles2, useStyles3, FamilyCenterLinkingBannerTeenContent, useStyles4, FamilyCenterLinkingInstructionsRow;
const FamilyCenterLinkingBannerParentContent = function FamilyCenterLinkingBannerParentContent() {
return <View style={useStyles2().container}>
<FamilyCenterLinkingInstructionsRow index={1} header={intl.string(FamilyCenter_messages["7xxAni"])} description={intl.string(FamilyCenter_messages["1M9So2"])} />
<FamilyCenterLinkingInstructionsRow index={2} header={intl.string(FamilyCenter_messages["AXgx+a"])} description={intl.string(FamilyCenter_messages.GzMFnb)} />
<FamilyCenterLinkingInstructionsRow index={3} header={intl.string(FamilyCenter_messages.MZn1tG)} description={intl.string(FamilyCenter_messages["8rLBxD"])} isLast />
<FamilyCenterParentQRCodeButton />
</View>;
};
FamilyCenterLinkingBannerTeenContent = function FamilyCenterLinkingBannerTeenContent() {
return <View style={useStyles3().container}>
<FamilyCenterTeenQRCodeButton />
</View>;
};
FamilyCenterLinkingInstructionsRow = function FamilyCenterLinkingInstructionsRow(props) {
const { header, description, index, isLast } = props;
const styles4 = useStyles4();
return <View style={styles4.row}>
<View style={styles4.circle}>
<Text variant="heading-md/semibold" color="text-brand">{index}</Text>
</View>
<View style={[styles4.rowContent, isLast ? null : styles4.gap]}>
<Text variant="heading-sm/bold">{header}</Text>
<Text variant="text-sm/medium" color="text-muted">{description}</Text>
</View>
</View>;
};
useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
marginTop: Module712.space.PX_16,
paddingTop: 0,
paddingBottom: Module712.space.PX_16,
alignItems: "center",
borderRadius: Module712.radii.md,
elevation: 2,
overflow: "hidden"
},
content: {
padding: Module712.space.PX_16
},
art: {
width: "100%",
height: 175,
marginBottom: Module712.space.PX_12
},
header: {
marginBottom: Module712.space.PX_8
}
});
useStyles2 = createStyles({
container: {
marginTop: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_16,
width: "100%"
}
});
useStyles3 = createStyles({
container: {
width: "100%",
paddingHorizontal: Module712.space.PX_16
}
});
useStyles4 = createStyles({
row: {
display: "flex",
flexDirection: "row",
alignItems: "flex-start"
},
gap: {
marginBottom: 12
},
circle: {
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
overflow: "hidden",
width: 32,
height: 32,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL
},
rowContent: {
marginLeft: 12,
flex: 1
}
});
export default function FamilyCenterLinkingBanner() {
const styles = useStyles();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
return <View style={styles.container}>
<Image2 source={Module13945} style={styles.art} resizeMethod="resize" />
<View style={styles.content}>
<Text style={styles.header} variant="heading-lg/semibold">
{useAgeSpecificText(intl.string(FamilyCenter_messages.zUCWEL), intl.string(FamilyCenter_messages.B0NPbp))}
</Text>
<Text variant="text-sm/medium" color="text-muted">
{useAgeSpecificText(intl.format(FamilyCenter_messages.yMnoDl, {
link: "https://support.discord.com/hc/articles/14155060633623"
}), intl.string(FamilyCenter_messages.JsAEDi))}
</Text>
</View>
{isInAdultAgeGroup ? <FamilyCenterLinkingBannerParentContent /> : <FamilyCenterLinkingBannerTeenContent />}
</View>;
};
@@ -0,0 +1,100 @@
// Metro module 13956 (f13957).
import { useCallback, useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import FamilyCenterAvatarPair from "./FamilyCenterAvatarPair";
import Module4134 from "../../../_bundle/Module4134";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenter_messages from "../FamilyCenter.messages";
import FamilyCenterUsernameHeader from "./FamilyCenterUsernameHeader";
import FamilyCenterDataConfirmation from "./FamilyCenterDataConfirmation";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const FamilyCenterModalAcceptScreen = function FamilyCenterModalAcceptScreen(props) {
let acceptLinkRequest;
const otherUser = props.otherUser;
acceptLinkRequest = void 0;
const styles = useStyles();
const familyCenterActions = useFamilyCenterActions({
onSuccess: useCallback(() => {
ModalActionCreators.pop();
}, []),
onError: useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
}, [])
});
acceptLinkRequest = familyCenterActions.acceptLinkRequest;
const isAcceptLoading = familyCenterActions.isAcceptLoading;
const callback = useCallback(() => {
acceptLinkRequest(otherUser.id);
}, [acceptLinkRequest, otherUser.id]);
return <ModalScreen>
<ModalContent>
<View style={styles.header}>
<FamilyCenterAvatarPair otherUser={otherUser} iconSrc={Module4134} iconStyles={styles.icon} />
<Text style={styles.headerText} variant="text-lg/bold">
{intl.string(FamilyCenter_messages.rlNJwZ)}
</Text>
<FamilyCenterUsernameHeader user={otherUser} />
</View>
<FamilyCenterDataConfirmation />
<Text style={styles.disclaimer} variant="text-xs/normal" color="text-default">
{intl.format(FamilyCenter_messages.snlFqR, {
username: otherUser.username
})}
</Text>
</ModalContent>
<ModalFooter>
<ButtonGroup>
<Button variant="primary" disabled={isAcceptLoading} loading={isAcceptLoading} text={intl.string(FamilyCenter_messages["wI/jo3"])} onPress={callback} />
<Button variant="tertiary" text={intl.string(t["ETE/oC"])} onPress={ModalActionCreators.pop} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
useStyles = createStyles({
header: {
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: Module712.space.PX_16
},
headerText: {
marginTop: Module712.space.PX_16,
marginBottom: Module712.space.PX_4
},
icon: {
transform: [{
rotate: "45deg"
}],
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
disclaimer: {
marginTop: Module712.space.PX_12
}
});
export default function FamilyCenterModalAccept(props) {
const otherUser2 = props.otherUser;
return <Modal initialRouteName="ACCEPT" screens={useMemo(() => {
const otherUser3 = otherUser2;
return {
ACCEPT: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <FamilyCenterModalAcceptScreen otherUser={otherUser3} />
}
};
}, [otherUser2])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,88 @@
// Metro module 13958 (f13959).
import { useCallback, useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import Module38 from "../../../_bundle/Module38";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import FamilyCenterAvatarPair from "./FamilyCenterAvatarPair";
import Module7699 from "../../../_bundle/Module7699";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenter_messages from "../FamilyCenter.messages";
import FamilyCenterUsernameHeader from "./FamilyCenterUsernameHeader";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const FamilyCenterModalCancelScreen = function FamilyCenterModalCancelScreen(props) {
let cancelLinkRequest;
const otherUser = props.otherUser;
cancelLinkRequest = void 0;
const styles = useStyles();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const familyCenterActions = useFamilyCenterActions({
onSuccess: useCallback(() => {
ModalActionCreators.pop();
}, []),
onError: useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
}, [])
});
cancelLinkRequest = familyCenterActions.cancelLinkRequest;
const isCancelLoading = familyCenterActions.isCancelLoading;
const callback = useCallback(() => {
cancelLinkRequest(otherUser.id);
}, [cancelLinkRequest, otherUser.id]);
Module38(isInAdultAgeGroup, "FamilyCenterCancelModal should only be rendered for parents.");
return <ModalScreen>
<ModalContent>
<View style={styles.header}>
<FamilyCenterAvatarPair otherUser={otherUser} iconSrc={Module7699} />
<Text style={styles.headerText} variant="text-lg/bold">
{intl.string(FamilyCenter_messages.HynllX)}
</Text>
<FamilyCenterUsernameHeader user={otherUser} />
</View>
</ModalContent>
<ModalFooter>
<ButtonGroup>
<Button variant="destructive" disabled={isCancelLoading} loading={isCancelLoading} text={intl.string(FamilyCenter_messages.mK40bk)} onPress={callback} />
<Button variant="tertiary" text={intl.string(FamilyCenter_messages.czincX)} onPress={ModalActionCreators.pop} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
useStyles = createStyles({
header: {
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: Module712.space.PX_16
},
headerText: {
marginTop: Module712.space.PX_16,
marginBottom: Module712.space.PX_4
}
});
export default function FamilyCenterModalCancel(props) {
const otherUser2 = props.otherUser;
return <Modal initialRouteName="CANCEL" screens={useMemo(() => {
const otherUser3 = otherUser2;
return {
CANCEL: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <FamilyCenterModalCancelScreen otherUser={otherUser3} />
}
};
}, [otherUser2])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,135 @@
// Metro module 13922 (f13923).
import { useMemo } from "react";
import { View } from "react-native";
import { TeenActionDisplayType } from "../FamilyCenterConstants";
import { ChatIcon } from "../../../design/components/Icon/native/redesign/generated/ChatIcon";
import { PhoneIcon } from "../../../design/components/Icon/native/redesign/generated/PhoneIcon";
import { FriendsIcon } from "../../../design/components/Icon/native/redesign/generated/FriendsIcon";
import { ServerGridIcon } from "../../../design/components/Icon/native/redesign/generated/ServerGridIcon";
import { ThreadIcon } from "../../../design/components/Icon/native/redesign/generated/ThreadIcon";
import { CreditCardIcon } from "../../../design/components/Icon/native/redesign/generated/CreditCardIcon";
import { ClockIcon } from "../../../design/components/Icon/native/redesign/generated/ClockIcon";
import { GiftIcon } from "../../../design/components/Icon/native/redesign/generated/GiftIcon";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { Text } from "../../../design/components/Text/native/Text";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { getSortedActivityTypeConfigs } from "../FamilyCenterUtils";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let c9713_7, useStyles, useStyles2, FamilyCenterModalDataTooltipScreen;
const Row = function Row(props) {
const { header, description, IconComponent } = props;
const styles = useStyles();
return <View style={styles.row}>
<View style={styles.iconContainer}>
<IconComponent style={styles.icon} />
</View>
<View style={styles.content}>
<Text style={styles.header} variant="text-sm/bold" color="mobile-text-heading-primary">{header}</Text>
<Text variant="text-xs/medium" color="text-default">{description}</Text>
</View>
</View>;
};
FamilyCenterModalDataTooltipScreen = function FamilyCenterModalDataTooltipScreen() {
const styles2 = useStyles2();
const ageSpecificText = useAgeSpecificText(intl.string(FamilyCenter_messages.n6LOrh), intl.string(FamilyCenter_messages.JNLpDZ));
let c20784_0 = useIsInAdultAgeGroup();
return <ModalScreen>
<ModalContent>
<View style={styles2.container}>
<Text style={styles2.groupHeader} variant="text-lg/bold" color="mobile-text-heading-primary">{ageSpecificText}</Text>
{getSortedActivityTypeConfigs().map((item) => {
const [key, r9] = item;
const props = {
IconComponent: c9713_7[key],
header: r9.tooltipHeader(),
description: null
};
const tooltipDescription = r9.tooltipDescription;
let r37 = c20784_0;
if (r37 == null) {
r37 = void 0;
}
props.description = tooltipDescription.call(r9, r37);
return <Row key={key} {...props} />;
})}
</View>
</ModalContent>
<ModalFooter>
<Button variant="primary" text={intl.string(t["NX+WJN"])} onPress={ModalActionCreators.pop} />
</ModalFooter>
</ModalScreen>;
};
const r28 = {};
r28[TeenActionDisplayType.USER_INTERACTION] = ChatIcon;
r28[TeenActionDisplayType.USER_CALLED] = PhoneIcon;
r28[TeenActionDisplayType.USER_ADD] = FriendsIcon;
r28[TeenActionDisplayType.GUILD_ADD] = ServerGridIcon;
r28[TeenActionDisplayType.GUILD_INTERACTION] = ThreadIcon;
r28[TeenActionDisplayType.PURCHASES] = CreditCardIcon;
r28[TeenActionDisplayType.TOTAL_VOICE_MINUTES] = ClockIcon;
r28[TeenActionDisplayType.GIFTS] = GiftIcon;
c9713_7 = r28;
useStyles = createStyles({
row: {
display: "flex",
flexDirection: "row",
width: "100%",
alignItems: "center",
marginBottom: Module712.space.PX_8,
paddingVertical: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_12,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.sm
},
content: {
flexShrink: 1
},
iconContainer: {
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 40,
height: 40,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: Module712.radii.round,
flexShrink: 0,
marginRight: Module712.space.PX_12
},
header: {
marginBottom: Module712.space.PX_4
},
icon: {
tintColor: Module712.colors.TEXT_BRAND
}
});
useStyles2 = createStyles({
container: {
display: "flex",
alignItems: "center",
paddingHorizontal: Module712.space.PX_16,
width: "100%"
},
groupHeader: {
marginBottom: Module712.space.PX_24
}
});
export default function FamilyCenterModalDataTooltip() {
return <Modal initialRouteName="DATA_TOOLTIP" screens={useMemo(() => ({
DATA_TOOLTIP: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <FamilyCenterModalDataTooltipScreen />
}
}), [])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,104 @@
// Metro module 13957 (f13958).
import { useCallback, useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import Module38 from "../../../_bundle/Module38";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import FamilyCenterAvatarPair from "./FamilyCenterAvatarPair";
import Module7699 from "../../../_bundle/Module7699";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenter_messages from "../FamilyCenter.messages";
import FamilyCenterUsernameHeader from "./FamilyCenterUsernameHeader";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const FamilyCenterModalDeclineScreen = function FamilyCenterModalDeclineScreen(props) {
let declineLinkRequest;
const otherUser = props.otherUser;
declineLinkRequest = void 0;
const styles = useStyles();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const familyCenterActions = useFamilyCenterActions({
onSuccess: useCallback(() => {
ModalActionCreators.pop();
}, []),
onError: useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
}, [])
});
declineLinkRequest = familyCenterActions.declineLinkRequest;
const isDeclineLoading = familyCenterActions.isDeclineLoading;
const callback = useCallback(() => {
declineLinkRequest(otherUser.id);
}, [declineLinkRequest, otherUser.id]);
Module38(!isInAdultAgeGroup, "FamilyCenterDeclineLinkModal should only be rendered for teens.");
return <ModalScreen>
<ModalContent>
<View style={styles.header}>
<FamilyCenterAvatarPair otherUser={otherUser} iconSrc={Module7699} />
<Text style={styles.headerText} variant="text-lg/bold">
{intl.string(FamilyCenter_messages.teIRCR)}
</Text>
<FamilyCenterUsernameHeader user={otherUser} />
</View>
<View style={styles.body}>
<Text style={styles.noticeHeader} variant="eyebrow" color="mobile-text-heading-primary">
{intl.string(FamilyCenter_messages.cXgKMD)}
</Text>
<Text variant="text-sm/normal" color="text-default">
{intl.string(FamilyCenter_messages.LcM8BS)}
</Text>
</View>
</ModalContent>
<ModalFooter>
<ButtonGroup>
<Button variant="destructive" disabled={isDeclineLoading} loading={isDeclineLoading} text={intl.string(FamilyCenter_messages.dKxFcn)} onPress={callback} />
<Button variant="tertiary" text={intl.string(t["ETE/oC"])} onPress={ModalActionCreators.pop} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
useStyles = createStyles({
header: {
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: Module712.space.PX_16
},
headerText: {
marginTop: Module712.space.PX_16,
marginBottom: Module712.space.PX_4
},
body: {
padding: Module712.space.PX_24,
borderRadius: Module712.radii.md,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
noticeHeader: {
marginBottom: Module712.space.PX_4
}
});
export default function FamilyCenterModalDecline(props) {
const otherUser2 = props.otherUser;
return <Modal initialRouteName="DECLINE" screens={useMemo(() => {
const otherUser3 = otherUser2;
return {
DECLINE: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <FamilyCenterModalDeclineScreen otherUser={otherUser3} />
}
};
}, [otherUser2])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,142 @@
// Metro module 13952 (f13953).
import { useCallback, useState, useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import UserUtils from "../../../utils/UserUtils";
import { useRequiresParentalConsent } from "../hooks/useUserLinks";
import { presentFailedToast } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import FamilyCenterAvatarPair from "./FamilyCenterAvatarPair";
import Module7699 from "../../../_bundle/Module7699";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenterInlineWarningNotice from "./FamilyCenterInlineWarningNotice";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Checkbox } from "../../../design/components/Checkbox/native/Checkbox.native";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let useStyles;
const FamilyCenterModalDisconnectScreen = function FamilyCenterModalDisconnectScreen(props) {
let setState, setState2, disconnectLinkRequest, isDisconnectLoading;
const otherUser = props.otherUser;
setState = void 0;
setState2 = void 0;
disconnectLinkRequest = void 0;
isDisconnectLoading = void 0;
const styles = useStyles();
const callback = useCallback(() => {
ModalActionCreators.pop();
}, []);
const name = UserUtils.useName(otherUser);
const requiresParentalConsent = useRequiresParentalConsent(otherUser.id);
let checked;
[checked, setState] = useState(false);
let checked2;
[checked2, setState2] = useState(false);
const familyCenterActions = useFamilyCenterActions({
onSuccess: callback,
onError: useCallback(() => {
presentFailedToast(intl.string(t.R0RpRX));
setState(false);
setState2(false);
}, [])
});
disconnectLinkRequest = familyCenterActions.disconnectLinkRequest;
isDisconnectLoading = familyCenterActions.isDisconnectLoading;
const ageSpecificText4 = useAgeSpecificText(intl.format(FamilyCenter_messages.F2lccv, {
username: name
}), intl.string(FamilyCenter_messages["WH+Gba"]));
const ageSpecificText3 = useAgeSpecificText(intl.string(FamilyCenter_messages.hOEHFn), intl.format(FamilyCenter_messages.Or6hgl, {
username: name
}));
const ageSpecificText5 = useAgeSpecificText(intl.format(FamilyCenter_messages.XyRW4c, {
username: name
}), intl.format(FamilyCenter_messages.PlrZal, {
username: name
}));
const ageSpecificText2 = useAgeSpecificText(intl.string(FamilyCenter_messages.eiABQz), intl.string(FamilyCenter_messages.PGQBnk));
const ageSpecificText = useAgeSpecificText(intl.string(FamilyCenter_messages.sCbKs4), intl.string(FamilyCenter_messages["0ki7+P"]));
const callback2 = useCallback(() => {
disconnectLinkRequest(otherUser.id);
}, [disconnectLinkRequest, otherUser.id]);
const callback3 = useCallback((a0) => {
if (!isDisconnectLoading) {
setState(a0);
}
}, [isDisconnectLoading]);
const callback4 = useCallback((a0) => {
if (!isDisconnectLoading) {
setState2(a0);
}
}, [isDisconnectLoading]);
return <ModalScreen>
<ModalContent>
<View style={styles.header}>
<FamilyCenterAvatarPair otherUser={otherUser} iconSrc={Module7699} />
<Text style={styles.title} variant="text-lg/bold">
{intl.format(FamilyCenter_messages.o0JXuK, {
username: name
})}
</Text>
<Text style={styles.subtitle} variant="text-sm/bold" color="text-default">{ageSpecificText4}</Text>
</View>
{requiresParentalConsent && <FamilyCenterInlineWarningNotice style={styles.warning} text={ageSpecificText3} />}
<Text style={styles.body} variant="text-md/normal" color="text-default">{ageSpecificText5}</Text>
<Stack spacing={Module712.space.PX_12}>
<Checkbox label={ageSpecificText2} checked={checked} onToggle={callback3} />
<Checkbox label={ageSpecificText} checked={checked2} onToggle={callback4} />
</Stack>
</ModalContent>
<ModalFooter>
<ButtonGroup>
<Button variant="destructive" disabled={(checked ? !checked2 : !checked) || isDisconnectLoading} loading={isDisconnectLoading} text={intl.string(FamilyCenter_messages["c5L+sl"])} onPress={callback2} />
<Button variant="tertiary" text={intl.string(t["3ilveh"])} onPress={ModalActionCreators.pop} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
useStyles = createStyles({
header: {
display: "flex",
alignItems: "center",
justifyContent: "center",
marginBottom: Module712.space.PX_16
},
title: {
marginTop: Module712.space.PX_24,
textAlign: "center"
},
subtitle: {
marginTop: Module712.space.PX_8,
textAlign: "center"
},
warning: {
marginBottom: Module712.space.PX_12
},
body: {
marginBottom: Module712.space.PX_24
}
});
export default function FamilyCenterModalDisconnect(props) {
const otherUser2 = props.otherUser;
return <Modal initialRouteName="DISCONNECT" screens={useMemo(() => {
const otherUser3 = otherUser2;
return {
DISCONNECT: {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => <FamilyCenterModalDisconnectScreen otherUser={otherUser3} />
}
};
}, [otherUser2])} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,656 @@
// Metro module 11108 (f11109).
import { useCallback, useEffect, useRef, useMemo } from "react";
import { View, Image } from "react-native";
import UserStore from "../../../stores/UserStore";
import { FAMILY_CENTER_LINK_REQUEST_ERROR_EXPERIENCES, FamilyCenterIconType, FamilyCenterFailureCode, FAMILY_CENTER_AGE_VERIFICATION_RESUME_TIMEOUT } from "../FamilyCenterConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import { FamilyCenterModalRequestSections, resolveConnectionPrereqTarget } from "../FamilyCenterModalRequestRouting";
import { getFailureCodeForAPIError } from "../FamilyCenterUtils";
import { useFamilyCenterActions } from "../hooks/useFamilyCenterActions";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import { ModalContent } from "../../../design/components/Modal/native/ModalContent.native";
import { AvatarSizes, Avatar, generateBoxShadowStyle, FOUR_DP_ELEVATION_SHADOW_PARAMS, Icon } from "../../../design/void/native";
import AvatarUtils from "../../../utils/AvatarUtils";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Text } from "../../../design/components/Text/native/Text";
import Module11111 from "../../../_bundle/Module11111";
import { ModalFooter } from "../../../design/components/Modal/native/ModalFooter.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { EnvelopeSpotIllustration, FamilyShieldSpotIllustration } from "../../../design/assets/native";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import Module38 from "../../../_bundle/Module38";
import Module10008 from "../../../_bundle/Module10008";
import Module7699 from "../../../_bundle/Module7699";
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import usePrevious from "../../../hooks/usePrevious";
import { AgeVerificationStatusUkAndAusOnly } from "../../../flow/Server";
import AgeVerificationActionCreators_native from "../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../age_assurance/AgeVerificationAnalyticsUtils";
import { useIsAgeVerified } from "../../age_assurance/AgeVerificationUtils";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { FamilyCenterConnectionPrereqExperiment } from "../FamilyCenterConnectionPrereqExperiment";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
import { HermesBuiltin } from "../../../_hermes/prelude";
function $mk86418($env) {
return () => {
const r3 = $env;
const r5 = r3[2];
let r0 = r5 != null && r5 !== r3[1] && r3[1] != null;
if (r0) {
const r8 = r3[1];
const r9 = $env.$parent;
r0 = r8 !== (0, r9[0])(r9[2][34]).AgeVerificationStatusUkAndAusOnly.UNVERIFIED;
}
if (r0) {
const r16 = r3[0];
const r18 = $env.$parent;
r16.replace((0, r18[0])(r18[2][11]).FamilyCenterModalRequestSections.VERIFYING);
}
};
}
let FamilyCenterModalRequestSuccess, FamilyCenterModalRequestError, FamilyCenterPrereqLoading, FamilyCenterPrereqScreen, FamilyCenterConfirmAgeScreen, FamilyCenterVerifyingScreen, FamilyCenterPrereqInvalidCodeScreen, FamilyCenterPrereqMustBeAdultScreen, useStyles, useStyles2, useStyles3, useStyles4, useStyles5, useStyles6, c7501_30;
let $mk86417 = function() {
return () => UserStore.getCurrentUser()?.ageVerificationStatus;
};
let env7501 = {};
export function FamilyCenterModalRequestConfirm(props) {
let r80, r81, jsx2;
let requestLink;
const { userId, linkCode, teenIdentity } = props;
requestLink = void 0;
const styles = useStyles();
const navigation = useNavigation();
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const familyCenterActions = useFamilyCenterActions({
onSuccess: useCallback(() => {
FamilyCenterActionCreators.clearPendingConnection();
navigation.push(FamilyCenterModalRequestSections.SENT);
}, [navigation]),
onError: useCallback((a0) => {
navigation.push(FamilyCenterModalRequestSections.ERROR, {
failureCode: getFailureCodeForAPIError(a0)
});
}, [navigation])
});
requestLink = familyCenterActions.requestLink;
const isRequestingLink = familyCenterActions.isRequestingLink;
const callback = useCallback(() => {
requestLink(userId, linkCode);
}, [requestLink, userId, linkCode]);
if (teenIdentity != null) {
const props2 = {
source: stateFromStores2 != null ? AvatarUtils.getUserAvatarSource(stateFromStores2) : void 0,
size: AvatarSizes.LARGE,
accessibilityLabel: null
};
let name = stateFromStores2?.globalName;
if (name == null) {
name = stateFromStores2?.username;
}
if (name == null) {
name = "";
}
props2.accessibilityLabel = intl.formatToPlainString(FamilyCenter_messages.kFj4h1, {
name
});
const r113 = [<Avatar {...props2} />, <View style={styles.ellipseGroup}>
<View style={styles.ellipse} />
<View style={styles.ellipse} />
<View style={styles.ellipse} />
</View>, ,];
const props3 = {
source: AvatarUtils.getUserAvatarSource({
id: teenIdentity.id,
avatar: teenIdentity.avatar,
discriminator: "0"
}),
size: AvatarSizes.LARGE,
accessibilityLabel: null
};
let global_name = teenIdentity.global_name;
if (global_name == null) {
global_name = teenIdentity.username;
}
props3.accessibilityLabel = intl.formatToPlainString(FamilyCenter_messages.kFj4h1, {
name: global_name
});
r113[2] = <Avatar {...props3} />;
const r154 = [<View style={styles.headerIcons}>{r113}</View>, <Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.title}>
{intl.string(FamilyCenter_messages.sMmIbm)}
</Text>, , ,];
let global_name2 = teenIdentity.global_name;
if (global_name2 == null) {
global_name2 = teenIdentity.username;
}
r154[2] = <Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.teenName}>{global_name2}</Text>;
let global_name3 = teenIdentity.global_name;
if (global_name3 == null) {
global_name3 = teenIdentity.username;
}
r154[3] = <Text variant="text-sm/medium" color="text-muted" style={styles.consent}>
{intl.format(FamilyCenter_messages.yiUJNU, {
username: global_name3
})}
</Text>;
r80 = <View style={styles.connectionHeader}>{r154}</View>;
r81 = importDefault;
jsx2 = jsx;
} else {
r80 = <>
<Image style={styles.art} source={Module11111} />
<Text style={styles.headerText} variant="text-lg/bold">
{intl.string(FamilyCenter_messages.GH11eI)}
</Text>
</>;
r81 = importDefault;
jsx2 = jsx;
}
return <ModalScreen>
<ModalContent>
{r80}
{jsx2(r81(dependencyMap[22]), {})}
</ModalContent>
{jsx2(ModalFooter, {
children: <ButtonGroup>
{jsx2(Button, {
variant: "primary",
size: "lg",
disabled: isRequestingLink,
loading: isRequestingLink,
text: intl.string(r81(dependencyMap[19]).ISg34l),
onPress: callback
})}
{jsx2(Button, {
variant: "secondary",
size: "lg",
text: intl.string(t["ETE/oC"]),
onPress: r81(dependencyMap[26]).pop
})}
</ButtonGroup>
})}
</ModalScreen>;
}
FamilyCenterModalRequestSuccess = function FamilyCenterModalRequestSuccess() {
const styles2 = useStyles2();
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const callback = useCallback(() => {
ModalActionCreators.pop();
}, []);
if (stateFromStores2 === null) {
ModalActionCreators.pop();
}
return <ModalScreen>
<ModalContent>
<View style={styles2.content}>
<View style={styles2.textWrapper}>
<View style={styles2.illustration}>
<EnvelopeSpotIllustration scale={0.7} />
</View>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary" style={styles2.header}>
{intl.string(FamilyCenter_messages.EpwfZl)}
</Text>
<Text variant="text-sm/medium" color="text-muted" style={styles2.description}>
{intl.format(FamilyCenter_messages.dVtWId, {
email: stateFromStores2?.email
})}
</Text>
</View>
</View>
</ModalContent>
<ModalFooter>
<Button size="lg" text={intl.string(t.cpT0Cq)} onPress={callback} />
</ModalFooter>
</ModalScreen>;
};
FamilyCenterModalRequestError = function FamilyCenterModalRequestError(props) {
const failureCode = props.failureCode;
const styles3 = useStyles3();
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const r19 = generateBoxShadowStyle(FOUR_DP_ELEVATION_SHADOW_PARAMS);
const callback = useCallback(() => {
ModalActionCreators.pop();
}, []);
Module38(stateFromStores2 != null, "User must be logged in to see this modal.");
const r43 = FAMILY_CENTER_LINK_REQUEST_ERROR_EXPERIENCES[failureCode];
let isAdult = isInAdultAgeGroup;
if (isAdult == null) {
isAdult = void 0;
}
let email = stateFromStores2.email;
if (email == null) {
email = void 0;
}
const r45 = {
isAdult,
email
};
const r17 = r43.header(r45);
const r14 = r43.description(r45);
const icon = r43.icon;
return <ModalScreen>
<ModalContent>
<View style={[styles3.ring, r19]}>
<View style={[styles3.iconContainer, icon === FamilyCenterIconType.CHECK ? styles3.positive : styles3.negative]}>
{icon === FamilyCenterIconType.CHECK ? <Icon source={Module10008} color="#FFF" /> : <Icon source={Module7699} color="#FFF" />}
</View>
</View>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary" style={styles3.header}>{r17}</Text>
<Text variant="text-sm/medium" color="text-muted" style={styles3.description}>{r14}</Text>
</ModalContent>
<ModalFooter>
<Button text={intl.string(t.cpT0Cq)} onPress={callback} />
</ModalFooter>
</ModalScreen>;
};
FamilyCenterPrereqLoading = function FamilyCenterPrereqLoading(props) {
const { userId: userId2, linkCode: linkCode2 } = props;
const styles4 = useStyles4();
const navigation2 = useNavigation();
useEffect(() => {
let c26941_0;
let _runPrereq2 = function _runPrereq() {
const r9 = async () => {
let c31607_1;
let c32026_0;
L15: {
c31607_1 = void 0;
c32026_0 = void 0;
c32026_0 = await resolveConnectionPrereqTarget(userId2, linkCode2);
if (!c26941_0) {
if (c32026_0.section !== FamilyCenterModalRequestSections.ERROR) {
if (c32026_0.section !== FamilyCenterModalRequestSections.REQUEST) {
if (c32026_0.section !== FamilyCenterModalRequestSections.CONFIRM_AGE) {
navigation2.replace(c32026_0.section);
break L15;
}
}
}
navigation2.replace(c32026_0.section, c32026_0.params);
}
}
};
_runPrereq2 = r9;
return r9.apply(this, arguments);
};
c26941_0 = false;
(function runPrereq() {
return _runPrereq2.apply(this, arguments);
})();
return () => {
c26941_0 = true;
};
}, []);
return <ModalScreen>
<View style={styles4.container}>
<ActivityIndicator />
</View>
</ModalScreen>;
};
FamilyCenterPrereqScreen = function FamilyCenterPrereqScreen(props) {
const { title, description, primaryButton } = props;
const styles5 = useStyles5();
return <ModalScreen>
<View style={styles5.content}>
<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles5.title}>{title}</Text>
<Text variant="text-sm/medium" color="text-muted" style={styles5.description}>{description}</Text>
</View>
<ModalFooter>
<Button text={primaryButton.text} onPress={primaryButton.onPress} />
</ModalFooter>
</ModalScreen>;
};
FamilyCenterConfirmAgeScreen = function FamilyCenterConfirmAgeScreen(props) {
let env18541;
const teenIdentity = props.teenIdentity;
const styles6 = useStyles6();
const r24 = env18541 = {
$parent: env7501
};
env18541[0] = void 0;
env18541[1] = void 0;
env18541[2] = void 0;
const navigation4 = useNavigation();
env18541[0] = navigation4;
const stateFromStores2 = useStateFromStores([UserStore], $mk86417());
env18541[1] = stateFromStores2;
const previous = usePrevious(stateFromStores2);
env18541[2] = previous;
useEffect($mk86418(r24), [stateFromStores2, previous, navigation4]);
const callback = useCallback(() => {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.FAMILY_CENTER_CONNECTION
});
}, []);
const r56 = [<View style={styles6.art}>
<FamilyShieldSpotIllustration />
</View>, , ,];
let username = teenIdentity?.global_name;
if (username == null) {
username = teenIdentity?.username;
}
if (username == null) {
username = "";
}
r56[1] = <Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles6.title}>
{intl.formatToPlainString(FamilyCenter_messages.pQQMJ7, {
username
})}
</Text>;
r56[2] = <Text variant="text-sm/medium" color="text-muted" style={styles6.description}>
{intl.format(FamilyCenter_messages["0o3yg8"], {
link: "https://support.discord.com/hc/articles/14155060633623"
})}
</Text>;
return <ModalScreen>
<View style={styles6.content}>{r56}</View>
<ModalFooter>
<ButtonGroup>
<Button variant="primary" text={intl.string(FamilyCenter_messages["3oUE4o"])} onPress={callback} />
<Button variant="tertiary" text={intl.string(t.oEAioF)} onPress={() => ModalActionCreators.pop()} />
</ButtonGroup>
</ModalFooter>
</ModalScreen>;
};
FamilyCenterVerifyingScreen = function FamilyCenterVerifyingScreen() {
let ref;
const styles4 = useStyles4();
const navigation3 = useNavigation();
const isAgeVerified = useIsAgeVerified();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.ageVerificationStatus);
ref = useRef(false);
useEffect(() => {
if (isAgeVerified) {
if (ref.current) {
return void 0;
}
ref.current = true;
navigation3.replace(FamilyCenterModalRequestSections.PREREQ_LOADING);
return void 0;
}
if (stateFromStores === AgeVerificationStatusUkAndAusOnly.UNVERIFIED) {
navigation3.replace(FamilyCenterModalRequestSections.ERROR, {
failureCode: FamilyCenterFailureCode.GENERIC_ERROR
});
}
}, [isAgeVerified, stateFromStores, navigation3]);
useEffect(() => {
let c26942_0 = setTimeout(() => {
navigation3.replace(FamilyCenterModalRequestSections.ERROR, {
failureCode: FamilyCenterFailureCode.GENERIC_ERROR
});
}, FAMILY_CENTER_AGE_VERIFICATION_RESUME_TIMEOUT);
return () => clearTimeout(c26942_0);
}, [navigation3]);
return <ModalScreen>
<View style={styles4.container}>
<ActivityIndicator />
</View>
</ModalScreen>;
};
FamilyCenterPrereqInvalidCodeScreen = function FamilyCenterPrereqInvalidCodeScreen() {
return <FamilyCenterPrereqScreen title={intl.string(FamilyCenter_messages.ewSb6o)} description={intl.string(FamilyCenter_messages.jcUN2F)} primaryButton={{
text: intl.string(t.WAI6xu),
onPress: ModalActionCreators.pop
}} />;
};
FamilyCenterPrereqMustBeAdultScreen = function FamilyCenterPrereqMustBeAdultScreen() {
let env18543;
const r2 = env18543 = {
$parent: env7501
};
const navigation4 = useNavigation();
env18543[0] = navigation4;
const stateFromStores2 = useStateFromStores([UserStore], $mk86417());
env18543[1] = stateFromStores2;
const previous = usePrevious(stateFromStores2);
env18543[2] = previous;
useEffect($mk86418(r2), [stateFromStores2, previous, navigation4]);
const callback = useCallback(() => {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.FAMILY_CENTER_CONNECTION
});
}, []);
return (0, jsx)(FamilyCenterPrereqScreen, {
title: intl.string(FamilyCenter_messages.BQFHXW),
description: intl.format(FamilyCenter_messages.WDjaKn, {
link: {
onClick: callback
}
}),
primaryButton: {
text: intl.string(t["NX+WJN"]),
onPress: ModalActionCreators.pop
}
});
};
useStyles = createStyles({
headerText: {
marginTop: Module712.space.PX_16,
marginBottom: Module712.space.PX_16
},
art: {
width: 165,
height: 119
},
connectionHeader: {
alignItems: "center",
marginBottom: Module712.space.PX_16
},
headerIcons: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
alignSelf: "center",
padding: Module712.space.PX_8,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.round,
marginBottom: Module712.space.PX_24
},
ellipseGroup: {
flexDirection: "row",
marginHorizontal: Module712.space.PX_12
},
ellipse: {
width: 4,
height: 4,
marginHorizontal: 2,
backgroundColor: Module712.colors.ICON_MUTED,
borderRadius: Module712.radii.round
},
title: {
textAlign: "center"
},
teenName: {
marginTop: Module712.space.PX_4,
textAlign: "center"
},
consent: {
marginTop: Module712.space.PX_8,
textAlign: "center",
paddingHorizontal: Module712.space.PX_16
}
});
useStyles2 = createStyles({
content: {
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: Module712.space.PX_16
},
textWrapper: {
alignItems: "center"
},
header: {
marginBottom: Module712.space.PX_8
},
description: {
textAlign: "center"
},
illustration: {
position: "absolute",
bottom: "100%",
left: 0,
right: 0,
alignItems: "center",
paddingBottom: Module712.space.PX_24
}
});
useStyles3 = createStyles({
header: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
ring: {
display: "flex",
justifyContent: "center",
alignItems: "center",
height: 64,
width: 64,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
marginBottom: 24
},
iconContainer: {
display: "flex",
justifyContent: "center",
alignItems: "center",
height: 48,
width: 48,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.STATUS_POSITIVE
},
positive: {
backgroundColor: Module712.colors.STATUS_POSITIVE
},
negative: {
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_CRITICAL
}
});
useStyles4 = createStyles({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center"
}
});
useStyles5 = createStyles({
content: {
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: 32
},
title: {
textAlign: "center",
marginBottom: Module712.space.PX_8
},
description: {
textAlign: "center"
}
});
useStyles6 = createStyles({
content: {
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: 32
},
art: {
marginBottom: Module712.space.PX_24
},
title: {
textAlign: "center",
marginBottom: Module712.space.PX_8
},
description: {
textAlign: "center"
}
});
c7501_30 = {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null
};
export default function FamilyCenterRequestModal({ userId: userId3, linkCode: linkCode3 }) {
const isInAdultAgeGroup = useIsInAdultAgeGroup();
return (0, jsx)(Modal, {
initialRouteName: FamilyCenterConnectionPrereqExperiment.useConfig({
location: "FamilyCenterRequestModal"
}).enabled ? FamilyCenterModalRequestSections.PREREQ_LOADING : isInAdultAgeGroup ? FamilyCenterModalRequestSections.REQUEST : FamilyCenterModalRequestSections.TEEN_SCAN,
screens: useMemo(() => {
const userId4 = userId3;
const linkCode4 = linkCode3;
const r16 = {};
const PREREQ_LOADING = FamilyCenterModalRequestSections.PREREQ_LOADING;
const r20 = {};
HermesBuiltin.copyDataProperties(r20, c7501_30);
r20.render = () => (0, jsx)(FamilyCenterPrereqLoading, {
userId: userId4,
linkCode: linkCode4
});
r16[PREREQ_LOADING] = r20;
r16[FamilyCenterModalRequestSections.CONFIRM_AGE] = {
...c7501_30,
render: (a0) => <FamilyCenterConfirmAgeScreen teenIdentity={a0?.teenIdentity} />
};
r16[FamilyCenterModalRequestSections.VERIFYING] = {
...c7501_30,
render: () => (0, jsx)(FamilyCenterVerifyingScreen, {})
};
r16[FamilyCenterModalRequestSections.REQUEST] = {
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerShown: true,
headerTitle: () => null,
render: (a0) => <FamilyCenterModalRequestConfirm userId={userId4} linkCode={linkCode4} teenIdentity={a0?.teenIdentity} />
};
r16[FamilyCenterModalRequestSections.INVALID_CODE] = {
...c7501_30,
render: () => (0, jsx)(FamilyCenterPrereqInvalidCodeScreen, {})
};
r16[FamilyCenterModalRequestSections.MUST_BE_ADULT] = {
...c7501_30,
render: () => (0, jsx)(FamilyCenterPrereqMustBeAdultScreen, {})
};
r16[FamilyCenterModalRequestSections.SENT] = {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: () => (0, jsx)(FamilyCenterModalRequestSuccess, {})
};
r16[FamilyCenterModalRequestSections.ERROR] = {
headerShown: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
headerTitle: () => null,
render: (a0) => (0, jsx)(FamilyCenterModalRequestError, {
failureCode: a0.failureCode
})
};
r16[FamilyCenterModalRequestSections.TEEN_SCAN] = {
fullscreen: true,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
render: () => (0, jsx)(FamilyCenterModalRequestError, {
failureCode: FamilyCenterFailureCode.INELIGIBLE_FOR_FAMILY_CENTER
})
};
return r16;
}, [linkCode3, userId3]),
headerBackTitle: intl.string(t["13/7kX"])
});
};
export { FamilyCenterModalRequestSuccess };
export { FamilyCenterModalRequestError };
@@ -0,0 +1,40 @@
// Metro module 11107 (f11108).
import FamilyCenterPendingConnectionStore from "../FamilyCenterPendingConnectionStore";
import { FAMILY_CENTER_LINK_REQUEST_REGEX, FamilyCenterAction } from "../FamilyCenterConstants";
import { AnalyticEvents } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
let c7500_7 = "family-center-request-modal";
export const FAMILY_CENTER_REQUEST_MODAL_KEY = "family-center-request-modal";
export function handleFamilyCenterQRCodeScan(a0, a1) {
const r13 = a0.match(FAMILY_CENTER_LINK_REQUEST_REGEX);
if (r13 === null) {
return null;
}
const selected_teen_id = r13[1];
const linkCode = r13[2];
AnalyticsUtils.track(AnalyticEvents.FAMILY_CENTER_ACTION, {
action: FamilyCenterAction.ScanQRCode,
selected_teen_id,
source: a1
});
FamilyCenterActionCreators.setPendingConnection(selected_teen_id, linkCode);
ModalActionCreators.pushLazy(import("./FamilyCenterModalRequest"), {
userId: selected_teen_id,
linkCode
}, c7500_7);
}
export function resumeFamilyCenterConnection() {
const pendingConnection = FamilyCenterPendingConnectionStore.getPendingConnection();
let r9 = pendingConnection != null;
if (r9) {
ModalActionCreators.popWithKey(c7500_7);
ModalActionCreators.pushLazy(import("./FamilyCenterModalRequest"), {
userId: pendingConnection.teenId,
linkCode: pendingConnection.linkCode
}, c7500_7);
r9 = true;
}
return r9;
}
@@ -0,0 +1,44 @@
// Metro module 13904 (f13905).
import { useCallback } from "react";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useIsParentalConsentBannerActive } from "../useIsParentalConsentBannerActive";
import { useParentalConsentWarning } from "../useParentalConsentWarning";
import Linking from "../../../lib/native/Linking";
import { Text } from "../../../design/components/Text/native/Text";
import FamilyCenterInlineWarningNotice from "./FamilyCenterInlineWarningNotice";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
const useStyles = createStyles({
container: {
marginTop: Module712.space.PX_16
},
link: {
textDecorationLine: "underline"
}
});
export default function FamilyCenterParentalConsentNotice() {
const styles = useStyles();
const isParentalConsentBannerActive = useIsParentalConsentBannerActive();
let count = useParentalConsentWarning()?.daysRemaining;
if (count == null) {
count = null;
}
const callback = useCallback(() => {
Linking.openURL("https://support.discord.com/hc/articles/14155060633623");
}, []);
if (isParentalConsentBannerActive && count != null && !(count < 0)) {
const learnMoreHook = function learnMoreHook(a0, a1) {
return <Text key={a1} variant="text-sm/medium" color="text-strong" style={styles.link} accessibilityRole="link" onPress={callback}>
{a0}
</Text>;
};
return <FamilyCenterInlineWarningNotice style={styles.container} text={count === 0 ? intl.format(FamilyCenter_messages.S5kmfO, {
learnMoreHook
}) : intl.format(FamilyCenter_messages["5jm+T3"], {
count,
learnMoreHook
})} />;
}
return null;
};
@@ -0,0 +1,26 @@
// Metro module 13961 (f13962).
import { View } from "react-native";
import { HelpdeskArticles } from "../../../Constants";
import { MobileSetting } from "../../user_settings/core/native/SettingsConstants";
import { createList } from "../../settings/native/renderer/SettingBuilders";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import SettingLayout from "../../settings/native/renderer/SettingLayout";
export default function FamilyCenterParentalControlsContentAndSocial() {
return <View>
<SettingLayout node={createList({
sections: [{
settings: [MobileSetting.PARENTAL_CONTROLS_SENSITIVE_CONTENT_FILTERS],
subLabel: intl.format(t.dliU4j, {
learnMoreLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.EXPLICIT_MEDIA_REDACTION)
})
}, {
label: intl.string(t.MeYuqs),
settings: [MobileSetting.PARENTAL_CONTROLS_DIRECT_MESSAGES, MobileSetting.PARENTAL_CONTROLS_MESSAGE_REQUESTS]
}, {
label: intl.string(t.XlGG9c),
settings: [MobileSetting.PARENTAL_CONTROLS_FRIEND_REQUESTS_EVERYONE, MobileSetting.PARENTAL_CONTROLS_FRIEND_REQUESTS_MUTUAL_FRIENDS, MobileSetting.PARENTAL_CONTROLS_FRIEND_REQUESTS_MUTUAL_GUILDS]
}]
})} />
</View>;
};
@@ -0,0 +1,35 @@
// Metro module 13962 (f13963).
import { useMemo } from "react";
import { HelpdeskArticles } from "../../../Constants";
import { MobileSetting } from "../../user_settings/core/native/SettingsConstants";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { createList } from "../../settings/native/renderer/SettingBuilders";
import SettingLayout from "../../settings/native/renderer/SettingLayout";
export default function FamilyCenterParentalControlsDataAndPrivacy() {
const memo = useMemo(() => [{
settings: [MobileSetting.PARENTAL_CONTROLS_DATA_USAGE_STATISTICS],
subLabel: intl.format(FamilyCenter_messages.Z5yJZy, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.DATA_PRIVACY_CONTROLS)
})
}, {
settings: [MobileSetting.PARENTAL_CONTROLS_DATA_USAGE_PERSONALIZATION],
subLabel: intl.format(FamilyCenter_messages.Imp6Ns, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.DATA_USED_FOR_RECOMMENDED)
})
}, {
settings: [MobileSetting.PARENTAL_CONTROLS_DATA_USAGE_QUESTS],
subLabel: intl.format(FamilyCenter_messages.cnCK6b, {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.QUESTS_PRIVACY_CONTROLS)
})
}, {
settings: [MobileSetting.PARENTAL_CONTROLS_DATA_USAGE_QUESTS_3P],
subLabel: intl.format(FamilyCenter_messages["6mK5Pz"], {
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.QUESTS_PRIVACY_CONTROLS)
})
}], []);
return <SettingLayout node={useMemo(() => createList({
sections: memo
}), [memo])} />;
};
@@ -0,0 +1,58 @@
// Metro module 13963 (f13964).
import { View } from "react-native";
import { UserSettingsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { getScheduleRuleDateRange, formatDays, sortRulesByStartTime } from "../FamilyCenterRestrictedHoursUtils";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { useSelectedTeenUser } from "../hooks/useSelectedTeenUser";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
let useStyles;
const ScheduleRuleRow = function ScheduleRuleRow(props) {
const { rule, teenId, navigation, readOnly: readOnly2 = false } = props;
return <TableRow label={getScheduleRuleDateRange(rule)} subLabel={formatDays(rule.days)} trailing={<Text variant="text-sm/medium" color="text-subtle">
{rule.enabled ? intl.string(FamilyCenter_messages["8vDHRq"]) : intl.string(FamilyCenter_messages["4z9fN+"])}
</Text>} arrow={!readOnly2} onPress={readOnly2 ? void 0 : () => navigation.navigate(UserSettingsSections.FAMILY_CENTER_SCHEDULE_DOWNTIME, {
teenId,
rule: {
...rule
}
})} />;
};
useStyles = createStyles({
header: {
paddingTop: Module712.space.PX_24
},
container: {
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8
}
});
export default function FamilyCenterParentalControlsScreenTime(props) {
let readOnly2 = props.readOnly;
if (readOnly2 === void 0) {
readOnly2 = false;
}
const readOnly = readOnly2;
const styles = useStyles();
const selectedTeenUser = useSelectedTeenUser();
const navigation2 = useNavigation();
const id = selectedTeenUser?.id;
let r6 = selectedTeenUser == null ? void 0 : selectedTeenUser.restrictedSchedule?.rules;
if (r6 == null) {
r6 = [];
}
const r12 = sortRulesByStartTime(r6);
return id == null ? null : <View style={styles.container}>
<Text variant="text-sm/semibold" color="text-subtle" style={styles.header}>
{intl.string(FamilyCenter_messages["72CmJd"])}
</Text>
<TableRowGroup hasIcons={false}>
{r12.map((item) => <ScheduleRuleRow key={item.ruleId} rule={item} teenId={id} navigation={navigation2} readOnly={readOnly} />)}
</TableRowGroup>
</View>;
};
@@ -0,0 +1,98 @@
// Metro module 13955 (f13956).
import { View } from "react-native";
import { UserLinkStatus } from "../FamilyCenterConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useHasMaxConnections, useUsersForLinkStatus } from "../hooks/useUserLinks";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Text } from "../../../design/components/Text/native/Text";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { Icon } from "../../../design/void/native";
import Module10356 from "../../../_bundle/Module10356";
import Module13954 from "../../../_bundle/Module13954";
import FamilyCenterLinkRow from "./FamilyCenterLinkRow";
let useStyles, useStyles2;
const FamilyCenterPendingLinkRow = function FamilyCenterPendingLinkRow(props) {
const otherUser = props.otherUser;
const styles2 = useStyles2();
const isInAdultAgeGroup = useIsInAdultAgeGroup();
const hasMaxConnections = useHasMaxConnections();
if (otherUser === void 0) {
return null;
}
return <FamilyCenterLinkRow otherUser={otherUser} actions={isInAdultAgeGroup ? <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(FamilyCenter_messages.oUpA6X, {
name: otherUser == null ? void 0 : otherUser.toString()
})} onPress={function onPress() {
ModalActionCreators.pushLazy(import("./FamilyCenterModalCancel"), {
otherUser
});
}} style={styles2.actionButton}>
<Icon size={Icon.Sizes.SMALL} disableColor source={Module13954} />
</PressableOpacity> : <>
{hasMaxConnections ? null : <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(FamilyCenter_messages.jc1Ip7, {
name: otherUser == null ? void 0 : otherUser.toString()
})} onPress={function onPress() {
ModalActionCreators.pushLazy(import("./FamilyCenterModalAccept"), {
otherUser
});
}} style={[styles2.actionButton, styles2.actionButtonFirst]}>
<Icon size={Icon.Sizes.SMALL} disableColor source={Module10356} />
</PressableOpacity>}
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(FamilyCenter_messages["4GtllP"], {
name: otherUser == null ? void 0 : otherUser.toString()
})} onPress={function onPress() {
ModalActionCreators.pushLazy(import("./FamilyCenterModalDecline"), {
otherUser
});
}} style={styles2.actionButton}>
<Icon size={Icon.Sizes.SMALL} disableColor source={Module13954} />
</PressableOpacity>
</>} />;
};
useStyles = createStyles({
container: {
marginTop: 24
},
content: {
display: "flex",
justifyContent: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderRadius: Module712.radii.md
},
header: {
marginBottom: 10
}
});
useStyles2 = createStyles({
actionButton: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
borderRadius: Module712.radii.round,
alignItems: "center",
justifyContent: "center",
height: 32,
width: 32
},
actionButtonFirst: {
marginRight: Module712.space.PX_8
}
});
export default function FamilyCenterPendingLinks() {
const styles = useStyles();
const usersForLinkStatus = useUsersForLinkStatus(UserLinkStatus.PENDING);
const ageSpecificText = useAgeSpecificText(intl.formatToPlainString(FamilyCenter_messages.IkAgkG, {
count: usersForLinkStatus.length
}), intl.formatToPlainString(FamilyCenter_messages.Q8XnAa, {
count: usersForLinkStatus.length
}));
return usersForLinkStatus.length !== 0 ? <View style={styles.container}>
<Text style={styles.header} variant="eyebrow" color="text-default">{ageSpecificText}</Text>
<View style={styles.content}>
{usersForLinkStatus.map((usersForLinkStatu) => <FamilyCenterPendingLinkRow key={`pending-${usersForLinkStatu.id}`} otherUser={usersForLinkStatu} />)}
</View>
</View> : null;
};
@@ -0,0 +1,39 @@
// Metro module 13951 (f13952).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { AVATAR_SIZE_MAP, AvatarSizes, Avatar } from "../../../design/void/native";
import Module712 from "../../../_bundle/Module712";
import { useLinkTimestampText } from "../hooks/useUserLinks";
import FamilyCenterUsernameHeader from "./FamilyCenterUsernameHeader";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
flexGrow: 1,
flexShrink: 1
},
avatar: {
borderRadius: AVATAR_SIZE_MAP[AvatarSizes.NORMAL] / 2,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
detailsContainer: {
paddingLeft: Module712.space.PX_12,
paddingRight: Module712.space.PX_4,
flexGrow: 1,
flexShrink: 1
}
});
export default function FamilyCenterRequestorDetails(props) {
const { otherUser, status } = props;
const styles = useStyles();
return <View style={styles.container}>
<Avatar avatarStyle={styles.avatar} user={otherUser} guildId={void 0} disablePlaceholder avatarDecoration={otherUser.avatarDecoration} />
<View style={styles.detailsContainer}>
<FamilyCenterUsernameHeader user={otherUser} />
<Text variant="text-xs/semibold" color="text-muted">
{useLinkTimestampText(otherUser.id, status)}
</Text>
</View>
</View>;
};
@@ -0,0 +1,90 @@
// Metro module 13943 (f13944).
import { ScrollView, View } from "react-native";
import { MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS, MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS } from "../FamilyCenterConstants";
import { THROUGHLINE_URL } from "../../self_mod/Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useHasMaxConnections } from "../hooks/useUserLinks";
import useIsInAdultAgeGroup from "../hooks/useIsInAdultAgeGroup";
import { useAgeSpecificText } from "../hooks/useAgeSpecificText";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import * as _Text from "../../../design/components/Text/native/Text";
import { useShouldShowHelplineLink, useShouldShowThroughlineLink } from "../hooks/useHelpLineVisibility";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import FamilyCenterParentalConsentNotice from "./FamilyCenterParentalConsentNotice";
import FamilyCenterLinkingBanner from "./FamilyCenterLinkingBanner";
import FamilyCenterAcceptedLinks from "./FamilyCenterAcceptedLinks";
import FamilyCenterPendingLinks from "./FamilyCenterPendingLinks";
let useStyles, useStyles2, FamilyCenterHelpLineInfo, useStyles3;
const FamilyCenterMaxConnectionsBlurb = function FamilyCenterMaxConnectionsBlurb() {
const styles = useStyles();
const hasMaxConnections = useHasMaxConnections();
const maxConnections = useIsInAdultAgeGroup() ? MAX_PARENT_TO_TEEN_ACTIVE_CONNECTIONS : MAX_TEEN_TO_PARENT_ACTIVE_CONNECTIONS;
const ageSpecificText = useAgeSpecificText(intl.formatToPlainString(FamilyCenter_messages["1/PzIj"], {
maxConnections
}), intl.formatToPlainString(FamilyCenter_messages.RcTgiE, {
maxConnections
}));
return hasMaxConnections ? <View style={styles.container}>
<_Text.Text variant="text-xxs/medium" color="text-muted">{ageSpecificText}</_Text.Text>
</View> : null;
};
FamilyCenterHelpLineInfo = function FamilyCenterHelpLineInfo() {
const styles2 = useStyles2();
const shouldShowHelplineLink = useShouldShowHelplineLink();
const shouldShowThroughlineLink = useShouldShowThroughlineLink();
const r10 = shouldShowHelplineLink ? intl.format(FamilyCenter_messages["KOwsf/"], {
helpLink: "https://support.discord.com/hc/articles/7925648993943-Crisis-Text-Line"
}) : shouldShowThroughlineLink ? intl.format(FamilyCenter_messages["6tsC8u"], {
helpLink: THROUGHLINE_URL
}) : null;
return r10 != null ? <View style={styles2.container}>
<_Text.Text style={styles2.supportHeader} variant="heading-sm/semibold">
{intl.string(FamilyCenter_messages["7/tVhv"])}
</_Text.Text>
<_Text.Text variant="text-xs/medium" color="text-muted">{r10}</_Text.Text>
</View> : null;
};
useStyles = createStyles({
container: {
display: "flex",
paddingTop: Module712.space.PX_12,
marginTop: Module712.space.PX_12,
borderTopColor: Module712.colors.BORDER_SUBTLE,
borderTopWidth: 1
}
});
useStyles2 = createStyles({
container: {
display: "flex",
marginTop: Module712.space.PX_16
},
supportHeader: {
marginBottom: Module712.space.PX_4
}
});
useStyles3 = createStyles({
scrollView: {
flex: 1
},
container: {
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16
}
});
export default function FamilyCenterRequestsPage() {
const styles3 = useStyles3();
return <ScrollView style={styles3.scrollView}>
<SafeAreaPaddingView bottom>
<View style={styles3.container}>
<FamilyCenterParentalConsentNotice />
<FamilyCenterLinkingBanner />
<FamilyCenterAcceptedLinks />
<FamilyCenterPendingLinks />
<FamilyCenterMaxConnectionsBlurb />
<FamilyCenterHelpLineInfo />
</View>
</SafeAreaPaddingView>
</ScrollView>;
};
@@ -0,0 +1,196 @@
// Metro module 13937 (f13938).
import { useEffect } from "react";
import { View } from "react-native";
import { FamilyCenterSubPages } from "../FamilyCenterConstants";
import { UserSettingsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { useSpendingLimitDisplayState, useSpendingLimitFromUserSettings } from "../SpendingLimitDisplay";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { useActiveLinkUserIds } from "../hooks/useUserLinks";
import { useSelectedTeenUser, useShouldLoadSettingsForSelectedTeenUser } from "../hooks/useSelectedTeenUser";
import { useIsFamilyCenterV3Enabled } from "../FamilyCenterV3Experiment";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import useScheduleTimeControlsRowProps from "../hooks/useScheduleTimeControlsRowProps";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { popLayer } from "../../../actions/LayerActionCreators";
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
import { ParentalControlledSpendingLimit } from "../../user_settings/family_center/ParentalControlledUserSettings";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import useUserIsTeenAgeGroup from "../hooks/useUserIsTeenAgeGroup";
let useStyles, FamilyCenterSettingsTeenControls, FamilyCenterSettingsParentalControls;
const SpendingLimitRow = function SpendingLimitRow(props) {
const { cap, teenId } = props;
const styles = useStyles();
const spendingLimitDisplayState = useSpendingLimitDisplayState(cap);
const kind = spendingLimitDisplayState.kind;
const r26 = kind === "off" ? {
trailing: <Text variant="text-sm/normal" color="text-muted">
{intl.string(FamilyCenter_messages.YEnpaj)}
</Text>
} : kind === "on" ? {
trailing: <Text variant="text-sm/normal" color="text-muted">{spendingLimitDisplayState.monthlyText}</Text>
} : kind === "close-to-limit" ? {
trailing: <Text variant="text-sm/normal" color="text-muted">{spendingLimitDisplayState.monthlyText}</Text>,
subLabel: <Text variant="text-sm/normal" style={styles.subLabelWarning}>{spendingLimitDisplayState.remainingText}</Text>
} : kind === "spent" ? {
trailing: <Text variant="text-sm/normal" color="text-muted">{spendingLimitDisplayState.monthlyText}</Text>,
subLabel: <Text variant="text-sm/normal" style={styles.subLabelCritical}>
{intl.string(FamilyCenter_messages.Q2msVQ)}
</Text>
} : kind === "blocked" ? {
trailing: <Text variant="text-sm/normal" color="text-muted">
{intl.string(FamilyCenter_messages.kGFuGn)}
</Text>,
subLabel: <Text variant="text-sm/normal" style={styles.subLabelCritical}>
{intl.string(FamilyCenter_messages.FUu2b0)}
</Text>
} : void 0;
const { trailing, subLabel } = r26;
const disabled = teenId == null;
return <TableRow label={intl.string(FamilyCenter_messages.gMeekL)} trailing={trailing} subLabel={subLabel} onPress={disabled ? void 0 : () => {
ModalActionCreators.pushLazy(import("./ChangeSpendingLimitModal"), {
teenId
}, void 0, {
animation: "slide_from_right"
});
}} arrow={!disabled} disabled={disabled} />;
};
FamilyCenterSettingsTeenControls = function FamilyCenterSettingsTeenControls() {
let activeLinkUserIds, navigation;
const handleOpenSettings2 = function handleOpenSettings() {
navigation.navigate(UserSettingsSections.CONTENT_AND_SOCIAL);
};
const styles = useStyles();
activeLinkUserIds = useActiveLinkUserIds();
const selectedTeenUser2 = useSelectedTeenUser();
let r8 = useIsFamilyCenterV3Enabled({
location: "FamilyCenterSettingsControls"
});
navigation = useNavigation();
let r9 = selectedTeenUser2 == null ? void 0 : selectedTeenUser2.restrictedSchedule?.rules;
if (r9 == null) {
r9 = [];
}
const spendingLimitFromUserSettings = useSpendingLimitFromUserSettings();
const scheduleTimeControlsRowProps = useScheduleTimeControlsRowProps(r9);
const { subLabel, trailing } = scheduleTimeControlsRowProps;
const r83 = [<Stack style={styles.controlledSettingsHeader}>
<Text variant="text-sm/semibold">
{intl.string(FamilyCenter_messages.ahKIJO)}
</Text>
<Text variant="text-sm/medium" color="text-muted">
{intl.format(FamilyCenter_messages.X9rW0j, {
openSettingsHook: (a0, a1) => <Text key={a1} variant="text-sm/medium" color="text-link" onPress={handleOpenSettings2}>
{a0}
</Text>
})}
</Text>
</Stack>, , ,];
const r84 = r9;
if (r8) {
r8 = <View style={styles.controlsGroup}>
<TableRowGroup hasIcons={false}>
<SpendingLimitRow cap={spendingLimitFromUserSettings} />
<TableRow label={intl.string(FamilyCenter_messages["1Op+NP"])} subLabel={subLabel} trailing={trailing} onPress={r84.length > 0 ? function() {
navigation.navigate(UserSettingsSections.FAMILY_CENTER_PARENTAL_CONTROLS, {
selectedSubPage: FamilyCenterSubPages.SCREEN_TIME_CONTROLS
});
} : void 0} arrow={r84.length > 0} />
</TableRowGroup>
</View>;
}
r83[1] = r8;
r83[2] = <Button text={intl.formatToPlainString(FamilyCenter_messages.w0JA3P, {
count: activeLinkUserIds.length
})} onPress={function onPress() {
popLayer();
ChannelActionCreators.openPrivateChannel({
recipientIds: activeLinkUserIds
});
}} shrink grow={false} variant="secondary" size="sm" />;
return <Stack style={styles.teenControlsContainer}>{r83}</Stack>;
};
FamilyCenterSettingsParentalControls = function FamilyCenterSettingsParentalControls() {
const styles = useStyles();
const selectedTeenUser = useSelectedTeenUser();
const shouldLoadSettingsForSelectedTeenUser = useShouldLoadSettingsForSelectedTeenUser();
const isFamilyCenterV3Enabled = useIsFamilyCenterV3Enabled({
location: "FamilyCenterSettingsControls"
});
const navigation2 = useNavigation();
let r39 = selectedTeenUser == null ? void 0 : selectedTeenUser.restrictedSchedule?.rules;
if (r39 == null) {
r39 = [];
}
let c20798_3 = r39;
const controlledSetting = ParentalControlledSpendingLimit.useControlledSetting(selectedTeenUser?.id);
useEffect(() => {
if (selectedTeenUser?.id != null && shouldLoadSettingsForSelectedTeenUser) {
FamilyCenterActionCreators.fetchTeenSettingsAndConsents(selectedTeenUser.id);
}
}, [selectedTeenUser?.id, shouldLoadSettingsForSelectedTeenUser]);
const scheduleTimeControlsRowProps = useScheduleTimeControlsRowProps(r39);
const { subLabel, trailing } = scheduleTimeControlsRowProps;
return <Stack style={styles.parentalControlsContainer}>
<Text variant="text-sm/semibold">
{intl.string(FamilyCenter_messages.ahKIJO)}
</Text>
<Text variant="text-sm/medium" color="text-muted">
{intl.string(FamilyCenter_messages.Sv236e)}
</Text>
<View style={styles.controlsGroup}>
<TableRowGroup hasIcons={false}>
<TableRow label={intl.string(t["+o1pDZ"])} onPress={() => {
navigation2.navigate(UserSettingsSections.FAMILY_CENTER_PARENTAL_CONTROLS, {
selectedSubPage: FamilyCenterSubPages.CONTENT_AND_SOCIAL
});
}} arrow />
<TableRow label={intl.string(t.OAuOHD)} onPress={() => {
navigation2.navigate(UserSettingsSections.FAMILY_CENTER_PARENTAL_CONTROLS, {
selectedSubPage: FamilyCenterSubPages.DATA_AND_PRIVACY
});
}} arrow />
{(isFamilyCenterV3Enabled ? selectedTeenUser?.id != null : isFamilyCenterV3Enabled) && <SpendingLimitRow cap={controlledSetting} teenId={selectedTeenUser.id} />}
{isFamilyCenterV3Enabled && selectedTeenUser?.id != null && <TableRow label={intl.string(FamilyCenter_messages["1Op+NP"])} subLabel={subLabel} trailing={trailing} onPress={function onPress() {
navigation2.navigate(UserSettingsSections.FAMILY_CENTER_PARENTAL_CONTROLS, {
selectedSubPage: FamilyCenterSubPages.SCREEN_TIME_CONTROLS,
autoOpenCreate: c20798_3.length === 0 && selectedTeenUser?.id != null
});
}} arrow />}
</TableRowGroup>
</View>
</Stack>;
};
useStyles = createStyles({
teenControlsContainer: {
gap: Module712.space.PX_16
},
controlledSettingsHeader: {
gap: Module712.space.PX_4
},
parentalControlsContainer: {
gap: Module712.space.PX_4
},
controlsGroup: {
marginTop: Module712.space.PX_8
},
subLabelWarning: {
color: Module712.colors.ICON_FEEDBACK_WARNING
},
subLabelCritical: {
color: Module712.colors.TEXT_FEEDBACK_CRITICAL
}
});
export default function FamilyCenterSettingsControls() {
const userIsTeenAgeGroup = useUserIsTeenAgeGroup();
return useActiveLinkUserIds().length !== 0 ? <View>
{userIsTeenAgeGroup ? <FamilyCenterSettingsTeenControls /> : <FamilyCenterSettingsParentalControls />}
</View> : null;
};
@@ -0,0 +1,101 @@
// Metro module 13927 (f13928).
import { useCallback } from "react";
import { View } from "react-native";
import UserStore from "../../../stores/UserStore";
import FamilyCenterStore from "../FamilyCenterStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import TouchableHitBox from "../../../design/void/TouchableHitBox/native/TouchableHitBox";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { Text } from "../../../design/components/Text/native/Text";
import { Avatar, AvatarSizes } from "../../../design/void/native";
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "row",
flexWrap: "wrap",
gap: Module712.space.PX_8
},
section: {
flex: 1
},
avatarList: {
display: "flex",
flexDirection: "row",
gap: Module712.space.PX_4,
flexWrap: "wrap",
paddingTop: Module712.space.PX_12,
paddingBottom: Module712.space.PX_12
},
touchableHitBox: {
width: "100%",
alignItems: "flex-start"
},
guildAvatar: {
borderRadius: Module712.radii.md,
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGHEST
},
guildAvatarText: {
fontSize: 12
}
});
export default function FamilyCenterTopActivity() {
let r41;
let styles, stateFromStores, stateFromStores2;
L7: {
styles = useStyles();
stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getTopUserActivities());
stateFromStores2 = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getTopGuildActivities());
const callback2 = useCallback(() => {
ActionSheetActionCreators.openLazy(import("./FamilyCenterTopUsersBottomSheet"), "FamilyCenterTopUsers", {
topUserActivities: stateFromStores
});
}, [stateFromStores]);
const callback = useCallback(() => {
ActionSheetActionCreators.openLazy(import("./FamilyCenterTopServersBottomSheet"), "FamilyCenterTopServers", {
topGuildActivities: stateFromStores2
});
}, [stateFromStores2]);
if (stateFromStores.length === 0) {
const length = stateFromStores2.length;
r41 = null;
if (length === 0) {
break L7;
}
}
r41 = <View style={styles.container}>
{stateFromStores.length > 0 && <View style={styles.section}>
<TouchableHitBox style={styles.touchableHitBox} onPress={callback2} accessibilityRole="button" accessibilityLabel={intl.string(FamilyCenter_messages.BxbvS7)}>
<Text variant="text-sm/semibold">
{intl.string(FamilyCenter_messages.BxbvS7)}
</Text>
<View style={styles.avatarList}>
{stateFromStores.map((stateFromStore) => {
const user = UserStore.getUser(stateFromStore.user_id);
return user != null ? <Avatar key={user.id} user={user} size={AvatarSizes.SMALL} guildId={void 0} /> : null;
})}
</View>
</TouchableHitBox>
</View>}
{stateFromStores2.length > 0 && <View style={styles.section}>
<TouchableHitBox style={styles.touchableHitBox} onPress={callback} accessibilityRole="button" accessibilityLabel={intl.string(FamilyCenter_messages.Lq9Set)}>
<Text variant="text-sm/semibold">
{intl.string(FamilyCenter_messages.Lq9Set)}
</Text>
<View style={styles.avatarList}>
{stateFromStores2.map((item) => {
const guild = FamilyCenterStore.getGuild(item.guild_id);
return guild != null ? <GuildIcon key={guild.id} style={styles.guildAvatar} textStyle={styles.guildAvatarText} guild={guild} size={GuildIconSizes.SMALL} /> : null;
})}
</View>
</TouchableHitBox>
</View>}
</View>;
}
return r41;
};
@@ -0,0 +1,44 @@
// Metro module 13929 (f13930).
import FamilyCenterStore from "../FamilyCenterStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getTopUserOrGuildDescription } from "../FamilyCenterUtils";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import GuildIcon from "../../guild/native/GuildIcon";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
let useStyles;
const GuildRow = function GuildRow(props) {
const guildActivity = props.guildActivity;
const styles = useStyles();
const stateFromStores = useStateFromStores([FamilyCenterStore], () => FamilyCenterStore.getGuild(guildActivity.guild_id));
if (stateFromStores == null) {
return null;
}
return <TableRow label={stateFromStores.name} subLabel={getTopUserOrGuildDescription(guildActivity.messages_sent, guildActivity.call_count)} icon={<GuildIcon guild={stateFromStores} style={styles.guildIcon} />} />;
};
useStyles = createStyles({
header: {
textAlign: "center"
},
guildIcon: {
borderRadius: Module712.radii.md,
borderColor: Module712.colors.BACKGROUND_BASE_LOW,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
}
});
export default function FamilyCenterTopGuildsBottomSheet(props) {
const topGuildActivities = props.topGuildActivities;
return <ActionSheet>
<Text variant="text-md/bold" style={useStyles().header}>
{intl.string(FamilyCenter_messages.Lq9Set)}
</Text>
<TableRowGroup hasIcons>
{topGuildActivities.map((topGuildActivity) => <GuildRow key={topGuildActivity.guild_id} guildActivity={topGuildActivity} />)}
</TableRowGroup>
</ActionSheet>;
};
@@ -0,0 +1,38 @@
// Metro module 13928 (f13929).
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { getTopUserOrGuildDescription } from "../FamilyCenterUtils";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import UserUtils from "../../../utils/UserUtils";
import { Avatar, AvatarSizes } from "../../../design/void/native";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
let useStyles;
const UserRow = function UserRow(props) {
const userActivity = props.userActivity;
const user = UserStore.getUser(userActivity.user_id);
if (user == null) {
return null;
}
const topUserOrGuildDescription = getTopUserOrGuildDescription(userActivity.dms_sent, userActivity.call_count);
return <TableRow label={UserUtils.getName(user)} subLabel={topUserOrGuildDescription} icon={<Avatar size={AvatarSizes.SMALL} user={user} guildId={void 0} />} />;
};
useStyles = createStyles({
header: {
textAlign: "center"
}
});
export default function FamilyCenterTopUsersBottomSheet(props) {
const topUserActivities = props.topUserActivities;
return <ActionSheet>
<Text variant="text-md/bold" style={useStyles().header}>
{intl.string(FamilyCenter_messages.BxbvS7)}
</Text>
<TableRowGroup hasIcons>
{topUserActivities.map((topUserActivity) => <UserRow key={topUserActivity.user_id} userActivity={topUserActivity} />)}
</TableRowGroup>
</ActionSheet>;
};
@@ -0,0 +1,23 @@
// Metro module 13923 (f13924).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import UserUtils from "../../../utils/UserUtils";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
justifyContent: "center"
}
});
export default function FamilyCenterUsernameHeader(props) {
const user = props.user;
return <View style={useStyles().container}>
<Text variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>
{UserUtils.useName(user)}
<Text variant="text-md/medium" color="text-muted" lineClamp={1}>
{` (@${UserUtils.getUserTag(user, {
decoration: "never"
})})`}
</Text>
</Text>
</View>;
};
@@ -0,0 +1,111 @@
// Metro module 15823 (f15824).
import { useMemo, useCallback } from "react";
import { Pressable, StyleSheet, View } from "react-native";
import { FamilyCenterSubPages } from "../FamilyCenterConstants";
import { AnalyticEvents, UserSettingsSections, VerticalGradient } from "../../../Constants";
import Module712 from "../../../_bundle/Module712";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { useParentalConsentWarning } from "../useParentalConsentWarning";
import { useIsParentalConsentBannerActive } from "../useIsParentalConsentBannerActive";
import { useIsOnMainSurface } from "../hooks/useIsOnMainSurface.native";
import { useGlobalStatusIndicatorState } from "../../connectivity/native/useGlobalStatusIndicatorState";
import { useToken } from "../../../design/tokens/native/useToken";
import tinycolor from "../../../_bundle/tinycolor";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import { Text } from "../../../design/components/Text/native/Text";
import Module4611 from "../../../_bundle/Module4611";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
const marginTop = 28 + Module712.space.PX_16;
const locations = [0.5875, 1];
const useStyles = createStyles({
strip: {
position: "absolute",
top: 0,
left: 0,
right: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
pressable: {
...StyleSheet.absoluteFillObject,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: Module712.space.PX_12,
paddingBottom: Module712.space.PX_16
},
label: {
paddingRight: Module712.space.PX_8
},
link: {
textDecorationLine: "underline"
}
});
export default function ParentalConsentWarningBanner(props) {
let days_remaining;
const children = props.children;
days_remaining = void 0;
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const parentalConsentWarning = useParentalConsentWarning();
const isParentalConsentBannerActive = useIsParentalConsentBannerActive();
let r38 = useIsOnMainSurface();
const isVisible = useGlobalStatusIndicatorState().isVisible;
const token = useToken(Module712.colors.BACKGROUND_FEEDBACK_WARNING);
const memo = useMemo(() => [token, tinycolor(token).setAlpha(0).toRgbString()], [token]);
let r25 = parentalConsentWarning?.daysRemaining;
if (r25 == null) {
r25 = null;
}
days_remaining = r25;
if (r38) {
r38 = isParentalConsentBannerActive;
}
if (r38) {
r38 = !isVisible;
}
if (r38) {
r38 = days_remaining != null;
}
if (r38) {
r38 = days_remaining >= 0;
}
const height = safeAreaInsets_native.top + marginTop;
const callback2 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.PARENTAL_CONSENT_WARNING_BANNER_TAPPED, {
days_remaining
});
FamilyCenterActionCreators.selectTab(FamilyCenterSubPages.REQUESTS);
openUserSettings({
screen: UserSettingsSections.FAMILY_CENTER
});
}, [days_remaining]);
const callback = useCallback((a0, a1) => <Text key={a1} variant="text-sm/medium" color="text-strong" style={styles.link}>
{a0}
</Text>, [styles.link]);
const r72 = [<View style={[StyleSheet.absoluteFill, {
marginTop: r38 ? marginTop : 0
}]}>{children}</View>, ,];
const r73 = r38 ? days_remaining != null ? <View style={[styles.strip, {
height
}]} pointerEvents="box-none">
<Module4611 pointerEvents="none" style={StyleSheet.absoluteFill} colors={memo} locations={locations} start={VerticalGradient.START} end={VerticalGradient.END} />
<Pressable accessibilityRole="button" accessibilityHint={intl.string(FamilyCenter_messages.O2HKdA)} onPress={callback2} style={[styles.pressable, {
paddingTop: safeAreaInsets_native.top + 8
}]}>
<Text variant="text-sm/medium" color="text-strong" lineClamp={1} style={styles.label}>
{days_remaining === 0 ? intl.format(FamilyCenter_messages.Gfqlpa, {
connectHook: callback
}) : intl.format(FamilyCenter_messages.ZBK5mM, {
count: days_remaining,
connectHook: callback
})}
</Text>
</Pressable>
</View> : null : null;
r72[1] = r73;
return <>{r72}</>;
};
@@ -0,0 +1,78 @@
// Metro module 16294 (f16295).
import ActionSheetStore from "../../action_sheet/native/ActionSheetStore";
import FamilyCenterStore from "../FamilyCenterStore";
import ParentalConsentWarningStore from "../ParentalConsentWarningStore";
import { UserLinkStatus, UserLinkType } from "../FamilyCenterConstants";
import { AppStates } from "../../../Constants";
import { ParentalConsentWarningSurface } from "../ParentalConsentWarningTypes";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { maybeFetchWarning, forceFetchWarning, resetFetchState } from "../ParentalConsentWarningActionCreators";
let c11713_3, $mk99174 = function() {
return (a0) => a0.link_status === UserLinkStatus.ACTIVE && a0.link_type === UserLinkType.PARENT;
};
const maybePresentModal = function maybePresentModal(warning) {
const daysRemaining = warning?.daysRemaining;
const r11 = warning == null;
let r5 = void 0;
if (!r11) {
const surfaces = warning.surfaces;
r5 = surfaces == null ? void 0 : surfaces.includes(ParentalConsentWarningSurface.MODAL);
}
if (r5 === true && daysRemaining != null && daysRemaining >= 0 && !ParentalConsentWarningStore.hasShownModalToday() && !Object.values(FamilyCenterStore.getLinkedUsers()).some($mk99174()) && !ActionSheetStore.isOpen()) {
ActionSheetActionCreators.openLazy(import("./ParentalConsentWarningModal"), "ParentalConsentWarningModal", {
daysRemaining
});
}
};
class ParentalConsentWarningManager extends AutomaticLifecycleManager {
actions = {
PARENTAL_CONSENT_WARNING_FETCH_SUCCESS: (a0) => {
maybePresentModal(a0.warning);
},
POST_CONNECTION_OPEN: () => {
c11713_3 = Object.values(FamilyCenterStore.getLinkedUsers()).some($mk99174());
maybeFetchWarning();
if (!ParentalConsentWarningStore.shouldFetchToday()) {
maybePresentModal(ParentalConsentWarningStore.getWarning());
}
},
APP_STATE_UPDATE: (a0) => {
if (a0.state === AppStates.ACTIVE) {
maybeFetchWarning();
if (!ParentalConsentWarningStore.shouldFetchToday()) {
maybePresentModal(ParentalConsentWarningStore.getWarning());
}
}
},
CURRENT_USER_UPDATE: ({ user }) => {
if (user.linked_users !== void 0) {
const r12 = user.linked_users.some($mk99174());
const r13 = c11713_3;
c11713_3 = r12;
if (r13 !== void 0 && r13 !== r12) {
if (r12) {
const warning = ParentalConsentWarningStore.getWarning();
const r2 = warning == null;
let r24 = void 0;
if (!r2) {
const surfaces = warning.surfaces;
r24 = surfaces == null ? void 0 : surfaces.includes(ParentalConsentWarningSurface.BANNER);
}
if (r24 === true) {
forceFetchWarning();
}
} else {
forceFetchWarning();
}
}
}
},
LOGOUT: () => {
c11713_3 = void 0;
resetFetchState();
}
};
}
const parentalConsentWarningManager = new ParentalConsentWarningManager();
export default parentalConsentWarningManager;
@@ -0,0 +1,135 @@
// Metro module 16295 (f16296).
import { useEffect, useRef, useCallback } from "react";
import { View } from "react-native";
import FamilyCenterStore from "../FamilyCenterStore";
import { FamilyCenterSubPages, UserLinkStatus, UserLinkType } from "../FamilyCenterConstants";
import { AnalyticEvents, UserSettingsSections } from "../../../Constants";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { DismissibleContent } from "../../../_bundle/Module1358";
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import ModalDispatchQueue from "../../main_tabs_v2/native/modal/ModalDispatchQueue";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { useSyncMessages, intl } from "../../../intl/index.native";
import FamilyCenter_messages, { messagesLoader } from "../FamilyCenter.messages";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import Dispatcher from "../../../Dispatcher";
import { markTimeRecurringDismissibleContentAsDismissed } from "../../dismissible_content/DismissibleContentUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { FamilyKeysSpotIllustration } from "../../../design/assets/native";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
const surface_type = "modal";
const PARENTAL_CONSENT_GRACE_WARNING = DismissibleContent.PARENTAL_CONSENT_GRACE_WARNING;
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_16
},
illustration: {
alignItems: "center",
paddingTop: Module712.space.PX_12
},
title: {
textAlign: "center"
},
body: {
textAlign: "center"
}
});
export default function ParentalConsentWarningModal(props) {
let ref, callback, callback2;
const daysRemaining = props.daysRemaining;
ref = void 0;
callback = void 0;
callback2 = void 0;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
useSyncMessages(messagesLoader);
const r3 = daysRemaining === 0;
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.PARENTAL_CONSENT_WARNING_SURFACE_SHOWN, {
surface_type,
days_remaining: daysRemaining
});
Dispatcher.dispatch({
type: "PARENTAL_CONSENT_WARNING_MODAL_SHOWN"
});
}, []);
ref = useRef(false);
callback = useCallback(() => {
const current = ref.current;
let r0 = !current;
if (!current) {
ref.current = true;
markTimeRecurringDismissibleContentAsDismissed(PARENTAL_CONSENT_GRACE_WARNING, {
dismissAction: ContentDismissActionType.USER_DISMISS
});
r0 = true;
}
return r0;
}, []);
callback2 = useCallback(() => {
if (callback()) {
AnalyticsUtils.track(AnalyticEvents.PARENTAL_CONSENT_WARNING_SURFACE_DISMISSED, {
surface_type,
days_remaining: daysRemaining
});
}
}, [daysRemaining, callback]);
const callback4 = useCallback(() => {
callback2();
ActionSheetActionCreators.hideActionSheet();
}, [callback2]);
const callback3 = useCallback(() => {
L6: {
callback();
ActionSheetActionCreators.hideActionSheet();
if (Object.values(FamilyCenterStore.getLinkedUsers()).some((item) => item.link_status === UserLinkStatus.PENDING && item.link_type === UserLinkType.PARENT)) {
FamilyCenterActionCreators.selectTab(FamilyCenterSubPages.REQUESTS);
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
openUserSettings({
screen: UserSettingsSections.FAMILY_CENTER
});
break L6;
}
ModalDispatchQueue.enqueue(() => openUserSettings({
screen: UserSettingsSections.FAMILY_CENTER
}));
} else {
ModalActionCreators.pushLazy(import("./ConnectGuardianShareModal"));
}
}
}, [callback]);
return <BottomSheet startExpanded onDismiss={callback2}>
<View style={[styles.container, {
paddingBottom: bottom
}]}>
<Stack spacing={Module712.space.PX_16}>
<View style={styles.illustration}>
<FamilyKeysSpotIllustration accessible={false} />
</View>
<Text variant="heading-lg/bold" color="text-default" style={styles.title} accessibilityRole="header">
{r3 ? intl.string(FamilyCenter_messages.Zo5YZD) : intl.formatToPlainString(FamilyCenter_messages.b4sYUn, {
count: daysRemaining
})}
</Text>
<Text variant="text-md/medium" color="text-default" style={styles.body}>
{r3 ? intl.string(FamilyCenter_messages.CRZBSY) : intl.formatToPlainString(FamilyCenter_messages.mQcGGY, {
count: daysRemaining
})}
</Text>
<Stack spacing={Module712.space.PX_8}>
<Button size="lg" variant="primary" grow text={intl.string(FamilyCenter_messages.Kp7sjX)} onPress={callback3} />
<Button size="lg" variant="secondary" grow text={intl.string(FamilyCenter_messages.hST5o8)} accessibilityHint={intl.string(FamilyCenter_messages["4fZtHa"])} onPress={callback4} />
</Stack>
</Stack>
</View>
</BottomSheet>;
};
@@ -0,0 +1,238 @@
// Metro module 16113 (f16114).
import { useEffect, useRef, useState, useCallback } from "react";
import { View, StyleSheet } from "react-native";
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import useFormattedEndTime from "../hooks/useFormattedEndTime";
import { useStateFromStores } from "../../../_bundle/Module589";
import ReanimatedRexport, { useSharedValue, Easing, withDelay, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { ModalScreen } from "../../../design/components/Modal/native/ModalScreen.native";
import * as _Module16115 from "../../../_bundle/Module16115";
import { TeenScreenTimeRive } from "../../../_bundle/Module3901";
import { Text } from "../../../design/components/Text/native/Text";
import { useNavigatorScreens } from "../../../design/components/Navigator/native/Navigator.native";
import useIsInRestrictedHours from "../hooks/useIsInRestrictedHours";
import AuthenticationActionCreators from "../../../actions/AuthenticationActionCreators";
import { closeRestrictedHoursModal } from "../RestrictedHoursActionCreators.native";
import useBackPressHandler from "../../routing/native/useBackPressHandler";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
let backgroundColor, useStyles, c11538_11, __initData, __initData2, __initData3, RestrictedHoursScreen;
const RestrictedHoursLogoutBlockingLayer = function RestrictedHoursLogoutBlockingLayer(props) {
const visible = props.visible;
const styles = useStyles();
return visible ? <View style={styles.logoutBlockingLayer} pointerEvents="auto" accessibilityLiveRegion="polite">
<ActivityIndicator size="large" />
</View> : null;
};
RestrictedHoursScreen = function RestrictedHoursScreen(props) {
let sharedValue, sharedValue2, sharedValue3, sharedValue4;
const { onLogin, logoutRequestInFlight } = props;
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue3 = void 0;
sharedValue4 = void 0;
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const { top, bottom } = safeAreaInsets_native;
const formattedEndTime = useFormattedEndTime();
const stateFromStores = useStateFromStores([UserStore], () => {
let r6 = UserStore.getCurrentUser()?.username;
if (r6 == null) {
r6 = "";
}
return r6;
});
sharedValue = useSharedValue(0);
sharedValue2 = useSharedValue(0);
sharedValue3 = useSharedValue(0);
sharedValue4 = useSharedValue(0.9);
useEffect(() => {
sharedValue.set(withTiming(1, {
duration: 3000,
easing: Easing.bezier(0.24, 0.27, 0.58, 1)
}));
sharedValue2.set(withDelay(1500, withTiming(1, {
duration: 1500,
easing: Easing.bezier(0, 0, 1, 1)
})));
sharedValue3.set(withDelay(2000, withTiming(1, {
duration: 1000,
easing: Easing.bezier(0.1, 0.24, 0.32, 1)
})));
sharedValue4.set(withDelay(2000, withTiming(1, {
duration: 1000,
easing: Easing.bezier(0.1, 0.24, 0.32, 1)
})));
}, [sharedValue, sharedValue2, sharedValue3, sharedValue4]);
const M = () => ({
opacity: sharedValue.get()
});
M.__closure = {
backgroundOpacity: sharedValue
};
M.__workletHash = 17073775693336;
M.__initData = __initData;
const animatedStyle2 = useAnimatedStyle(M);
const O = () => ({
opacity: sharedValue2.get()
});
O.__closure = {
gradientOpacity: sharedValue2
};
O.__workletHash = 16592270370139;
O.__initData = __initData2;
const animatedStyle = useAnimatedStyle(O);
const z = () => ({
opacity: sharedValue3.get(),
transform: [{
scale: sharedValue4.get()
}]
});
z.__closure = {
contentOpacity: sharedValue3,
contentScale: sharedValue4
};
z.__workletHash = 15616799997783;
z.__initData = __initData3;
return <ModalScreen backgroundColor={backgroundColor}>
<ReanimatedRexport.View style={[styles.container, {
paddingTop: top,
paddingBottom: bottom
}, animatedStyle2]}>
<View style={styles.backgroundFill} pointerEvents="none" />
<ReanimatedRexport.View style={[styles.assetLayers, animatedStyle]} pointerEvents="none">
<ReanimatedRexport.Image source={_Module16115} resizeMode="cover" style={styles.sunbeamGradient} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.content, useAnimatedStyle(z)]}>
<View style={styles.riveContainer}>
<TeenScreenTimeRive artboard="Teen Screen Time Illo" stateMachine="State Machine 1" />
</View>
<Text variant="text-lg/medium" color="text-overlay-light" style={styles.description}>
{formattedEndTime != null ? intl.format(FamilyCenter_messages.VfqJvY, {
endTime: formattedEndTime
}) : intl.string(FamilyCenter_messages.abikhN)}
</Text>
</ReanimatedRexport.View>
<View style={styles.footer}>
<Text variant="text-sm/medium" color="text-subtle" style={styles.description}>
{intl.format(FamilyCenter_messages.iqeKDz, {
username: stateFromStores,
loginHook: (a0, a1) => <Text key={a1} variant="text-sm/normal" color="text-link" onPress={onLogin}>
{a0}
</Text>
})}
</Text>
</View>
</ReanimatedRexport.View>
<RestrictedHoursLogoutBlockingLayer visible={logoutRequestInFlight} />
</ModalScreen>;
};
backgroundColor = "rgb(0, 3, 40)";
useStyles = createStyles({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
paddingHorizontal: Module712.space.PX_24
},
backgroundFill: {
...StyleSheet.absoluteFillObject,
zIndex: 0,
backgroundColor: "rgb(0, 3, 40)"
},
assetLayers: {
...StyleSheet.absoluteFillObject,
zIndex: 1
},
sunbeamGradient: {
...StyleSheet.absoluteFillObject
},
riveContainer: {
width: "100%",
maxWidth: 523,
height: 300
},
content: {
alignItems: "center",
width: "100%",
gap: Module712.space.PX_16,
zIndex: 2
},
description: {
textAlign: "center"
},
footer: {
position: "absolute",
bottom: Module712.space.PX_32,
alignSelf: "center",
zIndex: 2
},
logoutBlockingLayer: {
...StyleSheet.absoluteFillObject,
zIndex: 10,
justifyContent: "center",
alignItems: "center",
backgroundColor: "rgb(0, 3, 40)"
}
});
c11538_11 = {
MAIN: "main"
};
__initData = {
code: "function RestrictedHoursModalTsx1(){const{backgroundOpacity}=this.__closure;return{opacity:backgroundOpacity.get()};}"
};
__initData2 = {
code: "function RestrictedHoursModalTsx2(){const{gradientOpacity}=this.__closure;return{opacity:gradientOpacity.get()};}"
};
__initData3 = {
code: "function RestrictedHoursModalTsx3(){const{contentOpacity,contentScale}=this.__closure;return{opacity:contentOpacity.get(),transform:[{scale:contentScale.get()}]};}"
};
export default function RestrictedHoursModal() {
let callback, state;
const isInRestrictedHours = useIsInRestrictedHours();
let c22801_0 = isInRestrictedHours;
const ref = useRef(false);
const ref2 = useRef(true);
useEffect(() => {
ref2.current = true;
return () => {
ref2.current = false;
};
}, []);
const [state2, setState] = useState(false);
callback = useCallback(() => {
if (!ref.current) {
ref.current = true;
setState(true);
AuthenticationActionCreators.logout("restricted_hours").finally(() => {
if (ref2.current) {
ref.current = false;
setState(false);
}
});
}
}, []);
state = state2;
const navigatorScreens = useNavigatorScreens(() => {
const r0 = {};
r0[c11538_11.MAIN] = {
headerShown: false,
gestureEnabled: false,
render: () => <RestrictedHoursScreen onLogin={callback} logoutRequestInFlight={state} />
};
return r0;
}, [callback, state]);
useEffect(() => {
if (!(c22801_0 || ref.current)) {
closeRestrictedHoursModal();
}
}, [isInRestrictedHours]);
useBackPressHandler(() => true);
return <Modal screens={navigatorScreens} initialRouteName={c11538_11.MAIN} />;
};
@@ -0,0 +1,403 @@
// Metro module 13965 (f13966).
import { useMemo, useState, useCallback, useLayoutEffect } from "react";
import { Pressable, ScrollView, View } from "react-native";
import UserStore from "../../../stores/UserStore";
import { UserSettingsSections } from "../../../Constants";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { HelpMessage, HelpMessageTypes } from "../../../design/void/native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
import { useStackNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { useSettingNavigationRoute } from "../../user_settings/core/native/useSettingNavigationRoute";
import { toTimeProto, getShortDayLabels, computeOverlappingInfo, timeToMinutes, formatTime, DAYS_ORDERED } from "../FamilyCenterRestrictedHoursUtils";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useTimeValue from "../hooks/useTimeValue";
import { updateRestrictedScheduleRule, addRestrictedScheduleRule, deleteRestrictedScheduleRule } from "../RestrictedScheduleActionCreators";
import { TrashIcon } from "../../../design/components/Icon/native/redesign/generated/TrashIcon";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableSwitchRow } from "../../../design/components/TableRow/native/TableSwitchRow.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { Button } from "../../../design/components/Button/native/Button.native";
function $mk92354($env) {
return (a0) => (0, $env[0])({
hours: a0.hours(),
minutes: a0.minutes()
});
}
let useStyles;
const OverlappingSchedulesWarning = function OverlappingSchedulesWarning(props) {
const conflictingEntries = props.conflictingEntries;
return conflictingEntries.length !== 0 ? <HelpMessage messageType={HelpMessageTypes.WARNING} borderRadius={Module712.radii.md}>
<Stack spacing={8}>
<Text variant="text-sm/medium">
{intl.string(FamilyCenter_messages["26A0Df"])}
</Text>
<Stack spacing={4}>
{conflictingEntries.map((conflictingEntry) => {
const dayLabel = conflictingEntry.dayLabel;
return <Text key={dayLabel} variant="text-sm/medium">
{`${dayLabel} ${conflictingEntry.timeRange}`}
</Text>;
})}
</Stack>
</Stack>
</HelpMessage> : null;
};
useStyles = createStyles({
container: {
flex: 1
},
scrollContent: {
paddingHorizontal: Module712.space.PX_16,
paddingTop: Module712.space.PX_24,
gap: Module712.space.PX_24
},
section: {
gap: Module712.space.PX_8
},
sectionHeader: {
gap: Module712.space.PX_4
},
daysContainer: {
flexDirection: "row",
gap: Module712.space.PX_8
},
dayButton: {
flex: 1,
aspectRatio: 1,
borderRadius: Module712.radii.round,
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND,
borderWidth: 1,
borderColor: "transparent"
},
dayButtonSelected: {
backgroundColor: "rgba(88, 101, 242, 0.16)",
borderColor: "rgba(88, 101, 242, 1)"
},
overlapWarningContent: {
marginTop: Module712.space.PX_24
},
footer: {
paddingHorizontal: Module712.space.PX_16,
paddingVertical: Module712.space.PX_16,
gap: Module712.space.PX_8
}
});
export default function ScheduleDowntimeScreen() {
let styles, stackNavigation, rule, memo, memo2, teenId, c20817_6, stateFromStores, c20817_10, c20817_12, memo3, callback;
let _handleSubmit2 = function _handleSubmit() {
const r9 = async () => {
let r56;
let c30679_2;
let c30679_3 = 0;
L18: {
try {
if (teenId != null) {
setState3(true);
c30679_3 = 1;
const r19 = {
label: "",
start_time: toTimeProto(c20817_10),
end_time: toTimeProto(c20817_12),
days: Array.from(state2),
enabled: state
};
if (c20817_6) {
if (rule?.ruleId != null) {
await updateRestrictedScheduleRule(teenId, rule.ruleId, r19);
} else {
r56 = addRestrictedScheduleRule(teenId, r19);
await r56;
}
} else {
r56 = addRestrictedScheduleRule(teenId, r19);
await r56;
}
stackNavigation.goBack();
c30679_3 = 0;
(0, setState3)(false);
break L18;
}
} catch ($e) {
const r33 = $e;
let r7 = r33;
c30679_2 = r33;
if (c30679_3 !== 0) {
while (true) {
try {
const r117 = c30679_2;
c30679_3 = 0;
(0, setState3)(false);
throw r117;
} catch (r114) {
r7 = r114;
c30679_2 = r114;
if (c30679_3 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
_handleSubmit2 = r9;
return r9.apply(this, arguments);
};
styles = useStyles();
stackNavigation = useStackNavigation();
const params = useSettingNavigationRoute().params;
rule = params?.rule;
memo = useMemo(() => getShortDayLabels("narrow"), []);
memo2 = useMemo(() => getShortDayLabels("short"), []);
teenId = params?.teenId;
const r4 = rule != null;
c20817_6 = r4;
let r55 = rule?.enabled;
if (r55 == null) {
r55 = true;
}
const [state, setState] = useState(r55);
stateFromStores = useStateFromStores([UserStore], () => {
let r9;
if (teenId == null) {
r9 = [];
} else {
const user = UserStore.getUser(teenId);
r9 = user == null ? void 0 : user.restrictedSchedule?.rules;
if (r9 == null) {
r9 = [];
}
}
return r9;
});
const r69 = rule?.startTime != null;
let initial = null;
if (r69) {
let minutes = rule.startTime.minutes;
if (minutes == null) {
minutes = 0;
}
initial = {
hours: rule.startTime.hours,
minutes,
seconds: 0,
nanos: 0
};
}
let [r33, c20817_11] = useTimeValue({
initial,
defaultValue: {
hours: 22,
minutes: 0
}
});
c20817_10 = r33;
const r84 = rule?.endTime != null;
let initial2 = null;
if (r84) {
let minutes2 = rule.endTime.minutes;
if (minutes2 == null) {
minutes2 = 0;
}
initial2 = {
hours: rule.endTime.hours,
minutes: minutes2,
seconds: 0,
nanos: 0
};
}
let [r34, c20817_13] = useTimeValue({
initial: initial2,
defaultValue: {
hours: 7,
minutes: 0
}
});
c20817_12 = r34;
const [state2, setState2] = useState(new Set(rule?.days));
const [state3, setState3] = useState(false);
memo3 = useMemo(() => c20817_6 ? rule?.ruleId != null ? stateFromStores.filter((stateFromStore) => stateFromStore.ruleId !== rule.ruleId) : stateFromStores : stateFromStores, [r4, rule?.ruleId, stateFromStores]);
const memo4 = useMemo(() => computeOverlappingInfo(state2, memo3, memo2), [memo2, memo3, state2]);
callback = useCallback(async () => {
let rules, c27596_3;
let c27596_4 = 0;
L24: {
L23: {
try {
if (teenId == null) {
break L24;
}
if (rule?.ruleId != null) {
setState3(true);
c27596_4 = 1;
await deleteRestrictedScheduleRule(teenId, rule.ruleId);
const user = UserStore.getUser(teenId);
rules = user == null ? void 0 : user.restrictedSchedule?.rules;
if (rules == null) {
rules = [];
}
if (rules.length === 0) {
stackNavigation.navigate(UserSettingsSections.FAMILY_CENTER);
} else {
stackNavigation.goBack();
}
c27596_4 = 0;
(0, setState3)(false);
break L23;
}
break L24;
} catch ($e) {
const r26 = $e;
let r7 = r26;
c27596_3 = r26;
if (c27596_4 !== 0) {
while (true) {
try {
const r93 = c27596_3;
c27596_4 = 0;
(0, setState3)(false);
throw r93;
} catch (r90) {
r7 = r90;
c27596_3 = r90;
if (c27596_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
}, [teenId, rule?.ruleId, stackNavigation]);
useLayoutEffect(() => {
if (c20817_6) {
stackNavigation.setOptions({
headerRight: () => <Pressable onPress={callback} accessibilityRole="button" accessibilityLabel={intl.string(t.oyYWHE)} hitSlop={8} disabled={state3}>
<TrashIcon color={Module712.colors.ICON_FEEDBACK_CRITICAL} size="md" />
</Pressable>
});
}
}, [stackNavigation, r4, callback, state3]);
const r137 = timeToMinutes(r33);
const r141 = timeToMinutes(r34);
const r146 = {
startTime: formatTime(r33),
endTime: formatTime(r34),
timeHook: (a0, a1) => <Text key={a1} variant="text-sm/medium" color="text-default">
{a0}
</Text>
};
const r27 = r137 > r141 ? intl.format(FamilyCenter_messages.R87Y2K, r146) : intl.format(FamilyCenter_messages.vX7xid, r146);
const r168 = state2.size > 0 && r137 !== r141 && !state3;
return teenId == null ? null : <View style={styles.container}>
<ScrollView>
<View style={styles.scrollContent}>
<Text variant="text-md/medium" color="text-subtle">
{intl.string(FamilyCenter_messages.AcJ4ke)}
</Text>
{r4 && <TableRowGroup hasIcons={false}>
<TableSwitchRow label={intl.string(FamilyCenter_messages["30Owsd"])} value={state} onValueChange={function handleEnabledChange() {
setState((prevState) => !prevState);
}} />
</TableRowGroup>}
<View style={styles.section}>
<Text variant="text-sm/semibold" color="text-subtle">
{intl.string(FamilyCenter_messages["37z4a2"])}
</Text>
<TableRowGroup hasIcons={false}>
<TableRow label={intl.string(FamilyCenter_messages.DsXytO)} trailing={<Text variant="text-md/normal">
{formatTime(r33)}
</Text>} arrow onPress={function handleStartTimePress() {
let env27597;
const title = intl.string(FamilyCenter_messages["8bLRt0"]);
const r27 = env27597 = {};
env27597[0] = (a0) => {
c20817_11(a0);
const r1 = (timeToMinutes(a0) + 540) % 1440;
c20817_13({
hours: Math.floor(r1 / 60),
minutes: r1 % 60
});
};
ActionSheetActionCreators.openLazy(import("../../../components_native/DatePickerActionSheet"), "ScheduleDowntimeStartTimePicker", {
title,
mode: "time",
startDate: new Date(2025, 0, 1, c20817_10.hours, c20817_10.minutes, 0, 0),
onSubmit: $mk92354(r27)
});
}} />
<TableRow label={intl.string(FamilyCenter_messages["5SHDP6"])} trailing={<Text variant="text-md/normal">
{formatTime(r34)}
</Text>} arrow onPress={function handleEndTimePress() {
let env27598;
const title = intl.string(FamilyCenter_messages["+JkWJV"]);
const r28 = env27598 = {};
env27598[0] = c20817_13;
ActionSheetActionCreators.openLazy(import("../../../components_native/DatePickerActionSheet"), "ScheduleDowntimeEndTimePicker", {
title,
mode: "time",
startDate: new Date(2025, 0, 1, c20817_12.hours, c20817_12.minutes, 0, 0),
onSubmit: $mk92354(r28)
});
}} />
</TableRowGroup>
</View>
<View style={styles.section}>
<View style={styles.sectionHeader}>
<Text variant="text-sm/semibold" color="text-subtle">
{intl.string(FamilyCenter_messages.HaV0Sg)}
</Text>
<Text variant="text-sm/normal" color="text-muted">{r27}</Text>
</View>
<View style={styles.daysContainer}>
{DAYS_ORDERED.map((item, index) => {
const selected = state2.has(item);
return <Pressable key={item} style={[styles.dayButton, selected && styles.dayButtonSelected]} onPress={() => {
let c30680_0 = item;
setState2((prevState2) => {
const set = new Set(prevState2);
if (set.has(c30680_0)) {
set.delete(c30680_0);
} else {
set.add(c30680_0);
}
return set;
});
}} accessibilityRole="button" accessibilityState={{
selected
}} accessibilityLabel={memo[index]}>
<Text variant="text-sm/semibold" color={selected ? "control-secondary-text-default" : "text-muted"}>
{memo[index]}
</Text>
</Pressable>;
})}
</View>
{memo4.conflictingEntries.length > 0 && <View style={styles.overlapWarningContent}>
<OverlappingSchedulesWarning conflictingEntries={memo4.conflictingEntries} />
</View>}
</View>
</View>
</ScrollView>
<SafeAreaPaddingView bottom>
<View style={styles.footer}>
<Button text={intl.string(r4 ? FamilyCenter_messages.TDc9mW : FamilyCenter_messages.pvcruO)} onPress={function handleSubmit() {
return _handleSubmit2.apply(this, arguments);
}} disabled={!r168} loading={state3} variant="primary" size="lg" />
<Button text={intl.string(t["ETE/oC"])} onPress={() => stackNavigation.goBack()} disabled={state3} variant="secondary" size="lg" />
</View>
</SafeAreaPaddingView>
</View>;
};
@@ -0,0 +1,18 @@
// Metro module 13909 (f13910).
import { FAMILY_CENTER_REQUEST_QR_CODE_URL } from "../FamilyCenterConstants";
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
import { intl } from "../../../intl/index.native";
import FamilyCenter_messages from "../FamilyCenter.messages";
export function shareGuardianConnectLink(a0, a1) {
const url = FAMILY_CENTER_REQUEST_QR_CODE_URL(a0.id, a1);
let globalName = a0.globalName;
if (globalName == null) {
globalName = a0.username;
}
showShareActionSheet({
message: intl.formatToPlainString(FamilyCenter_messages.lVD5Nd, {
username: globalName,
url
})
}, "Family Center Connect Guardian");
}
@@ -0,0 +1,29 @@
// Metro module 6254 (f6255).
import { BillingError } from "../../../errors/index";
import { ErrorCodes } from "../../../errors/BillingError";
import { getActiveLinkUserIds } from "../hooks/useUserLinks";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { popLayer } from "../../../actions/LayerActionCreators";
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
export function isSpendingLimitError(a0) {
return a0 instanceof BillingError && (a0.code === ErrorCodes.BILLING_SPENDING_LIMIT_REACHED || a0.code === ErrorCodes.BILLING_SPENDING_LIMIT_WILL_EXCEED);
}
export function showSpendingLimitReachedAlert() {
const activeLinkUserIds = getActiveLinkUserIds();
AlertActionCreators.show({
title: intl.string(t.QJKKrT),
body: intl.string(t["73Islf"]),
isDismissable: true,
...activeLinkUserIds.length > 0 ? {
confirmText: intl.string(t.GF9RCX),
onConfirm: () => {
popLayer();
ChannelActionCreators.openPrivateChannel({
recipientIds: activeLinkUserIds
});
},
cancelText: intl.string(t.L5eIZ2)
} : {}
});
}
@@ -0,0 +1,13 @@
// Metro module 13896 (f13897).
import { useParentalConsentWarning } from "./useParentalConsentWarning";
import { ParentalConsentWarningSurface } from "./ParentalConsentWarningTypes";
export function useIsParentalConsentBannerActive() {
const parentalConsentWarning = useParentalConsentWarning();
const r2 = parentalConsentWarning == null;
let r11 = void 0;
if (!r2) {
const surfaces = parentalConsentWarning.surfaces;
r11 = surfaces == null ? void 0 : surfaces.includes(ParentalConsentWarningSurface.BANNER);
}
return r11 === true;
}
@@ -0,0 +1,6 @@
// Metro module 13897 (f13898).
import ParentalConsentWarningStore from "./ParentalConsentWarningStore";
import { useStateFromStores } from "../../_bundle/Module589";
export function useParentalConsentWarning() {
return useStateFromStores([ParentalConsentWarningStore], () => ParentalConsentWarningStore.getWarning());
}