decord/source/modules/age_assurance/AgeVerificationActionCreators.native.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

353 lines
12 KiB
TypeScript

// Module ID: 8411
// Function ID: 8412
// Name: openIncodeAgeVerificationModal
// Dependencies: [5, 1371, 8412, 8414, 4770, 8399, 21, 5139, 4763, 8415, 1896, 8404, 8424, 8425, 1608, 4906, 8426, 1379, 1115, 8427, 8428, 4773, 5423, 573, 8429, 8435, 8442, 8578, 8579, 4255, 8413, 8590, 8591, 2]
// Module 8411 (openIncodeAgeVerificationModal)
import _modDef4255 from "module_4255" /* 4255 */;
import useAlertStore from "useAlertStore" /* 4906 */;
import AgeVerificationModalEntryPoint from "AgeVerificationModalEntryPoint" /* 8413 */;
import ManualReviewDecidedTeenAlertModalDefault from "ManualReviewDecidedTeenAlertModal" /* 8590 */;
import ManualReviewFallbackAlertModalDefault from "ManualReviewFallbackAlertModal" /* 8591 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "mergeGuildAvatar" /* 1371 */;
import set from "set" /* 8412 */;
import { AGE_VERIFICATION_INCODE_PATH as closure_11 } from "AGE_VERIFICATION_INCODE_PATH" /* 8414 */;
import { NativePermissionTypes } from "NativePermissionStatus" /* 4770 */;
import { SafetyToastType } from "SafetyToastType" /* 8399 */;
import { jsx } from "jsxProd" /* 21 */;
require = arg1;
function openIncodeAgeVerificationModal(arg0) {
({ onClose: require, onComplete: importDefault } = arg0);
let combined;
let WEBAPP_ENDPOINT;
if (GLOBAL_ENV != null) {
WEBAPP_ENDPOINT = GLOBAL_ENV.WEBAPP_ENDPOINT;
}
combined = null;
if (null != WEBAPP_ENDPOINT) {
combined = null;
if ("" !== WEBAPP_ENDPOINT) {
const _URL = URL;
const _HermesInternal2 = HermesInternal;
let str3 = "https:";
const uRL = new URL("https:" + WEBAPP_ENDPOINT);
const hostname = uRL.hostname;
if ("localhost" !== hostname) {
if ("127.0.0.1" !== hostname) {
const obj = /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/;
}
const _HermesInternal = HermesInternal;
combined = "" + str3 + WEBAPP_ENDPOINT + closure_11;
}
str3 = "http:";
}
}
let flag = null != combined;
if (flag) {
callback(function*() {
closure_1 = tmp3;
closure_0 = tmp3;
dependencyMap = 1;
yield closure_1_1(5139).requestPermission(closure_1_12.CAMERA, { showAuthorizationError: true });
if (1 === tmp7) {
dependencyMap = 0;
closure_1_1(8404).showFailedToast(closure_1_13.TIGGER_PAWTECT_ERROR);
closure_1_0();
c4 = 3;
const obj5 = closure_1_1(8404);
} else if (2 === tmp7) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
dependencyMap = 0;
c4 = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
obj1 = closure_1_1(4763);
const v0 = 3;
c4 = 1;
const obj3 = { value: null, done: false };
obj3[0] = obj1.pushLazy(v0(function*() {
closure_0 = tmp2;
yield closure_1_0(paths[10])(paths[9], paths.paths);
closure_0 = arg1.default;
return () => closure_2_14(closure_0, { webviewUrl: c2, onClose: closure_0, onComplete: c1 });
}), {}, closure_1_5);
return obj3;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 !== 2) {
dependencyMap = 0;
}
dependencyMap = 0;
return arg1;
})();
flag = true;
}
return flag;
}
function showAgeVerification(onClose) {
let fn = onClose.onClose;
if (fn === undefined) {
fn = function n(arg0) {
};
}
({ shouldShowExpressiveModal, externalWindow, webviewUrl } = onClose);
({ method, verificationVendorName } = onClose);
let merged = Object.assign(onClose, Object.create(null));
let obj = fn(merged[14]);
if (obj.isMetaQuest()) {
let tmp2Result = tmp2(tmp3[15]);
tmp2Result.openAlert(closure_7, jsx(webviewUrl(tmp3[16]), {}), fn);
return true;
} else {
if (method === tmp2(tmp3[17]).AgeAssuranceMethod.NEW_METHOD) {
if (null != webviewUrl) {
if ("" !== webviewUrl) {
tmp2Result = tmp2(tmp3[18]);
if (tmp2Result.isAndroid()) {
if (externalWindow == null) {
externalWindow = null;
}
const result = tmp2(tmp3[12]).openAgeVerificationCustomTab(webviewUrl, externalWindow);
const tmp2Result1 = tmp2(tmp3[12]);
result.then((arg0) => {
if (!arg0) {
webviewUrl(merged[11]).showFailedToast(closure_1_13.TIGGER_PAWTECT_ERROR);
fn();
const obj = webviewUrl(merged[11]);
}
}).catch(() => {
webviewUrl(merged[11]).showFailedToast(closure_1_13.TIGGER_PAWTECT_ERROR);
fn();
});
return true;
} else {
if (tmp2Result2.isIOS()) {
const result1 = tmp2(tmp3[13]).openAgeVerificationAuthSession(webviewUrl);
const tmp2Result3 = tmp2(tmp3[13]);
result1.then((arg0) => {
if (!arg0) {
webviewUrl(merged[11]).showFailedToast(closure_1_13.TIGGER_PAWTECT_ERROR);
fn();
const obj = webviewUrl(merged[11]);
}
}).catch(() => {
webviewUrl(merged[11]).showFailedToast(closure_1_13.TIGGER_PAWTECT_ERROR);
fn();
});
return true;
}
tmp2Result2 = tmp2(tmp3[18]);
}
}
}
}
if (verificationVendorName === constants.INCODE) {
if (tmp2Result4.isAgeVerificationIncodeEnabled(merged.entryPoint)) {
obj = { onClose: null, onComplete: null };
obj[0] = fn;
obj[1] = merged.onComplete;
let flag = openIncodeAgeVerificationModal(obj);
}
return flag;
}
flag = null != webviewUrl;
if (flag) {
webviewUrl(tmp3[8]).pushLazy(callback(function*() {
closure_0 = tmp2;
yield closure_1_0(paths[10])(paths[20], paths.paths);
closure_0 = arg1.default;
return () => {
merged = Object.assign(c2);
return closure_2_14(closure_0, { webviewUrl: c1, onClose: closure_0 });
};
}), {}, closure_5);
flag = true;
const obj5 = webviewUrl(tmp3[8]);
}
}
}
function showManualReviewFallbackModal(AUTOMATED_UNDERAGE_APPEALS, closure_1_1) {
const _require = closure_1_1;
if (!c17) {
c17 = true;
_require(4906).openAlert(closure_9, jsx(ManualReviewFallbackAlertModalDefault, {}), () => {
c17 = false;
if (closure_0 != null) {
tmp();
}
});
const obj = _require(4906);
}
}
({ AGE_VERIFICATION_MODAL_KEY: c5, AGE_VERIFICATION_GET_STARTED_MODAL_KEY: closure_6, AGE_VERIFICATION_QUEST_UNSUPPORTED_ALERT_KEY: error, MANUAL_REVIEW_DECIDED_TEEN_ALERT_KEY: closure_8, MANUAL_REVIEW_FALLBACK_ALERT_KEY: c9, VerificationVendorName: c10 } = set);
let c17 = false;
let result = set.fileFinishedImporting("modules/age_assurance/AgeVerificationActionCreators.native.tsx");
export default {
showAgeVerification,
showAgeVerificationGetStartedModal(entryPoint) {
entryPoint = entryPoint.entryPoint;
const onClose = entryPoint.onClose;
dependencyMap = undefined;
let prop;
let currentUser;
let obj = entryPoint(1608);
if (obj.isMetaQuest()) {
let tmpResult = tmp(4906);
tmpResult.openAlert(closure_7, jsx(onClose(8426), {}), onClose);
} else {
tmpResult = tmp(4773);
let isAgeVerifiedResult = tmpResult.isAgeVerified();
if (isAgeVerifiedResult) {
isAgeVerifiedResult = tmp(5423).hasAgeGatedFeatures();
const tmpResult1 = tmp(5423);
}
dependencyMap = isAgeVerifiedResult;
if (tmpResult2.isAgeVerificationIncodeEnabled(entryPoint)) {
currentUser = currentUser.getCurrentUser();
prop = undefined;
if (currentUser != null) {
prop = currentUser.ageVerificationStatus;
}
function handleClose() {
let obj = onClose(_undefined[23]);
obj = { type: "CLOSE_AGE_VERIFICATION_MODAL", status: prop };
obj.dispatch(obj);
if (onClose != null) {
onClose();
}
}
onClose(573).dispatch({ type: "INITIATE_AGE_VERIFICATION" });
obj = { onClose: null, onComplete: null };
obj[0] = handleClose;
obj[1] = function onComplete() {
};
if (!openIncodeAgeVerificationModal(obj)) {
obj = { type: "CLOSE_AGE_VERIFICATION_MODAL", status: null };
obj[1] = prop;
onClose(573).dispatch(obj);
if (onClose != null) {
onClose();
}
const tmp14Result = onClose(573);
}
} else {
if (tmpResult3.isExpressiveModalV2Enabled(entryPoint)) {
prop(function*() {
if (v0 === 2) {
v0 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
v0 = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
v0 = 3;
throw arg1;
} else if (arg0 === 2) {
v0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
closure_1 = tmp4;
closure_0 = tmp4;
let obj2 = closure_1_0(8435);
dependencyMap = 1;
v0 = 1;
obj1 = { value: null, done: false };
obj1[0] = obj2.shouldShowManualReviewFallback(closure_1_0);
return obj1;
}
} else if (arg0 === 1) {
v0 = 3;
throw arg1;
} else if (arg0 === 2) {
v0 = 3;
obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
if (arg1) {
closure_1_18(closure_1_0, closure_1_1);
} else {
obj = closure_1_1(4763);
obj.pushLazy(v0(function*() {
closure_0 = tmp2;
yield closure_1_0(paths[10])(paths[26], paths.paths);
closure_0 = arg1.default;
return () => closure_2_14(closure_0, {
entryPoint: closure_0,
onClose() {
let tmp;
if (callback != null) {
tmp = callback();
}
return tmp;
}
});
}), {}, closure_1_6);
}
v0 = 3;
}
} catch (tmp20) {
v0 = tmp;
throw tmp20;
}
}
})();
} else {
currentUser = tmp(8578).isAgeVerificationExpressiveModalEverywhereEnabled(entryPoint);
const tmpResult4 = tmp(8578);
onClose(4763).pushLazy(prop(function*() {
closure_0 = tmp2;
yield closure_1_0(paths[10])(paths[28], paths.paths);
closure_0 = arg1.default;
return () => closure_2_14(closure_0, { entryPoint: closure_0, isRetry: c2, useEmbeddedMethods: closure_1_4 });
}), {}, closure_6);
const obj7 = onClose(4763);
}
tmpResult3 = tmp(8429);
}
tmpResult2 = tmp(8427);
}
},
showManualReviewWebview(verification_webview_url) {
return showAgeVerification({
webviewUrl: verification_webview_url,
verificationVendorName: constants.K_ID,
entryPoint: AgeVerificationModalEntryPoint.AgeVerificationModalEntryPoint.SYSTEM_DM_MANUAL_REVIEW,
onComplete() {
}
});
},
showManualReviewDecidedTeenModal() {
useAlertStore.openAlert(closure_8, jsx(ManualReviewDecidedTeenAlertModalDefault, {}));
},
showManualReviewFallbackModal,
openUrl(arg0) {
_modDef4255.openURL(arg0);
}
};