// Module ID: 17956 // Function ID: 17957 // Name: NewUserUtils // Dependencies: [5, 17, 16375, 5586, 1372, 1074, 13026, 5038, 13028, 1364, 10167, 573, 1485, 13031, 4686, 17957, 5032, 1101, 13094, 2] // Exports: continueToNextStep, getKeyForOnboardingStep // Module 17956 (NewUserUtils) import DispatcherDefault from "Dispatcher" /* 573 */; import router_utils from "router_utils" /* 1101 */; import PlatformUtils from "PlatformUtils" /* 1364 */; import Link from "Link" /* 1485 */; import NavigationRouteUtils from "NavigationRouteUtils" /* 4686 */; import ModalActionCreatorsDefault from "ModalActionCreators" /* 5032 */; import ContactSyncUtils from "ContactSyncUtils" /* 13028 */; import NewUserAnalyticsUtils from "NewUserAnalyticsUtils" /* 13031 */; import nuf_NUFActionCreators from "nuf/NUFActionCreators" /* 13094 */; import NewUserModalTypes from "NewUserModalTypes" /* 17957 */; import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */; import ParentalConsentStore from "ParentalConsentStore" /* 16375 */; import ConnectedAccountsStore from "ConnectedAccountsStore" /* 5586 */; import UserStore from "UserStore" /* 1372 */; require = fn; let closure_12 = async function _shouldSkipContactSyncStep(arg0, value) { if (c2 === 2) { c2 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp3 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "HermesInternal", done: null }; } } else { try { c2 = 2; if (0 === c1) { if (arg0 === 1) { c2 = 3; throw value; } else if (arg0 === 2) { c2 = 3; const obj5 = { value, done: true }; return obj5; } else { closure_0 = tmp4; const result = ContactSyncUtils.isContactSyncAvailable(); if (result) { c1 = 1; c2 = 1; const obj6 = { value: ContactSyncUtils.checkContactPermissions(), done: false }; return obj6; } else { c2 = 3; } } } else if (arg0 === 1) { c2 = 3; throw value; } else if (arg0 !== 2) { if (value === closure_128_10.UNAUTHORIZED) { closure_128_0(closure_128_2[9]).isIOS(); const obj = closure_128_0(closure_128_2[9]); } } c2 = 3; const obj7 = { value, done: true }; return obj7; } catch (tmp17) { c2 = tmp; throw tmp17; } } }; function lastStepComplete(STEP_GUILD_TEMPLATE) { NewUserAnalyticsUtils.trackNUFStep(STEP_GUILD_TEMPLATE, "NUF Complete"); if (obj2.isModalOpen(NewUserModalTypes.NEW_USER_MODAL_KEY)) { ModalActionCreatorsDefault.popWithKey(tmp(17957).NEW_USER_MODAL_KEY); } obj2 = NavigationRouteUtils; router_utils.transitionTo(constants2.ME, { navigationReplace: true }); const tmpResult = router_utils; const result = nuf_NUFActionCreators.setNewUserFlowCompleted(); } function getNextOnboardingStep() { const self = this; const apply = closure_18.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } let closure_18 = async function _getNextOnboardingStep(arg0, value) { if (c7 === 2) { c7 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp4 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "HermesInternal", done: null }; } } else { try { c7 = 2; if (0 === c6) { if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; const obj5 = { value, done: true }; return obj5; } else { closure_5 = tmp5; closure_4 = tmp2; closure_132_0 = undefined; closure_132_1 = undefined; closure_132_2 = undefined; let flag = closure_0; if (closure_0 === undefined) { flag = false; } closure_132_0 = flag; closure_132_1 = closure_1; closure_132_2 = closure_2; closure_132_3 = undefined; closure_132_4 = undefined; let key2; let shouldShowStep; let transitionStep2; c6 = 1; c7 = 1; return { value: "flex", done: true }; } } else if (1 === tmp5) { if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; const obj6 = { value, done: true }; return obj6; } else { let key; if (closure_133_15[closure_132_1] != null) { key = tmp75.key; } let registration = key; if (key == null) { registration = "registration"; } closure_132_3 = registration; const sum = closure_132_2 + 1; closure_132_2 = sum; if (sum >= closure_133_15.length) { closure_133_16(closure_132_3); const obj7 = { lastShownStepIndex: closure_132_1, onboardingStepIndex: closure_132_2, continueNavigation: false }; c7 = 3; const obj8 = { value: obj7, done: true }; return obj8; } else { closure_132_4 = closure_133_15[closure_132_2]; key2 = closure_132_4.key; shouldShowStep = closure_132_4.shouldShowStep; transitionStep2 = closure_132_4.transitionStep; c6 = 2; c7 = 1; const obj9 = { value: shouldShowStep(), done: false }; return obj9; } } } else if (2 === tmp5) { if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 === 2) { c7 = 3; const obj10 = { value, done: true }; return obj10; } else if (value) { closure_132_1 = closure_132_2; const obj11 = { skip: closure_132_0 }; closure_133_0(closure_133_2[13]).trackNUFStep(closure_132_3, key2, obj11); if (null != transitionStep2) { closure_133_16(key2); closure_133_1(closure_133_2[11]).wait(transitionStep2); const obj12 = { lastShownStepIndex: closure_132_1, onboardingStepIndex: closure_132_2, continueNavigation: false }; let obj13 = obj12; const obj3 = closure_133_1(closure_133_2[11]); } else { obj13 = { lastShownStepIndex: closure_132_1, onboardingStepIndex: closure_132_2, continueNavigation: null }; let transitionStep; if (closure_133_15[closure_132_2] != null) { transitionStep = tmp26.transitionStep; } obj13.continueNavigation = null == transitionStep; } const obj4 = closure_133_0(closure_133_2[13]); } else { c6 = 3; c7 = 1; const obj14 = { value: closure_133_17(closure_132_0, closure_132_1, closure_132_2), done: false }; return obj14; } } else if (arg0 === 1) { c7 = 3; throw value; } else if (arg0 !== 2) { c7 = 3; const obj15 = { value, done: true }; return obj15; } else { c7 = 3; const obj = { value, done: true }; return obj; } } catch (tmp64) { c7 = tmp; throw tmp64; } } }; const NativeModules = fn(17).NativeModules; const Constants = fn(1074); ({ PlatformTypes: closure_8, Routes: closure_9 } = Constants); const ContactPermissions = fn(13026).ContactPermissions; let closure_11 = fn(5038).NotificationAuthorizationStatus; let obj2 = { key: "enable-notification", shouldShowStep: null }; let closure_13 = asyncGeneratorStep(async (arg0, value) => { if (c2 === 2) { c2 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp3 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj3 = { value, done: true }; return obj3; } else { return { value: "HermesInternal", done: null }; } } else { try { c2 = 2; if (0 === c1) { if (arg0 === 1) { c2 = 3; throw value; } else if (arg0 === 2) { c2 = 3; const obj4 = { value, done: true }; return obj4; } else { closure_0 = tmp4; if (obj2.isIOS()) { const NativePermissionManager = NativeModules.NativePermissionManager; c1 = 1; c2 = 1; const obj5 = { value: NativePermissionManager.getNotificationAuthorizationStatus(), done: false }; return obj5; } else { c2 = 3; } obj2 = PlatformUtils; } } else if (arg0 === 1) { c2 = 3; throw value; } c2 = 3; const obj = { value, done: true }; return obj; } catch (tmp11) { c2 = tmp; throw tmp11; } } }); obj2.shouldShowStep = function() { const self = this; const apply = closure_13.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }; let obj3 = { key: "contact-sync", shouldShowStep: null }; let closure_14 = asyncGeneratorStep(async (arg0, value) => { if (c0 === 2) { c0 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp3 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "HermesInternal", done: null }; } } else { try { c0 = 2; if (0 === c1) { if (arg0 === 1) { c0 = 3; throw value; } else if (arg0 === 2) { c0 = 3; const obj3 = { value, done: true }; return obj3; } else { const localAccount = ConnectedAccountsStore.getLocalAccount(constants.CONTACTS); let friendSync; if (localAccount != null) { friendSync = localAccount.friendSync; } if (friendSync) { c0 = 3; } else { c1 = 1; c0 = 1; const obj4 = { value: (function shouldSkipContactSyncStep() { const self = this; const apply = closure_1_12.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; })(), done: false }; return obj4; } } } else if (arg0 === 1) { c0 = 3; throw value; } c0 = 3; const obj = { value, done: true }; return obj; } catch (tmp12) { c0 = tmp; throw tmp12; } } }); obj3.shouldShowStep = function() { const self = this; const apply = closure_14.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }; let items = [ obj2, obj3, { key: "discoverability", shouldShowStep() { return true; } }, { key: "choose-avatar", shouldShowStep() { const currentUser = UserStore.getCurrentUser(); let avatar; if (currentUser != null) { avatar = currentUser.avatar; } return null == avatar; } }, { key: "connect-guardian", shouldShowStep() { return ParentalConsentStore.getShouldShowGuardianConnect(); } }, { key: "accept-invite", shouldShowStep: fn(10167).hasDeferredInvite, transitionStep() { DispatcherDefault.dispatch({ type: "DEFERRED_INVITE_SHOW" }); } } ]; const size = fn(2); let result = size.fileFinishedImporting("modules/nuf/native/NewUserUtils.tsx"); export const getKeyForOnboardingStep = function getKeyForOnboardingStep(onboardingStepIndex) { let key; if (items[onboardingStepIndex] != null) { key = tmp.key; } return key; }; export const continueToNextStep = function continueToNextStep(onboardingStepIndex, current) { let state = current; let key; if (items[onboardingStepIndex] != null) { key = tmp.key; } if (null !== key) { current.navigate(key, {}); const _setTimeout = setTimeout; const timerId = setTimeout(() => { state = state.getState(); const routes = state.routes; if (2 === routes.length) { items = [routes[1]]; const CommonActions = Link.CommonActions; const obj2 = {}; const merged = Object.assign(state); obj2.routes = items; obj2.index = 0; state.dispatch(CommonActions.reset(obj2)); } }, 500); } }; export { getNextOnboardingStep };