116 lines
3.7 KiB
TypeScript
116 lines
3.7 KiB
TypeScript
// Metro module 6779 (f6780).
|
|
import UserStore from "../../stores/UserStore";
|
|
import { Storage } from "../../_bundle/Module595";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let c4358_3 = 86400000;
|
|
let methods2 = null;
|
|
let methods3 = null;
|
|
let c4358_6 = false;
|
|
const status = "unchecked";
|
|
let reactiveCheckMissAt = null;
|
|
class AgeVerificationStore extends Module589.Store {
|
|
static displayName = "AgeVerificationStore";
|
|
initialize() {
|
|
this.waitFor(UserStore);
|
|
}
|
|
get loading() {
|
|
return c4358_6;
|
|
}
|
|
get methods() {
|
|
return methods2;
|
|
}
|
|
get methodsV2() {
|
|
return methods3;
|
|
}
|
|
getReactiveCheckStatus() {
|
|
return status;
|
|
}
|
|
getReactiveCheckMiss() {
|
|
return status === "miss" && reactiveCheckMissAt != null && Date.now() - reactiveCheckMissAt < c4358_3;
|
|
}
|
|
getReactiveCheckPassed() {
|
|
return status === "passed";
|
|
}
|
|
shouldCallReactiveCheck() {
|
|
return status !== "passed" && (status !== "suppress" && !(status === "miss" && reactiveCheckMissAt != null && Date.now() - reactiveCheckMissAt < c4358_3));
|
|
}
|
|
}
|
|
const ageVerificationStore = new AgeVerificationStore(Dispatcher, {
|
|
AGE_VERIFICATION_METHODS_LOAD_START: function handleAgeVerificationMethodsLoadStart() {
|
|
c4358_6 = true;
|
|
},
|
|
AGE_VERIFICATION_METHODS_LOAD_SUCCESS: function handleAgeVerificationMethodsLoadSuccess(a0) {
|
|
methods2 = a0.methods;
|
|
c4358_6 = false;
|
|
},
|
|
AGE_VERIFICATION_METHODS_LOAD_FAILURE: function handleAgeVerificationMethodsLoadFailure() {
|
|
c4358_6 = false;
|
|
},
|
|
AGE_VERIFICATION_METHODS_V2_LOAD_SUCCESS: function handleAgeVerificationMethodsV2LoadSuccess(a0) {
|
|
methods3 = a0.methods;
|
|
},
|
|
INITIATE_AGE_VERIFICATION: function invalidateAgeVerificationMethodsV2() {
|
|
methods3 = null;
|
|
},
|
|
CONNECTION_OPEN: function handleConnectionOpen() {
|
|
const id = UserStore.getCurrentUser()?.id;
|
|
const r7 = id == null ? null : `AgeVerificationStore_${id}`;
|
|
L20: {
|
|
if (r7 != null) {
|
|
const r22 = Storage.get(r7);
|
|
if (r22 != null && typeof r22 === "object") {
|
|
let reactiveCheckStatus = r22.reactiveCheckStatus;
|
|
if (reactiveCheckStatus == null) {
|
|
reactiveCheckStatus = "unchecked";
|
|
}
|
|
let reactiveCheckMissAt2 = r22.reactiveCheckMissAt;
|
|
if (reactiveCheckMissAt2 == null) {
|
|
reactiveCheckMissAt2 = null;
|
|
}
|
|
if (reactiveCheckStatus === "miss" && reactiveCheckMissAt2 != null && Date.now() - reactiveCheckMissAt2 >= c4358_3) {
|
|
status = "unchecked";
|
|
reactiveCheckMissAt = null;
|
|
break L20;
|
|
}
|
|
status = reactiveCheckStatus;
|
|
reactiveCheckMissAt = reactiveCheckMissAt2;
|
|
break L20;
|
|
}
|
|
status = "unchecked";
|
|
reactiveCheckMissAt = null;
|
|
} else {
|
|
status = "unchecked";
|
|
reactiveCheckMissAt = null;
|
|
}
|
|
}
|
|
methods3 = null;
|
|
},
|
|
AGE_VERIFICATION_CHECK_RESULT_SET: function handleReactiveCheckResultSet(a0) {
|
|
status = a0.status;
|
|
reactiveCheckMissAt = status === "miss" ? Date.now() : null;
|
|
const id = UserStore.getCurrentUser()?.id;
|
|
const r6 = id == null ? null : `AgeVerificationStore_${id}`;
|
|
if (r6 != null) {
|
|
Storage.set(r6, {
|
|
reactiveCheckStatus: status,
|
|
reactiveCheckMissAt
|
|
});
|
|
}
|
|
},
|
|
AGE_VERIFICATION_RESET: function handleAgeVerificationReset() {
|
|
status = "suppress";
|
|
reactiveCheckMissAt = null;
|
|
const id = UserStore.getCurrentUser()?.id;
|
|
const r7 = id == null ? null : `AgeVerificationStore_${id}`;
|
|
if (r7 != null) {
|
|
Storage.set(r7, {
|
|
reactiveCheckStatus: status,
|
|
reactiveCheckMissAt
|
|
});
|
|
}
|
|
methods3 = null;
|
|
}
|
|
});
|
|
export default ageVerificationStore;
|