Files
discord-decomp/sources/modules/guild_onboarding/native/GuildOnboardingConnectionPrompt.tsx
T
2026-07-28 01:06:53 +03:00

470 lines
25 KiB
TypeScript

/* Metro module 6768; source: modules/guild_onboarding/native/GuildOnboardingConnectionPrompt.tsx; dependencies: [31, 27, 6616, 5109, 5040, 1867, 6603, 5106, 6600, 661, 33, 4501, 5314, 697, 1484, 1585, 566, 5105, 683, 4863, 6602, 6618, 4573, 1244, 6769, 6789, 4578, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import UseSafeAreaInsetsNative from '../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import ConnectedAccountsStore from '../../../stores/ConnectedAccountsStore.tsx'; /* Metro dependency 5040 */
import AuthorizedAppsStore from '../../../stores/AuthorizedAppsStore.tsx'; /* Metro dependency 5109 */
import GuildOnboardingPromptsStore from '../GuildOnboardingPromptsStore.tsx'; /* Metro dependency 6603 */
import MemberVerificationFormStore from '../../guild_member_verification/MemberVerificationFormStore.tsx'; /* Metro dependency 6616 */
import AnalyticsLocation from '../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as AppAnalyticsUtilsModule from '../../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
import * as GuildOnboardingUtilsModule from '../GuildOnboardingUtils.tsx'; /* Metro dependency 5105 */
import * as GuildOnboardingPromptsConstantsModule from '../GuildOnboardingPromptsConstants.tsx'; /* Metro dependency 5106 */
import * as NavigatorConstantsNativeModule from '../../../design/components/Navigator/native/NavigatorConstants.native.tsx'; /* Metro dependency 5314 */
import * as GuildOnboardingConstantsModule from './GuildOnboardingConstants.tsx'; /* Metro dependency 6600 */
import * as GuildOnboardingPromptsActionCreatorsModule from '../GuildOnboardingPromptsActionCreators.tsx'; /* Metro dependency 6602 */
import * as SafeAreaViewModule from '../../../components_native/common/SafeAreaView.tsx'; /* Metro dependency 6618 */
function _fun53304(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:6, offset: 0x01344d2a, size: 788 bytes, params: 8, frame: 23
const env0_0 = require;
const _arrayLikeToArray_53307 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_4 = value.View;
const env0_5 = value.ScrollView;
value = require(33) /* metro dependency 33 */;
const env0_14 = value.jsx;
const env0_15 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
object.flex = {flex: 1};
const object3 = {'display': 'flex', 'flex': 1, 'flexGrow': 1};
const NAV_BAR_HEIGHT = (NavigatorConstantsNativeModule).NAV_BAR_HEIGHT;
object3.marginTop = NAV_BAR_HEIGHT;
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.marginBottom = PX_16;
let BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object3.backgroundColor = BACKGROUND_BASE_LOWER;
object.container = object3;
const object4 = {'display': 'flex', 'flexGrow': 1};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.paddingHorizontal = PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.paddingTop = PX_16;
BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object4.backgroundColor = BACKGROUND_BASE_LOWER;
object.scrollContainer = object4;
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.header = {marginBottom: PX_24};
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.title = {marginBottom: PX_8};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.description = {marginTop: PX_8};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.connectionsList = {marginTop: PX_8};
const object8 = {'display': 'flex', 'flexDirection': 'column', 'justifyContent': 'flex-end', 'alignItems': 'center',
'bottom': 0, 'paddingBottom': null, 'position': 'absolute', 'width': '100%'};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object8.paddingBottom = PX_8;
BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object8.backgroundColor = BACKGROUND_BASE_LOWER;
object.footer = object8;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.footerContent = {width: '100%', paddingHorizontal: PX_16};
const env0_16 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/guild_onboarding/native/GuildOnboardingConnectionPrompt.tsx');
exports.default = GuildOnboardingConnectionPrompt;
function _createForOfIteratorHelperLoose_53305(a0, a1) { // fn#53305, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:325, offset: 0x0134503e, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun53306;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_53307(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_53307(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_53307(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun53306;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun53306() { // fn#53306, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:896, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function GuildOnboardingConnectionPrompt({guildId, onComplete, isLastStep}) { // fn#53308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:2199, offset: 0x013451b0, size: 1348 bytes, params: 2, frame: 39
var r16;
var object2;
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var items4;
var items6;
var object4;
var Button;
var value;
const styles = useStyles();
const value2 = (UseNavigationNativeModule).useNavigation();
const env0_3 = value2;
const bottom = (UseSafeAreaInsetsNative)().bottom;
const value3 = 64 + bottom;
const PX_8 = (Native).space.PX_8;
const value4 = value3 + PX_8;
const binding = env0_3;
const env0_4 = binding.useRef(false);
const useStateFromStores = FluxModule.useStateFromStores;
const guildOnboardingPromptsStoreBinding = GuildOnboardingPromptsStore;
const connections = Reflect.apply(useStateFromStores, FluxModule, [[guildOnboardingPromptsStoreBinding],
function() {
return GuildOnboardingPromptsStore.getConnections(guildId);
}]);
const value5 = FluxModule.useStateFromStoresArray([guildOnboardingPromptsStoreBinding], function() {
return GuildOnboardingPromptsStore.getOnboardingPromptsForOnboarding(guildId);
});
const guild = FluxModule.useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
const rulesPrompt = FluxModule.useStateFromStores([MemberVerificationFormStore], function() {
return MemberVerificationFormStore.getRulesPrompt(guildId);
});
const value6 = FluxModule.useStateFromStores([guildOnboardingPromptsStoreBinding], function() {
return GuildOnboardingPromptsStore.isLoading();
});
const value7 = FluxModule.useStateFromStores([AuthorizedAppsStore, ConnectedAccountsStore], _fun53314,
[connections]);
binding.useEffect(_fun53315, [guildId, value6, connections]);
const value8 = binding.useCallback(_fun53316, [value5.length, guild, rulesPrompt, value2, onComplete, connections,
value7, isLastStep, guildId]);
const SafeAreaPaddingView = (SafeAreaViewModule).SafeAreaPaddingView;
const safeAreaPaddingViewProps = {top: true, style: [styles.flex, styles.container]};
if (value6) {
safeAreaPaddingViewProps.children = (
<View style={[styles.flex, {'justifyContent': 'center', 'alignItems': 'center'}]}>
<Text variant="text-md/normal" color="text-muted">
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.ZTNur7)}
</Text>
</View>
);
} else {
var viewBindingProps = {style: styles.flex};
var scrollViewProps = {contentContainerStyle: [styles.scrollContainer, {paddingBottom: value4}]};
var viewBindingProps2 = {style: styles.header};
string = intl.string;
items4 = [
<Text
style={styles.title}
accessibilityRole="header"
variant="heading-xl/semibold"
color="mobile-text-heading-primary"
>
{Reflect.apply(string, intl, [t.eDVMrA])}
</Text>,
];
string = intl.string;
items4[1] = (
<Text
style={styles.description}
variant="text-md/normal"
color="text-muted"
>
{Reflect.apply(string, intl, [t.BozOXu])}
</Text>
);
items6 = [
<ScrollView {...scrollViewProps}>
<View {...viewBindingProps2}>
{items4}
</View>
<View style={styles.connectionsList}>
{connections.map(_fun53317)}
</View>
</ScrollView>,
];
var viewProps = {style: [styles.footer, styles.footerContent, {paddingBottom: bottom}]};
Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
var buttonProps = {variant: value7 || isLastStep ? 'primary' : 'secondary', size: 'md'};
string = intl.string;
if (isLastStep) {
value = Reflect.apply(string, intl, [t['8SuVoE']]);
value = '' + value + ' 🎉';
r16 = value;
} else {
r16 = value7 ? Reflect.apply(string, intl, [t.PDTjLN]) : Reflect.apply(string, intl, [t['5Wxrcd']]);
}
buttonProps.text = r16;
buttonProps.onPress = value8;
buttonProps.grow = true;
items6[1] = (
<View {...viewProps}>
<Button {...buttonProps} />
</View>
);
safeAreaPaddingViewProps.children = (
<View {...viewBindingProps}>
{items6}
</View>
);
}
return <SafeAreaPaddingView {...safeAreaPaddingViewProps} />;
function _fun53314() { // fn#53314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:2739, offset: 0x01345773, size: 208 bytes, params: 1, frame: 20
var r2;
var value5;
var connection_type;
var APPLICATION;
var PROVIDER_CONNECTED_ACCOUNT;
var provider_id;
var connectedAccountsStoreBinding;
var getAccount;
var value6;
var revoked;
var authorizedAppsStoreBinding;
var getNewestTokenForApplication;
var application_id;
var value7;
const value3 = _createForOfIteratorHelperLoose_53305(connections);
const value4 = value3();
let done = value4.done;
if (!done) {
r2 = value4;
reducibleLoop1: while (true) {
value5 = r2.value;
connection_type = value5.connection_type;
APPLICATION = OnboardingConnectionType.APPLICATION;
if (connection_type === APPLICATION) {
authorizedAppsStoreBinding = AuthorizedAppsStore;
getNewestTokenForApplication = authorizedAppsStoreBinding.getNewestTokenForApplication;
application_id = value5.application_id;
reducibleJoin8: while (true) {
if (Reflect.apply(getNewestTokenForApplication, authorizedAppsStoreBinding,
[application_id]) != null) {
return true;
}
break reducibleJoin8;
}
} else {
connection_type = value5.connection_type;
PROVIDER_CONNECTED_ACCOUNT = OnboardingConnectionType.PROVIDER_CONNECTED_ACCOUNT;
reducibleJoin8: while (true) {
if (connection_type !== PROVIDER_CONNECTED_ACCOUNT) {
break reducibleJoin8;
}
provider_id = value5.provider_id;
if (provider_id == null) {
break reducibleJoin8;
}
connectedAccountsStoreBinding = ConnectedAccountsStore;
getAccount = connectedAccountsStoreBinding.getAccount;
provider_id = value5.provider_id;
value6 = Reflect.apply(getAccount, connectedAccountsStoreBinding, [null, provider_id]);
if (value6 == null) {
break reducibleJoin8;
}
revoked = value6.revoked;
if (!revoked) {
return true;
}
break reducibleJoin8;
}
}
value7 = value3();
done = value7.done;
if (done) {
return false;
}
r2 = value7;
continue reducibleLoop1;
}
}
return false;
}
function _fun53315() { // fn#53315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:3106, offset: 0x01345843, size: 301 bytes, params: 1, frame: 22
var connectionsBinding;
var value2;
var moduleValue;
var getProviderConnectionState;
var value3;
var applicationConnectionState;
var defaultImport;
var track;
var GUILD_ONBOARDING_STEP_VIEWED;
var object;
var moduleValue3;
var connected;
var notConnected;
if (!env0_9) {
if (connections.length !== 0) {
if (!env0_4.current) {
value2 = environment.__proto__;
moduleValue = require(5105) /* metro dependency 5105: GuildOnboardingUtils */;
getProviderConnectionState = moduleValue.getProviderConnectionState;
connectionsBinding = connections;
value3 = Reflect.apply(getProviderConnectionState, moduleValue, [connectionsBinding]);
applicationConnectionState = (require(5105) /* metro dependency 5105: GuildOnboardingUtils */).getApplicationConnectionState(connectionsBinding);
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
GUILD_ONBOARDING_STEP_VIEWED = AnalyticEvents.GUILD_ONBOARDING_STEP_VIEWED;
object = {};
moduleValue3 = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, moduleValue3.collectGuildAnalyticsMetadata(guildId), moduleValue3);
object['step'] = (require(6602) /* metro dependency 6602: GuildOnboardingPromptsActionCreators */).CONNECTIONS_STEP;
object['required'] = false;
connected = value3.connected;
object['provider_connections_connected'] = connected;
notConnected = value3.notConnected;
object['provider_connections_not_connected'] = notConnected;
connected = applicationConnectionState.connected;
object['application_connections_connected'] = connected;
notConnected = applicationConnectionState.notConnected;
object['application_connections_not_connected'] = notConnected;
Reflect.apply(track, defaultImport, [GUILD_ONBOARDING_STEP_VIEWED, object]);
env0_4.current = true;
}
}
}
}
function _fun53316() { // fn#53316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:3612, offset: 0x01345970, size: 420 bytes, params: 1, frame: 24
var moduleValue4;
var binding;
const getProviderConnectionState = GuildOnboardingUtilsModule.getProviderConnectionState;
const connectionsBinding = connections;
const value3 = Reflect.apply(getProviderConnectionState, GuildOnboardingUtilsModule, [connectionsBinding]);
const applicationConnectionState = GuildOnboardingUtilsModule.getApplicationConnectionState(connectionsBinding);
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const GUILD_ONBOARDING_STEP_COMPLETED = AnalyticEvents.GUILD_ONBOARDING_STEP_COMPLETED;
const object = {};
copyDataProperties(object, AppAnalyticsUtilsModule.collectGuildAnalyticsMetadata(guildId), AppAnalyticsUtilsModule);
const CONNECTIONS_STEP = (GuildOnboardingPromptsActionCreatorsModule).CONNECTIONS_STEP;
object['step'] = CONNECTIONS_STEP;
object['skipped'] = !env0_10;
object['back'] = false;
object['options_selected'] = 0;
object['in_onboarding'] = true;
object['is_final_step'] = isLastStep;
object['provider_connections_connected'] = value3.connected;
object['provider_connections_not_connected'] = value3.notConnected;
object['application_connections_connected'] = applicationConnectionState.connected;
object['application_connections_not_connected'] = applicationConnectionState.notConnected;
Reflect.apply(track, defaultImport, [GUILD_ONBOARDING_STEP_COMPLETED, object]);
if (env0_6.length > 0) {
binding = env0_3;
binding.push(GuildOnboardingModalStates.PROMPT, {currentPrompt: 0});
} else {
moduleValue4 = GuildOnboardingUtilsModule;
if (moduleValue4.showRulesInOnboarding(guild, rulesPrompt)) {
binding = env0_3;
binding.push(GuildOnboardingModalStates.RULES);
} else {
onComplete();
}
}
}
function _fun53317(a0, a1) { // fn#53317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6946:5050, offset: 0x01345b14, size: 84 bytes, params: 3, frame: 17
let value = environment.__proto__;
value = importDefault(6769) /* metro dependency 6769: ConnectionCard */;
const guildIdBinding = guildId;
const GUILD_ONBOARDING = (AnalyticsLocation).GUILD_ONBOARDING;
return ((Component) => <Component connection={a0} guildId={guildIdBinding} location={GUILD_ONBOARDING} key={a1} />)(value);
}
}
}
global.__d(_fun53304, 6768, [31, 27, 6616, 5109, 5040, 1867, 6603, 5106, 6600, 661, 33, 4501, 5314, 697, 1484, 1585,
566, 5105, 683, 4863, 6602, 6618, 4573, 1244, 6769, 6789, 4578,
2]) /* metro module 6768, dependencies: [31, 27, 6616, 5109, 5040, 1867, 6603, 5106, 6600, 661, 33, 4501, 5314, 697, 1484, 1585, 566, 5105, 683, 4863, 6602, 6618, 4573, 1244, 6769, 6789, 4578, 2] */;