Files
discord-decomp/modules/safety_hub/SafetyHubStore.tsx
T
2026-11-01 12:12:55 +02:00

257 lines
8.6 KiB
TypeScript

// Metro module 11072 (f11073).
import { AGE_CHECK_MAX_POLL_ATTEMPTS, AgeCheckStatus, AppealIngestionSignal } from "./SafetyHubConstants";
import { AccountStandingState, ClassificationRequestState, AppealStatusType } from "./SafetyHubModels";
import Module11073 from "../../_bundle/Module11073";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
let c7469_6, c7469_7, accountStanding, c7469_9, c7469_10, error, classificationId, isDsaEligible, isAppealEligible, appealEligibility, c7469_16, error2, DIDNT_VIOLATE_POLICY, userInput, username, verificationWebviewUrl, c7469_22, error3, c7469_24, NONE, error4;
const handleSafetyHubRequestAgeVerificationResetModalAction = function handleSafetyHubRequestAgeVerificationResetModalAction(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
verificationWebviewUrl = "";
error3 = null;
c7469_24 = false;
};
c7469_6 = {};
c7469_7 = {};
accountStanding = {
state: AccountStandingState.ALL_GOOD
};
c7469_9 = false;
c7469_10 = false;
error = null;
classificationId = null;
isDsaEligible = false;
isAppealEligible = false;
appealEligibility = [];
c7469_16 = false;
error2 = null;
DIDNT_VIOLATE_POLICY = AppealIngestionSignal.DIDNT_VIOLATE_POLICY;
userInput = "";
username = "";
verificationWebviewUrl = "";
c7469_22 = 0;
error3 = null;
c7469_24 = false;
NONE = AgeCheckStatus.NONE;
error4 = null;
class SafetyHubStore extends Module589.Store {
static displayName = "SafetyHubStore";
isFetching() {
return c7469_9;
}
getClassifications() {
return Object.values(c7469_6);
}
getClassification(a0) {
return c7469_6[a0];
}
getAccountStanding() {
return accountStanding;
}
getFetchError() {
return error;
}
isInitialized() {
return c7469_10;
}
getClassificationRequestState(a0) {
return c7469_7[a0];
}
getAppealClassificationId() {
return classificationId;
}
getIsDsaEligible() {
return isDsaEligible;
}
getIsAppealEligible() {
return isAppealEligible;
}
getAppealEligibility() {
return appealEligibility;
}
getAppealSignal() {
return DIDNT_VIOLATE_POLICY;
}
getFreeTextAppealReason() {
return userInput;
}
getIsSubmitting() {
return c7469_16;
}
getSubmitError() {
return error2;
}
getUsername() {
return username;
}
getAgeVerificationWebviewUrl() {
return verificationWebviewUrl;
}
getAgeVerificationError() {
return error3;
}
getIsLoadingAgeVerification() {
return c7469_24;
}
getAgeCheckStatus() {
return NONE;
}
getAgeCheckError() {
return error4;
}
getAgeCheckAttempts() {
return c7469_22;
}
}
const safetyHubStore = new SafetyHubStore(Dispatcher, {
SAFETY_HUB_FETCH_START: function handleFetchStart() {
c7469_9 = true;
},
SAFETY_HUB_FETCH_SUCCESS: function handleFetchSuccess({ classifications, accountStanding: accountStanding2, isDsaEligible: isDsaEligible2, isAppealEligible: isAppealEligible2, username: username2, appealEligibility: appealEligibility2 }) {
c7469_6 = Module11073(classifications, "id");
accountStanding = accountStanding2;
isDsaEligible = isDsaEligible2;
isAppealEligible = isAppealEligible2;
c7469_9 = false;
c7469_10 = true;
error = null;
username = username2;
appealEligibility = appealEligibility2;
},
SAFETY_HUB_FETCH_FAILURE: function handleFetchFailure({ error: error5 }) {
c7469_9 = false;
c7469_10 = false;
error = error5;
},
SAFETY_HUB_FETCH_CLASSIFICATION_START: function handleFetchClassificationStart(a0) {
c7469_7[a0.classificationId] = ClassificationRequestState.PENDING;
c7469_9 = true;
},
SAFETY_HUB_FETCH_CLASSIFICATION_SUCCESS: function handleFetchClassificationSuccess({ classification, accountStanding: accountStanding2, isDsaEligible: isDsaEligible2, username: username2, isAppealEligible: isAppealEligible2 }) {
c7469_6[classification.id] = classification;
c7469_7[classification.id] = ClassificationRequestState.SUCCESS;
accountStanding = accountStanding2;
c7469_9 = false;
error = null;
isDsaEligible = isDsaEligible2;
isAppealEligible = isAppealEligible2;
c7469_10 = true;
username = username2;
},
SAFETY_HUB_FETCH_CLASSIFICATION_FAILURE: function handleFetchClassificationFailure({ error: error5, classificationId: classificationId2 }) {
c7469_9 = false;
error = error5;
c7469_7[classificationId2] = ClassificationRequestState.FAILED;
c7469_10 = false;
},
SAFETY_HUB_APPEAL_OPEN: function handleAppealOpen(a0) {
classificationId = a0.classificationId;
},
SAFETY_HUB_APPEAL_CLOSE: function handleAppealClose() {
classificationId = null;
DIDNT_VIOLATE_POLICY = AppealIngestionSignal.DIDNT_VIOLATE_POLICY;
userInput = "";
},
SAFETY_HUB_APPEAL_SIGNAL_SELECT: function handleAppealSignalSelect(a0) {
DIDNT_VIOLATE_POLICY = a0.signal;
},
SAFETY_HUB_APPEAL_SIGNAL_CUSTOM_INPUT_CHANGE: function handleAppealSignalCustomInputChange(a0) {
userInput = a0.userInput;
},
SAFETY_HUB_REQUEST_REVIEW_START: function handleSafetyHubRequestReviewStart(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
c7469_16 = true;
error2 = null;
},
SAFETY_HUB_REQUEST_REVIEW_SUCCESS: function handleSafetyHubRequestReviewSuccess({ classificationId: classificationId2 }) {
c7469_16 = false;
error2 = null;
c7469_6[classificationId2].appeal_status = {
status: AppealStatusType.REVIEW_PENDING
};
},
SAFETY_HUB_REQUEST_REVIEW_FAILURE: function handleSafetyHubRequestReviewFailure({ error: error5 }) {
c7469_16 = false;
error2 = error5;
},
SAFETY_HUB_REQUEST_AUTOMATED_UNDERAGE_APPEAL_START: function handleSafetyHubRequestAgeVerificationStart(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
verificationWebviewUrl = "";
error3 = null;
c7469_24 = true;
},
SAFETY_HUB_REQUEST_AUTOMATED_UNDERAGE_APPEAL_SUCCESS: function handleSafetyHubRequestAgeVerificationSuccess(a0) {
verificationWebviewUrl = a0.verificationWebviewUrl;
error3 = null;
c7469_24 = false;
},
SAFETY_HUB_REQUEST_AUTOMATED_UNDERAGE_APPEAL_FAILURE: function handleSafetyHubRequestAgeVerificationFailure({ error: error5 }) {
verificationWebviewUrl = "";
error3 = error5;
c7469_24 = false;
},
SAFETY_HUB_AUTOMATED_UNDERAGE_APPEAL_MODAL_OPEN: handleSafetyHubRequestAgeVerificationResetModalAction,
SAFETY_HUB_AUTOMATED_UNDERAGE_APPEAL_MODAL_CLOSE: handleSafetyHubRequestAgeVerificationResetModalAction,
SAFETY_HUB_AUTOMATED_UNDERAGE_APPEAL_SUBMIT_SUCCESS: function handleSafetyHubAutomatedUnderageAppealSubmitSuccessAction(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
NONE = AgeCheckStatus.LOADING;
for (const key in c7469_6) {
if (c7469_6[key].is_coppa) {
c7469_6[key].appeal_status = {
status: AppealStatusType.REVIEW_PENDING
};
}
}
},
SAFETY_HUB_AUTOMATED_UNDERAGE_APPEAL_START_POLL: function handleSafetyHubAgeVerificationStartPoll(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
NONE = AgeCheckStatus.LOADING;
error4 = null;
},
SAFETY_HUB_CHECK_AUTOMATED_UNDERAGE_APPEAL_START: function handleSafetyHubCheckAgeVerificationStart(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
NONE = AgeCheckStatus.LOADING;
error4 = null;
c7469_22 = c7469_22 + 1;
},
SAFETY_HUB_CHECK_AUTOMATED_UNDERAGE_APPEAL_SUCCESS: function handleSafetyHubCheckAgeVerificationCheckSuccess(a0) {
NONE = a0.success ? AgeCheckStatus.SUCCESS : c7469_22 < AGE_CHECK_MAX_POLL_ATTEMPTS ? AgeCheckStatus.LOADING : AgeCheckStatus.FAILURE;
error4 = null;
},
SAFETY_HUB_CHECK_AUTOMATED_UNDERAGE_APPEAL_FAILURE: function handleSafetyHubCheckAgeVerificationFailure({ error: error5 }) {
NONE = AgeCheckStatus.ERROR;
error4 = error5;
},
LOGOUT: function reset() {
c7469_9 = false;
c7469_6 = {};
accountStanding = {
state: AccountStandingState.ALL_GOOD
};
classificationId = null;
DIDNT_VIOLATE_POLICY = AppealIngestionSignal.DIDNT_VIOLATE_POLICY;
userInput = "";
appealEligibility = [];
}
});
export default safetyHubStore;