// Metro module 16272 (f16273). import { NativeModules } from "react-native"; import ParentalConsentStore from "../../parent_tools/ParentalConsentStore"; import ConnectedAccountsStore from "../../../stores/ConnectedAccountsStore"; import UserStore from "../../../stores/UserStore"; import { PlatformTypes, Routes } from "../../../Constants"; import { ContactPermissions } from "../../contact_sync/native/ContactSyncConstants"; import { NotificationAuthorizationStatus } from "../../native_permissions/NativePermissionConstants"; import * as _ContactSyncUtils from "../../contact_sync/native/ContactSyncUtils"; import { checkContactPermissions } from "../../contact_sync/native/ContactSyncUtils"; import { isIOS } from "../../../utils/PlatformUtils"; import { hasDeferredInvite } from "../../instant_invite/native/InstantInviteUtils"; import Dispatcher from "../../../Dispatcher"; import { CommonActions } from "../../../_bundle/Module1481"; import { trackNUFStep } from "./NewUserAnalyticsUtils"; import { isModalOpen } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native"; import { NEW_USER_MODAL_KEY } from "./components/NewUserModalTypes"; import ModalActionCreators from "../../../actions/ModalActionCreators"; import { transitionTo } from "../../routing/router_utils"; import { setNewUserFlowCompleted } from "../NUFActionCreators"; let c11691_13, c11691_14, c11691_15, lastStepComplete, getNextOnboardingStep; let _shouldSkipContactSyncStep = function _shouldSkipContactSyncStep() { const r8 = async () => { let r50; let c28314_0; L15: { c28314_0 = void 0; const isContactSyncAvailable = _ContactSyncUtils.isContactSyncAvailable(); const r11 = !isContactSyncAvailable; if (isContactSyncAvailable) { r50 = await checkContactPermissions() === ContactPermissions.UNAUTHORIZED; if (!r50) { break L15; } r50 = isIOS(); break L15; } return r11; } return r50; }; _shouldSkipContactSyncStep = r8; return r8.apply(this, arguments); }; lastStepComplete = function lastStepComplete(a0) { trackNUFStep(a0, "NUF Complete"); if (isModalOpen(NEW_USER_MODAL_KEY)) { ModalActionCreators.popWithKey(NEW_USER_MODAL_KEY); } transitionTo(Routes.ME, { navigationReplace: true }); setNewUserFlowCompleted(); }; getNextOnboardingStep = async function getNextOnboardingStep(c28315_0, c28315_1, c28315_2) { let r76, r152, r163; let key, c28315_5; let c31012_0, c31012_1, c31012_2, c31012_3, c31012_4, c31012_5, c31012_6, c31012_7; L31: { L30: { c28315_5 = void 0; c31012_0 = void 0; c31012_1 = void 0; c31012_2 = void 0; if (c28315_0 !== void 0) { c31012_0 = c28315_0; c31012_1 = c28315_1; c31012_2 = c28315_2; c31012_3 = void 0; c31012_4 = void 0; c31012_5 = void 0; c31012_6 = void 0; c31012_7 = void 0; } else { c31012_0 = false; c31012_1 = c28315_1; c31012_2 = c28315_2; c31012_3 = void 0; c31012_4 = void 0; c31012_5 = void 0; c31012_6 = void 0; c31012_7 = void 0; } await void 0; const key2 = c11691_15[c31012_1]?.key; key = key2; if (key2 == null) { key = "registration"; } c31012_3 = key; const r65 = c31012_2 + 1; c31012_2 = r65; if (r65 >= c11691_15.length) { (0, lastStepComplete)(c31012_3); r76 = { lastShownStepIndex: c31012_1, onboardingStepIndex: c31012_2, continueNavigation: false }; break L31; } c31012_4 = c11691_15[c31012_2]; c31012_5 = c31012_4.key; c31012_6 = c31012_4.shouldShowStep; c31012_7 = c31012_4.transitionStep; if (await (0, c31012_6)()) { c31012_1 = c31012_2; trackNUFStep(c31012_3, c31012_5, { skip: c31012_0 }); if (c31012_7 != null) { (0, lastStepComplete)(c31012_5); Dispatcher.wait(c31012_7); r152 = { lastShownStepIndex: c31012_1, onboardingStepIndex: c31012_2, continueNavigation: false }; } else { r152 = { lastShownStepIndex: c31012_1, onboardingStepIndex: c31012_2, continueNavigation: c11691_15[c31012_2]?.transitionStep == null }; } r163 = r152; break L30; } return await (0, getNextOnboardingStep)(c31012_0, c31012_1, c31012_2); } return r163; } return r76; }; const r38 = { key: "choose-avatar", shouldShowStep: () => UserStore.getCurrentUser()?.avatar == null }; c11691_13 = async () => { let r49; let c22931_0; L13: { c22931_0 = void 0; const r10 = !!isIOS(); if (r10) { r49 = await NativeModules.NativePermissionManager.getNotificationAuthorizationStatus() !== NotificationAuthorizationStatus.AUTHORIZED; break L13; } return r10; } return r49; }; const r42 = { key: "enable-notification", shouldShowStep: function() { const apply = c11691_13.apply; return c11691_13.apply(this, arguments); } }; c11691_14 = async () => { let r28; L13: { const friendSync = ConnectedAccountsStore.getLocalAccount(PlatformTypes.CONTACTS)?.friendSync; r28 = !friendSync; if (friendSync) { break L13; } return !await (function shouldSkipContactSyncStep() { return _shouldSkipContactSyncStep.apply(this, arguments); })(); } return r28; }; c11691_15 = [r42, { key: "contact-sync", shouldShowStep: function() { const apply = c11691_14.apply; return c11691_14.apply(this, arguments); } }, { key: "discoverability", shouldShowStep: () => true }, r38, { key: "connect-guardian", shouldShowStep: () => ParentalConsentStore.getShouldShowGuardianConnect() }, { key: "accept-invite", shouldShowStep: hasDeferredInvite, transitionStep: () => { Dispatcher.dispatch({ type: "DEFERRED_INVITE_SHOW" }); } }]; export function getKeyForOnboardingStep(a0) { return c11691_15[a0]?.key; } export function continueToNextStep(a0, a1) { const key2 = c11691_15[a0]?.key; if (key2 !== null) { a1.navigate(key2, {}); setTimeout(() => { const state = a1.getState(); const routes = state.routes; if (routes.length === 2) { a1.dispatch(CommonActions.reset({ ...state, routes: [routes[1]], index: 0 })); } }, 500); } } export { getNextOnboardingStep };