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,93 @@
// Metro module 16525 (f16526).
import { Endpoints } from "../../Constants";
import { ApplicationTypes } from "../applications/ApplicationConstants";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
import ApplicationActionCreators from "../applications/ApplicationActionCreators";
let env11888 = {};
env11888[12] = function _requestRemoveMonetization() {
const r8 = async (c28431_0) => {
await HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_REMOVE_MONETIZATION(c28431_0),
body: {},
rejectWithError: rejectWithMigratedError()
});
};
env11888[12] = r8;
return r8.apply(this, arguments);
};
export async function createCreatorMonetizationEnableRequest(c28425_0) {
await HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_ENABLE_REQUESTS(c28425_0),
rejectWithError: rejectWithMigratedError()
});
}
export async function getCreatorMonetizationEligibility(c28426_0) {
return (await HTTP.get({
url: Endpoints.CREATOR_MONETIZATION_ELIGIBILITY(c28426_0),
rejectWithError: rejectWithMigratedError()
})).body;
}
export async function acceptCreatorMonetizationTerms(c28427_0, c28427_1) {
await HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_ACCEPT_TERMS(c28427_0, c28427_1),
rejectWithError: rejectWithMigratedError()
});
}
export async function acceptCreatorMonetizationTermsV2(c28428_0) {
await HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_ACCEPT_TERMS_V2(c28428_0),
rejectWithError: rejectWithMigratedError()
});
}
export async function getCreatorMonetizationOnboardingMarketing(c28429_0) {
return (await HTTP.get({
url: Endpoints.CREATOR_MONETIZATION_MARKETING_ONBOARDING(c28429_0),
rejectWithError: rejectWithMigratedError()
})).body;
}
export async function ownershipTransferOnboard(c28430_0, team_id) {
let c31063_0 = (await HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_OWNERSHIP_TRANSFER_ONBOARD(c28430_0),
body: {
team_id
},
rejectWithError: rejectWithMigratedError()
})).body;
if (c31063_0.application != null) {
Dispatcher.dispatch({
type: "APPLICATION_FETCH_SUCCESS",
application: c31063_0.application
});
}
return c31063_0;
}
export function acceptNewTerms(a0) {
return HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_ACCEPT_NEW_TERMS(a0),
rejectWithError: rejectWithMigratedError()
});
}
export function acceptNewTermsDemonetized(a0) {
return HTTP.post({
url: Endpoints.CREATOR_MONETIZATION_ACCEPT_NEW_TERMS_DEMONETIZED(a0),
rejectWithError: rejectWithMigratedError()
});
}
export async function removeMonetization(c28432_0) {
let env31064;
const r26 = env11888;
let c28432_2 = r26;
const r10 = env31064 = {
$parent: r26
};
let c28432_1 = r10;
env31064[0] = c28432_0;
await (function requestRemoveMonetization() {
return env11888[12].apply(this, arguments);
})(c28432_0);
return await ApplicationActionCreators.getApplicationsForGuild(env31064[0], {
type: ApplicationTypes.GUILD_ROLE_SUBSCRIPTIONS,
includeTeam: true
});
}
@@ -0,0 +1,14 @@
// Metro module 16522 (f16523).
const r9 = {
OPEN: "OPEN",
REJECTED: "REJECTED",
APPROVED: "APPROVED",
ACTION_REQUIRED: "ACTION_REQUIRED"
};
const r14 = {
HOW_IT_WORKS: "HOW_IT_WORKS",
BENEFITS: "BENEFITS",
OTHER_CREATORS: "OTHER_CREATORS"
};
export { r9 as CreatorMonetizationApplicationState };
export { r14 as CreatorMonetizationOnboardingMarketingSection };
@@ -0,0 +1,47 @@
// Metro module 12623 (f12624).
import UserStore from "../../stores/UserStore";
import BillingInfoStore from "../../stores/billing/BillingInfoStore";
import { GuildFeatures } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
let c8710_5 = new Set(["US"]);
export function useIsUserInCreatorMonetizationEligibleCountry() {
return useStateFromStores([UserStore, BillingInfoStore], () => {
const currentUser = UserStore.getCurrentUser();
let r6 = currentUser == null ? void 0 : currentUser.storeCountry?.country;
if (r6 == null) {
r6 = BillingInfoStore.ipCountryCode;
}
return r6 != null && c8710_5.has(r6);
});
}
export function isUserInCreatorMonetizationEligibleCountry() {
const currentUser = UserStore.getCurrentUser();
let r6 = currentUser == null ? void 0 : currentUser.storeCountry?.country;
if (r6 == null) {
r6 = BillingInfoStore.ipCountryCode;
}
return r6 != null && c8710_5.has(r6);
}
export function useIsRavenOnboardingGuild(a0) {
return a0 != null;
}
export function isRavenOnboardingGuild(a0) {
return a0 != null;
}
export function useIsWhitegloveOnboardingGuild(a0) {
return a0 != null && a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_WHITEGLOVE);
}
export function isWhitegloveOnboardingGuild(a0) {
return a0 != null && a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_WHITEGLOVE);
}
export function useIsExpeditedOnboardingGuild(a0) {
let r7 = a0?.id != null;
const r3 = a0 != null && a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_WHITEGLOVE);
if (!r7) {
r7 = r3;
}
return r7;
}
export function isExpeditedMonetizationOnboardingGuild(a0) {
return a0?.id != null || a0 != null && a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_WHITEGLOVE);
}
@@ -0,0 +1,47 @@
// Metro module 15218 (f15219).
import { isGuildOwner } from "../../../records/GuildRecord";
import GuildStore from "../../../stores/GuildStore";
import UserStore from "../../../stores/UserStore";
import { GuildFeatures } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useGuildRoleSubscriptionSettingsVisibility, GuildRoleSubscriptionSettingsVisibility, getGuildRoleSubscriptionSettingsVisibility } from "../../guild_role_subscriptions/feature_gating/GuildRoleSubscriptionSettingUtils";
let c10805_5 = [GuildFeatures.CREATOR_MONETIZABLE_PROVISIONAL, GuildFeatures.CREATOR_MONETIZABLE, GuildFeatures.CREATOR_MONETIZABLE_WHITEGLOVE, GuildFeatures.CREATOR_MONETIZABLE_DISABLED, GuildFeatures.CREATOR_MONETIZABLE_RESTRICTED];
export function useCanSeeCreatorMonetizationOnboardingV2Upsell(c21775_0) {
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(c21775_0));
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const guildRoleSubscriptionSettingsVisibility = useGuildRoleSubscriptionSettingsVisibility(stateFromStores);
const VISIBLE = GuildRoleSubscriptionSettingsVisibility.VISIBLE;
if (stateFromStores == null) {
return false;
}
let r29 = guildRoleSubscriptionSettingsVisibility === VISIBLE;
const isGuildOwner2 = isGuildOwner(stateFromStores, stateFromStores2);
const r35 = c10805_5.every((item) => !stateFromStores.features.has(item));
if (r29) {
r29 = isGuildOwner2;
}
if (r29) {
r29 = r35;
}
return r29;
}
export function canSeeCreatorMonetizationOnboardingV2Upsell(a0) {
const guild = GuildStore.getGuild(a0);
if (guild == null) {
return false;
}
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return false;
}
let r21 = getGuildRoleSubscriptionSettingsVisibility(guild) === GuildRoleSubscriptionSettingsVisibility.VISIBLE;
const isGuildOwner2 = isGuildOwner(guild, currentUser);
const r27 = c10805_5.every((item) => !guild.features.has(item));
if (r21) {
r21 = isGuildOwner2;
}
if (r21) {
r21 = r27;
}
return r21;
}
@@ -0,0 +1,10 @@
// Metro module 16554 (f16555).
import { HelpdeskArticles } from "../../../Constants";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
export function getCreatorMonetizationAcceptTermsCheckboxText() {
return intl.format(t["+ALa7+"], {
fullTermsUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.CREATOR_TERMS),
creatorRevenuePolicyUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.CREATOR_POLICY)
});
}
@@ -0,0 +1,158 @@
// Metro module 16527 (f16528).
import { useCallback, useMemo } from "react";
import { HelpdeskArticles } from "../../../Constants";
import { useIsMFAEnabled } from "./useIsMFAEnabled";
import { useEnableMFAHook } from "./useEnableMFAHook.native";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import openURL from "../../../lib/openURL";
import formatDurationFromDays from "../../guild_role_subscriptions/formatDurationFromDays";
export default function useCreatorMonetizationEligibilityItems(a0) {
let enableMFAHook;
let r2 = arguments[1];
if (r2 === void 0) {
r2 = {};
}
const { onEligibilityBecameStale, actions, sortedByIneligible } = r2;
enableMFAHook = void 0;
const isMFAEnabled = useIsMFAEnabled();
const { isUserMFAEnabled, isModerationMFAEnabled } = isMFAEnabled;
const callback = useCallback(async () => {
let c28433_0;
L25: {
c28433_0 = void 0;
if (isUserMFAEnabled) {
if (isModerationMFAEnabled) {
if (onEligibilityBecameStale == null) {
break L25;
}
onEligibilityBecameStale();
break L25;
}
const r54 = actions == null;
let r55 = void 0;
if (!r54) {
const onRequireModeratorMFAClick = actions.onRequireModeratorMFAClick;
r55 = onRequireModeratorMFAClick == null ? void 0 : onRequireModeratorMFAClick.call(actions);
}
await r55;
} else {
const r27 = actions == null;
let r10 = void 0;
if (!r27) {
const onEnableMFAClick = actions.onEnableMFAClick;
r10 = onEnableMFAClick == null ? void 0 : onEnableMFAClick.call(actions);
}
await r10;
}
if (onEligibilityBecameStale != null) {
onEligibilityBecameStale();
}
return void 0;
}
}, [isUserMFAEnabled, isModerationMFAEnabled, onEligibilityBecameStale, actions]);
enableMFAHook = useEnableMFAHook({
onEnableMFAClick: callback
});
return useMemo(() => {
if (a0 == null) {
return null;
}
const { minimumOwnerAgeInYears, minimumSize, noRecentViolations } = a0;
const r61 = [{
key: "no_violations_requirement",
checkedLabel: intl.string(t["1lGNPZ"]),
uncheckedLabel: intl.string(t["D+gTJt"]),
description: intl.format(t.HFY0m6, {
communityGuidelinesUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.PUBLIC_GUILD_GUILDLINES)
}),
checked: a0.noRecentViolations,
actionLabel: noRecentViolations ? void 0 : intl.string(t["xU2fl+"]),
actionHandler: noRecentViolations ? void 0 : function() {
return openURL(HelpdeskUtils.getSubmitRequestURL());
}
}];
if (minimumOwnerAgeInYears != null && a0.meetsOwnerAgeRequirement != null) {
r61.push({
key: "owner_age_requirement",
checkedLabel: intl.string(t["+F8haD"]),
uncheckedLabel: intl.string(t["5BwC/O"]),
description: intl.formatToPlainString(t.DW1Vae, {
minimumOwnerAgeInYears
}),
checked: a0.meetsOwnerAgeRequirement
});
}
if (minimumSize != null && a0.hasSufficientMembers != null) {
r61.push({
key: "member_count_requirement",
checkedLabel: intl.string(t.j7wXWo),
uncheckedLabel: intl.string(t.W0suNz),
description: intl.formatToPlainString(t.up53zR, {
minimumSize
}),
checked: a0.hasSufficientMembers
});
}
if (a0.minimumAgeInDays != null && a0.meetsServerAgeRequirement != null) {
r61.push({
key: "server_age_requirement",
checkedLabel: intl.string(t.mjbvWw),
uncheckedLabel: intl.string(t["9BV6L6"]),
description: intl.formatToPlainString(t.Zwv84O, {
minimumAge: formatDurationFromDays(a0.minimumAgeInDays)
}),
checked: a0.meetsServerAgeRequirement
});
}
if (a0.weeklyCommunicators != null) {
r61.push({
key: "weekly_communicator_count_requirement",
checkedLabel: intl.string(t.Qw7qv4),
uncheckedLabel: intl.string(t.b45kGG),
description: intl.string(t.NbtjEC),
checked: a0.weeklyCommunicators
});
}
if (a0.hasMemberRetention != null) {
r61.push({
key: "member_retention_requirement",
checkedLabel: intl.string(t.Qvq39M),
uncheckedLabel: intl.string(t.azHboI),
description: intl.string(t.u4rCYO),
checked: a0.hasMemberRetention
});
}
r61.push({
key: "nsfw_requirement",
checkedLabel: intl.string(t.bymfTb),
uncheckedLabel: intl.string(t["718pRA"]),
description: intl.string(t["5ZqX+j"]),
checked: a0.notNSFW
});
if (a0.hasEnabled2FA != null) {
const hasEnabled2FA = a0.hasEnabled2FA;
let r265 = (hasEnabled2FA ? !hasEnabled2FA : !isUserMFAEnabled) && actions?.onEnableMFAClick != null;
const hasEnabled2FA2 = a0.hasEnabled2FA;
const r270 = (hasEnabled2FA2 ? !hasEnabled2FA2 : !isModerationMFAEnabled) && actions?.onRequireModeratorMFAClick != null;
if (!r265) {
r265 = r270;
}
r61.push({
key: "2fa_requirement",
checkedLabel: intl.string(t.NqVyFk),
uncheckedLabel: intl.string(t.VcDNIV),
description: intl.format(t["7NzkfV"], {
enableMFAHook
}),
checked: a0.hasEnabled2FA,
actionLabel: r265 ? intl.string(t.BU4Diu) : void 0,
actionHandler: r265 ? callback : void 0
});
}
if (sortedByIneligible === true) {
r61.sort((a) => a.checked ? 0 : -1);
}
return r61;
}, [a0, sortedByIneligible, isUserMFAEnabled, actions, isModerationMFAEnabled, enableMFAHook, callback]);
};
@@ -0,0 +1,10 @@
// Metro module 16555 (f16556).
import useCreatorMonetizationEligibilityItems from "./useCreatorMonetizationEligibilityItems";
export function useCreatorMonetizationIneligibleReasons(a0) {
const creatorMonetizationEligibilityItems = useCreatorMonetizationEligibilityItems(a0);
let r11 = creatorMonetizationEligibilityItems == null ? void 0 : creatorMonetizationEligibilityItems.flatMap((creatorMonetizationEligibilityItem) => creatorMonetizationEligibilityItem.checked ? [] : [creatorMonetizationEligibilityItem.key]);
if (r11 == null) {
r11 = null;
}
return r11;
}
@@ -0,0 +1,93 @@
// Metro module 16556 (f16557).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useCallback, useEffect } from "react";
import { getCreatorMonetizationOnboardingMarketing } from "../CreatorMonetizationEligibilityActionCreators";
import { APIError } from "../../../errors/index";
let env11906 = {};
export default function useCreatorMonetizationOnboardingMarketing(a0) {
let env23285 = {
$parent: env11906
};
env23285[0] = a0;
const r14 = _slicedToArray(useState(true), 2);
const isLoading = r14[0];
env23285[1] = r14[1];
const r18 = _slicedToArray(useState(), 2);
const error = r18[0];
env23285[2] = r18[1];
const r22 = _slicedToArray(useState(), 2);
const creatorMonetizationOnboardingMarketing = r22[0];
env23285[3] = r22[1];
let c23286_0 = async (c31068_0) => {
let c31068_3;
let c31068_4 = 0;
let c31831_0, c31831_1;
L10: {
try {
c31831_0 = void 0;
(0, env23285[1])(true);
(0, env23285[2])(void 0);
c31068_4 = 2;
c31831_0 = await getCreatorMonetizationOnboardingMarketing(c31068_0);
(0, env23285[3])(c31831_0);
c31068_4 = 1;
c31068_4 = 0;
(0, env23285[1])(false);
} catch ($e) {
const r27 = $e;
let r7 = r27;
c31068_3 = r27;
let r28 = c31068_4;
if (r28 !== 0) {
while (true) {
if (r28 === 1) {
try {
const r97 = c31068_3;
c31068_4 = 0;
(0, env23285[1])(false);
throw r97;
} catch (r95) {
r7 = r95;
c31068_3 = r95;
r28 = c31068_4;
if (r28 === 0) {
break;
}
}
} else {
try {
const r75 = c31068_3;
c31068_4 = 1;
c31831_1 = r75;
env23285[2](new APIError(c31831_1));
c31068_4 = 0;
(0, env23285[1])(false);
break L10;
} catch (r72) {
r7 = r72;
c31068_3 = r72;
r28 = c31068_4;
if (r28 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
const callback = useCallback(function() {
return c23286_0.apply(this, arguments);
}, []);
env23285[4] = callback;
useEffect(() => {
(0, env23285[4])(env23285[0]);
}, [a0, callback]);
return {
isLoading,
error,
creatorMonetizationOnboardingMarketing
};
};
@@ -0,0 +1,7 @@
// Metro module 16529 (f16530).
const passthrough = function passthrough(a0) {
return a0;
};
export function useEnableMFAHook() {
return passthrough;
}
@@ -0,0 +1,11 @@
// Metro module 16528 (f16529).
import GuildSettingsStore from "../../guild_settings/GuildSettingsStore";
import UserStore from "../../../stores/UserStore";
import { MFALevels } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
export function useIsMFAEnabled() {
return {
isUserMFAEnabled: useStateFromStores([UserStore], () => UserStore.getCurrentUser())?.mfaEnabled === true,
isModerationMFAEnabled: useStateFromStores([GuildSettingsStore], () => GuildSettingsStore.getProps().mfaLevel) === MFALevels.ELEVATED
};
}
@@ -0,0 +1,91 @@
// Metro module 16550 (f16551).
import { useEffect } from "react";
import { isGuildOwner } from "../../../records/GuildRecord";
import UserStore from "../../../stores/UserStore";
import { GuildFeatures, HelpdeskArticles, MarketingURLs } from "../../../Constants";
import { useIsExpeditedOnboardingGuild } from "../CreatorMonetizationEligibilityExperimentUtils";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useCreateCreatorMonetizationEnableRequest from "../useCreateCreatorMonetizationEnableRequest";
import useCreatorMonetizationEligibility from "../useCreatorMonetizationEligibility";
import useIsCreatorMonetizationRequestRejected from "../useIsCreatorMonetizationRequestRejected";
import { useIsMonetizationReapplicationDisabled } from "../../creator_monetization_review/CreatorMonetizationRestrictionsHooks";
import * as _index_native from "../../../intl/index.native";
import { intl } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { getCreatorMonetizationAcceptTermsCheckboxText } from "./CreatorMonetizationAcceptTermCheckboxText";
export default function useOnboardingMonetizationEnableFlow(a0) {
let refresh, c23281_2;
let showAcceptTermsFlow = useIsExpeditedOnboardingGuild(a0);
const r10 = a0 == null ? void 0 : a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_PROVISIONAL);
const r26 = a0 == null ? void 0 : a0.features.has(GuildFeatures.CREATOR_MONETIZABLE);
const stateFromStores = useStateFromStores([UserStore], () => {
const currentUser = UserStore.getCurrentUser();
return a0 != null && isGuildOwner(a0, currentUser);
});
const createCreatorMonetizationEnableRequest = useCreateCreatorMonetizationEnableRequest(a0?.id);
const { error: error2, loading: loading2, createEnableRequest, submittedRequest } = createCreatorMonetizationEnableRequest;
const creatorMonetizationEligibility = useCreatorMonetizationEligibility(a0?.id);
const { loading, error } = creatorMonetizationEligibility;
refresh = creatorMonetizationEligibility.refresh;
const eligibility = creatorMonetizationEligibility.eligibility;
const isCreatorMonetizationRequestRejected = useIsCreatorMonetizationRequestRejected(eligibility);
const { isApplicationRejected, requestCooldownDuration } = isCreatorMonetizationRequestRejected;
let r69 = (a0 == null ? void 0 : a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_RESTRICTED)) === true || (a0 == null ? void 0 : a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_DISABLED)) === true;
const isMonetizationReapplicationDisabled = useIsMonetizationReapplicationDisabled(a0?.id).isMonetizationReapplicationDisabled;
const isApplicationPending = submittedRequest || eligibility?.isApplicationPending === true;
const canApply = eligibility?.canApply;
const requirementsFinePrintText = intl.format(_index_native.t.aJUdOi, {
faqUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.CREATOR_FAQ)
});
const requestRejectedNoticeText = isApplicationRejected && isMonetizationReapplicationDisabled ? r10 === true ? intl.format(_index_native.t["0o1Q+t"], {
communityGuidelineUrl: MarketingURLs.GUIDELINES
}) : intl.format(_index_native.t.b6h59n, {
communityGuidelineUrl: MarketingURLs.GUIDELINES
}) : (isApplicationRejected ? requestCooldownDuration != null : isApplicationRejected) ? intl.format(_index_native.t.TvX207, {
requestCooldownDuration,
creatorRevenuePolicyUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.CREATOR_POLICY)
}) : void 0;
const r135 = (showAcceptTermsFlow ? stateFromStores : showAcceptTermsFlow) && r26 === false;
c23281_2 = r135;
if (showAcceptTermsFlow) {
showAcceptTermsFlow = r10 === false;
}
const eligibleForMonetization = canApply === true;
const creatorMonetizationAcceptTermsCheckboxText = getCreatorMonetizationAcceptTermsCheckboxText();
const reapplyNoticeText = isApplicationRejected ? eligibleForMonetization ? stateFromStores ? intl.format(_index_native.t.wbVIUB, {}) : void 0 : void 0 : void 0;
useEffect(() => {
if (c23281_2) {
refresh();
}
}, [refresh, r135]);
const r158 = {
resubmittingEnableRequest: loading2,
resubmissionError: error2,
isGuildOwner: stateFromStores,
createEnableRequest,
resubmittedRequest: submittedRequest,
eligibilityLoading: loading,
eligibilityError: error,
refreshEligibility: refresh,
eligibility,
eligibleForMonetization,
isApplicationPending,
hasPreviousApplicationRejection: isApplicationRejected,
requestRejectedNoticeText,
reapplyNoticeText,
showAcceptTermsFlow,
wasRejectedInV1: null,
requirementsFinePrintText: null,
acceptTermsCheckboxText: null
};
if (showAcceptTermsFlow) {
if (!r69) {
r69 = isApplicationRejected;
}
showAcceptTermsFlow = r69;
}
r158.wasRejectedInV1 = showAcceptTermsFlow;
r158.requirementsFinePrintText = requirementsFinePrintText;
r158.acceptTermsCheckboxText = creatorMonetizationAcceptTermsCheckboxText;
return r158;
};
@@ -0,0 +1,78 @@
// Metro module 16551 (f16552).
import { useState, useCallback } from "react";
import { createCreatorMonetizationEnableRequest } from "./CreatorMonetizationEligibilityActionCreators";
import APIError from "../../errors/APIError";
export default function useCreateCreatorMonetizationEnableRequest(a0) {
const [error, setState] = useState();
const [loading, setState2] = useState(false);
const [submittedRequest, setState3] = useState(false);
return {
error,
loading,
createEnableRequest: useCallback(async () => {
let c28436_2;
let c28436_3 = 0;
let c31066_0;
L14: {
try {
if (a0 != null) {
setState2(true);
setState(void 0);
setState3(false);
c28436_3 = 2;
await createCreatorMonetizationEnableRequest(a0);
(0, setState3)(true);
c28436_3 = 1;
c28436_3 = 0;
(0, setState2)(false);
break L14;
}
} catch ($e) {
const r26 = $e;
let r7 = r26;
c28436_2 = r26;
let r27 = c28436_3;
if (r27 !== 0) {
while (true) {
if (r27 === 1) {
try {
const r92 = c28436_2;
c28436_3 = 0;
(0, setState2)(false);
throw r92;
} catch (r90) {
r7 = r90;
c28436_2 = r90;
r27 = c28436_3;
if (r27 === 0) {
break;
}
}
} else {
try {
const r73 = c28436_2;
c28436_3 = 1;
c31066_0 = r73;
setState(new APIError(c31066_0));
c28436_3 = 0;
(0, setState2)(false);
break L14;
} catch (r70) {
r7 = r70;
c28436_2 = r70;
r27 = c28436_3;
if (r27 === 0) {
break;
}
}
}
}
}
throw r7;
}
return void 0;
}
}, [a0]),
submittedRequest
};
};
@@ -0,0 +1,95 @@
// Metro module 16524 (f16525).
import { useState, useCallback } from "react";
import { isGuildOwner } from "../../records/GuildRecord";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { useStateFromStores } from "../../_bundle/Module589";
import { useIsExpeditedOnboardingGuild } from "./CreatorMonetizationEligibilityExperimentUtils";
import { acceptCreatorMonetizationTerms, acceptCreatorMonetizationTermsV2 } from "./CreatorMonetizationEligibilityActionCreators";
import APIError from "../../errors/APIError";
export default function useCreateCreatorMonetizationAcceptTermsRequest(a0, a1) {
let isExpeditedOnboardingGuild;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0));
const [error, setState] = useState();
const [loading, setState2] = useState(false);
isExpeditedOnboardingGuild = useIsExpeditedOnboardingGuild(stateFromStores);
return {
canSubmitAcceptance: useStateFromStores([UserStore], () => {
const currentUser = UserStore.getCurrentUser();
return stateFromStores != null && isGuildOwner(stateFromStores, currentUser);
}, [stateFromStores]),
error,
loading,
submitAcceptTermsRequest: useCallback(async () => {
let c28424_2;
let c28424_3 = 0;
let c31062_0;
L19: {
L17: {
try {
if (a0 == null) {
break L19;
}
if (!isExpeditedOnboardingGuild && a1 == null) {
break L19;
}
setState2(true);
setState(void 0);
c28424_3 = 2;
if (a1 != null) {
await acceptCreatorMonetizationTerms(a0, a1);
} else {
await acceptCreatorMonetizationTermsV2(a0);
}
c28424_3 = 1;
c28424_3 = 0;
(0, setState2)(false);
} catch ($e) {
const r30 = $e;
let r7 = r30;
c28424_2 = r30;
let r31 = c28424_3;
if (r31 !== 0) {
while (true) {
if (r31 === 1) {
try {
const r121 = c28424_2;
c28424_3 = 0;
(0, setState2)(false);
throw r121;
} catch (r119) {
r7 = r119;
c28424_2 = r119;
r31 = c28424_3;
if (r31 === 0) {
break;
}
}
} else {
try {
const r101 = c28424_2;
c28424_3 = 1;
c31062_0 = r101;
setState(new APIError(c31062_0));
c28424_3 = 0;
(0, setState2)(false);
break L17;
} catch (r98) {
r7 = r98;
c28424_2 = r98;
r31 = c28424_3;
if (r31 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
return void 0;
}
}, [a0, a1, isExpeditedOnboardingGuild])
};
};
@@ -0,0 +1,118 @@
// Metro module 16552 (f16553).
import _slicedToArray from "../../_bundle/_slicedToArray";
import { useState, useCallback } from "react";
import { CreatorMonetizationApplicationState } from "./CreatorMonetizationEligibilityConstants";
import { getCreatorMonetizationEligibility } from "./CreatorMonetizationEligibilityActionCreators";
import APIError from "../../errors/APIError";
let env11902 = {};
export default function useCreatorMonetizationEligibility(a0) {
let env23283 = {
$parent: env11902
};
env23283[0] = a0;
const r15 = _slicedToArray(useState(a0 != null), 2);
const loading = r15[0];
env23283[1] = r15[1];
const r19 = _slicedToArray(useState(), 2);
const error = r19[0];
env23283[2] = r19[1];
const r23 = _slicedToArray(useState(), 2);
const eligibility = r23[0];
env23283[3] = r23[1];
let c23284_0 = async (c31067_0) => {
let c31067_3;
let c31067_4 = 0;
let c31830_0, c31830_1;
L20: {
try {
c31830_0 = void 0;
(0, env23283[1])(true);
(0, env23283[2])(void 0);
c31067_4 = 2;
c31830_0 = await getCreatorMonetizationEligibility(c31067_0);
env23283[3]({
isEligibleForMonetization: c31830_0.sufficient,
hasSufficientMembers: c31830_0.size,
hasEnabled2FA: c31830_0.mfa,
meetsServerAgeRequirement: c31830_0.age,
meetsOwnerAgeRequirement: c31830_0.owner_age,
noRecentViolations: c31830_0.safe_environment,
weeklyCommunicators: c31830_0.engagement_healthy,
hasMemberRetention: c31830_0.retention_healthy,
notNSFW: Object.keys(c31830_0.nsfw_properties).length === 0,
canApply: c31830_0.can_apply,
isApplicationPending: c31830_0.latest_request?.state === CreatorMonetizationApplicationState.OPEN,
actionRequired: c31830_0.latest_request?.state === CreatorMonetizationApplicationState.ACTION_REQUIRED,
minimumAgeInDays: c31830_0.minimum_age_in_days,
minimumOwnerAgeInYears: c31830_0.minimum_owner_age_in_years,
minimumSize: c31830_0.minimum_size,
latestRequest: c31830_0.latest_request,
rejection: c31830_0.rejection,
guildMemberCount: c31830_0.health_score?.guild_size,
communicatorCount: c31830_0.health_score?.communicators,
retentionScore: c31830_0.health_score?.perc_ret_w1
});
c31067_4 = 1;
c31067_4 = 0;
(0, env23283[1])(false);
} catch ($e) {
const r31 = $e;
let r7 = r31;
c31067_3 = r31;
let r32 = c31067_4;
if (r32 !== 0) {
while (true) {
if (r32 === 1) {
try {
const r169 = c31067_3;
c31067_4 = 0;
(0, env23283[1])(false);
throw r169;
} catch (r167) {
r7 = r167;
c31067_3 = r167;
r32 = c31067_4;
if (r32 === 0) {
break;
}
}
} else {
try {
const r147 = c31067_3;
c31067_4 = 1;
c31830_1 = r147;
env23283[2](new APIError(c31830_1));
c31067_4 = 0;
(0, env23283[1])(false);
break L20;
} catch (r144) {
r7 = r144;
c31067_3 = r144;
r32 = c31067_4;
if (r32 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
const callback = useCallback(function() {
return c23284_0.apply(this, arguments);
}, []);
env23283[4] = callback;
return {
error,
loading,
eligibility,
refresh: useCallback(() => {
const r2 = env23283[0];
if (r2 != null) {
(0, env23283[4])(r2);
}
}, [a0, callback])
};
};
@@ -0,0 +1,19 @@
// Metro module 7775 (f7776).
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useIsCreatorMonetizationEnabledGuild(c16024_0) {
return useStateFromStores([GuildStore], () => {
const guild = GuildStore.getGuild(c16024_0);
let r9 = guild != null;
if (r9) {
const r13 = guild.features.has(GuildFeatures.CREATOR_MONETIZABLE_DISABLED);
r9 = r13 ? !r13 : guild.features.has(GuildFeatures.CREATOR_MONETIZABLE) || guild.features.has(GuildFeatures.CREATOR_MONETIZABLE_PROVISIONAL);
}
return r9;
});
};
export function isCreatorMonetizationEnabledGuild(a0) {
const r7 = a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_DISABLED);
return r7 ? !r7 : a0.features.has(GuildFeatures.CREATOR_MONETIZABLE) || a0.features.has(GuildFeatures.CREATOR_MONETIZABLE_PROVISIONAL);
}
@@ -0,0 +1,37 @@
// Metro module 16553 (f16554).
import { CreatorMonetizationApplicationState } from "./CreatorMonetizationEligibilityConstants";
import { intl, t } from "../../intl/index.native";
export default function useIsCreatorMonetizationRequestRejected(a0) {
const r11 = a0 == null ? void 0 : a0.latestRequest?.state;
const r12 = a0 == null ? void 0 : a0.rejection?.can_reapply_at;
const r26 = r12 != null;
let requestCooldownDuration = void 0;
if (r26) {
const r13 = Date.parse(r12);
const r32 = Date.now();
const isNaN2 = isNaN(r13);
requestCooldownDuration = void 0;
if (!isNaN2) {
const r35 = r13 < r32;
requestCooldownDuration = void 0;
if (!r35) {
const minutes = Math.round((r13 - r32) / 60000);
requestCooldownDuration = minutes >= 43200 ? intl.formatToPlainString(t.kridzK, {
months: Math.round(minutes / 43200)
}) : minutes >= 10080 ? intl.formatToPlainString(t.EmoBD2, {
weeks: Math.round(minutes / 10080)
}) : minutes >= 1440 ? intl.formatToPlainString(t["k2UNz+"], {
days: Math.round(minutes / 1440)
}) : minutes >= 60 ? intl.formatToPlainString(t.xCjYxK, {
hours: Math.round(minutes / 60)
}) : intl.formatToPlainString(t.iXLF9W, {
minutes
});
}
}
}
return {
isApplicationRejected: r11 === CreatorMonetizationApplicationState.REJECTED,
requestCooldownDuration
};
};