This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,197 @@
// Metro module 15164 (f15165).
import { memo } from "react";
import { Image as Image2, View } from "react-native";
import UserStore from "../../../stores/UserStore";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import Module712 from "../../../_bundle/Module712";
import GameIcon, { GameIconSizes, GameIconImageSize } from "../../game_detection/native/GameIcon";
import mobileAccountLinkingExperiment, { MobileAccountLinkingBannerSize } from "../experiments/mobileAccountLinkingExperiment";
import { scaleTextLineHeight } from "../../screen/native/useScaledTextLineHeight.android";
import { MEDIUM_BUTTON_HEIGHT, SMALL_BUTTON_HEIGHT } from "../../../design/components/Button/native/ButtonConstants.native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { Card } from "../../../design/components/Card/native/Card.native";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { Avatar, AvatarSizes } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { ExperimentalGameControllerLinkIcon } from "../../../design/components/Icon/native/redesign/generated/ExperimentalGameControllerLinkIcon";
let PX_8, PX_82, PX_12, PX_16, PX_4, NORMAL, c10760_16, variant, variant2, PX_162, PX_122, useStyles, useStyles2, AccountLinkMediumBanner;
const AccountLinkLargeBanner = function AccountLinkLargeBanner(props) {
let analyticsLocations;
const { application, markAsDismissed, startAuthorization } = props;
analyticsLocations = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.MOBILE_ACCOUNT_LINK_LARGE_BANNER).analyticsLocations;
const name = application.name;
const reward_name = application.applicationAccountLinkBenefitConfig?.reward_name;
return reward_name == null ? null : <Card variant="secondary" style={styles.card}>
<PressableOpacity accessibilityRole="button" onPress={() => markAsDismissed(ContentDismissActionType.USER_DISMISS)} style={styles.closeButton}>
<XSmallIcon size="sm" color="text-muted" />
</PressableOpacity>
<View style={styles.imagesContainer}>
<GameIcon game={application} size={NORMAL} />
<View style={styles.ellipsisContainer}>
<View style={styles.ellipsisDot} />
<View style={styles.ellipsisDot} />
<View style={styles.ellipsisDot} />
</View>
<Avatar user={stateFromStores} size={AvatarSizes.LARGE_48} guildId={void 0} />
</View>
<Text variant={variant} color="mobile-text-heading-primary" style={styles.title}>
{intl.formatToPlainString(t["3gpxqO"], {
gameName: name
})}
</Text>
<Text variant={variant2} color="text-muted" style={styles.body}>
{intl.formatToPlainString(t.vxvKMm, {
rewardName: reward_name
})}
</Text>
<View style={styles.ctaContainer}>
<Button variant="secondary" size="md" text={intl.string(t["0mvtKL"])} onPress={() => {
startAuthorization({
analyticsLocations
});
}} icon={<ExperimentalGameControllerLinkIcon size="sm" />} />
</View>
</Card>;
};
AccountLinkMediumBanner = function AccountLinkMediumBanner(props) {
const { application, markAsDismissed: markAsDismissed2, startAuthorization: startAuthorization2 } = props;
const styles2 = useStyles2();
const analyticsLocations2 = useAnalyticsLocations(AnalyticsLocation.MOBILE_ACCOUNT_LINK_MEDIUM_BANNER).analyticsLocations;
const name = application.name;
const reward_name = application.applicationAccountLinkBenefitConfig?.reward_name;
const reward_image = application.applicationAccountLinkBenefitConfig?.reward_image;
return reward_name == null ? null : reward_image == null ? null : <Card variant="secondary" style={styles2.card}>
<View style={styles2.contentContainer}>
<Image2 source={{
uri: reward_image
}} style={styles2.rewardImage} resizeMode="contain" />
<Text variant="heading-sm/semibold" color="mobile-text-heading-primary" style={styles2.bodyText}>
{intl.formatToPlainString(t["V/C76E"], {
gameName: name,
rewardName: reward_name
})}
</Text>
<PressableOpacity accessibilityRole="button" onPress={() => markAsDismissed2(ContentDismissActionType.USER_DISMISS)} style={styles2.closeButton}>
<XSmallIcon size="sm" color="text-muted" />
</PressableOpacity>
</View>
<View style={styles2.ctaContainer}>
<Button variant="secondary" size="sm" text={intl.string(t["0mvtKL"])} onPress={() => {
startAuthorization2({
analyticsLocations: analyticsLocations2
});
}} icon={<ExperimentalGameControllerLinkIcon size="xs" />} />
</View>
</Card>;
};
PX_8 = Module712.space.PX_8;
PX_82 = Module712.space.PX_8;
PX_12 = Module712.space.PX_12;
PX_16 = Module712.space.PX_16;
PX_4 = Module712.space.PX_4;
NORMAL = GameIconSizes.NORMAL;
c10760_16 = GameIconImageSize[NORMAL];
variant = "heading-md/bold";
variant2 = "text-sm/medium";
PX_162 = Module712.space.PX_16;
PX_122 = Module712.space.PX_12;
useStyles = createStyles({
card: {
padding: PX_12
},
closeButton: {
position: "absolute",
top: Module712.space.PX_12,
right: Module712.space.PX_12,
width: 24,
height: 24,
alignItems: "center",
justifyContent: "center",
zIndex: 1
},
imagesContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center"
},
ellipsisContainer: {
flexDirection: "row",
alignItems: "center",
marginHorizontal: Module712.space.PX_8,
gap: Module712.space.PX_4
},
ellipsisDot: {
width: Module712.space.PX_4,
height: Module712.space.PX_4,
borderRadius: Module712.space.PX_4 / 2,
backgroundColor: Module712.colors.INTERACTIVE_MUTED
},
title: {
marginTop: PX_16,
textAlign: "center"
},
body: {
marginTop: PX_4,
textAlign: "center"
},
ctaContainer: {
marginTop: PX_162
}
});
useStyles2 = createStyles({
card: {
padding: PX_12
},
closeButton: {
width: 24,
height: 24,
alignItems: "center",
justifyContent: "center",
alignSelf: "flex-start"
},
contentContainer: {
flexDirection: "row",
gap: Module712.space.PX_12
},
rewardImage: {
width: 48,
height: 48
},
bodyText: {
flexGrow: 1,
flexShrink: 1,
alignSelf: "center"
},
ctaContainer: {
marginTop: PX_122,
width: "100%"
}
});
const r133 = memo(function(a0) {
const config = mobileAccountLinkingExperiment.useConfig({
location: "AccountLinkBanner"
});
const { enabled, bannerSize } = config;
return enabled ? <>
{[bannerSize === MobileAccountLinkingBannerSize.LARGE && <AccountLinkLargeBanner {...a0} />, bannerSize === MobileAccountLinkingBannerSize.MEDIUM && <AccountLinkMediumBanner {...a0} />]}
</> : null;
});
export default r133;
export { PX_8 as ACCOUNT_LINK_BANNER_MARGIN_TOP };
export { PX_82 as ACCOUNT_LINK_BANNER_MARGIN_BOTTOM };
export function getScaledAccountLinkBannerHeight(a0) {
const config = mobileAccountLinkingExperiment.getConfig({
location: "getScaledAccountLinkBannerHeight"
});
const { enabled, bannerSize } = config;
return enabled ? bannerSize === MobileAccountLinkingBannerSize.LARGE ? PX_8 + PX_12 + c10760_16 + PX_16 + scaleTextLineHeight(variant, a0) + PX_4 + 2 * scaleTextLineHeight(variant2, a0) + PX_162 + MEDIUM_BUTTON_HEIGHT + PX_12 + PX_82 : bannerSize === MobileAccountLinkingBannerSize.MEDIUM ? PX_8 + PX_12 + 48 + PX_122 + SMALL_BUTTON_HEIGHT + PX_12 + PX_82 : 0 : 0;
}
@@ -0,0 +1,35 @@
// Metro module 16728 (f16729).
import { AccountLinkManager } from "../AccountLinkManager";
import { subscribeToIsInAppBrowserOpen } from "../../links/native/BrowserManager";
let prototype, AccountLinkManagerNative;
const AccountLinkManagerNative2 = class AccountLinkManagerNative extends AccountLinkManager {
unsubscribeBrowser = null;
isBrowserOpen = false;
_initialize() {
Reflect.get(Object.getPrototypeOf(prototype), "_initialize", this).call(this);
this.unsubscribeBrowser = subscribeToIsInAppBrowserOpen((a0, a1) => {
this.isBrowserOpen = a0;
if (a1) {
this.evaluatePending();
}
});
}
_terminate() {
Reflect.get(Object.getPrototypeOf(prototype), "_terminate", this).call(this);
const unsubscribeBrowser = this.unsubscribeBrowser;
if (unsubscribeBrowser != null) {
unsubscribeBrowser.call(this);
}
this.unsubscribeBrowser = null;
}
evaluatePending() {
if (!this.isBrowserOpen) {
Reflect.get(Object.getPrototypeOf(prototype), "evaluatePending", this).call(this);
}
}
};
const prototype2 = AccountLinkManagerNative2.prototype;
AccountLinkManagerNative = AccountLinkManagerNative2;
prototype = prototype2;
const accountLinkManagerNative = new AccountLinkManagerNative();
export default accountLinkManagerNative;
@@ -0,0 +1,166 @@
// Metro module 15768 (f15769).
import { useCallback } from "react";
import { View } from "react-native";
import ApplicationStore from "../../applications/ApplicationStore";
import ConnectedAccountsStore from "../../../stores/ConnectedAccountsStore";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useThemeContext } from "../../../_bundle/Module3901";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import Platforms from "../../../lib/Platforms";
import useStartAuthorize from "./useStartAuthorize";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { claimIncentivizedAccountLinkingReward } from "../AccountLinkManager";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { UnionIcon } from "../../local_app_detection/native/RobloxConnectionCoachmark";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import ApplicationAccountLinking_messages from "../ApplicationAccountLinking.messages";
import { OrbsIcon } from "../../../design/components/Icon/native/redesign/generated/OrbsIcon";
import { Button } from "../../../design/components/Button/native/Button.native";
import { WindowLaunchIcon } from "../../../design/components/Icon/native/redesign/generated/WindowLaunchIcon";
import * as _themes from "../../../design/utils/shared/themes";
import { makeSource } from "../../../utils/AvatarUtils";
import Icon, { IconSizes } from "../../../design/void/Icon/native/Icon";
import GameIcon, { GameIconSizes } from "../../game_detection/native/GameIcon";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
let useStyles, ApplicationIcon;
const ConnectionIcon = function ConnectionIcon(props) {
const { platform: platform2, theme } = props;
const styles = useStyles();
const isThemeDark = _themes.isThemeDark(theme);
const icon = platform2.icon;
return <View style={styles.iconContainer}>
<Icon size={IconSizes.CUSTOM} source={makeSource(isThemeDark ? icon.darkPNG : icon.lightPNG)} disableColor style={styles.connectionIcon} />
</View>;
};
ApplicationIcon = function ApplicationIcon(props) {
const application = props.application;
return <View style={useStyles().iconContainer}>
{application != null ? <GameIcon game={application} size={GameIconSizes.NORMAL} /> : null}
</View>;
};
useStyles = createStyles({
iconContainer: {
width: 56,
height: 56,
alignItems: "center",
justifyContent: "center"
},
content: {
paddingHorizontal: Module712.space.PX_16
},
text: {
textAlign: "center"
},
connectionIcon: {
height: 48,
width: 48
}
});
export default function ConnectionDeprecationBottomSheet(props) {
let replacedBy, startAuthorization, analyticsLocations, callback;
const platformTypes = props.platformTypes;
let applicationName = props.applicationName;
const markAsDismissed = props.markAsDismissed;
replacedBy = void 0;
startAuthorization = void 0;
analyticsLocations = void 0;
callback = void 0;
const styles = useStyles();
const theme = useThemeContext().theme;
const bottom = useSafeAreaInsets_native().bottom;
const stateFromStores2 = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.getAccounts().find((item) => platformTypes.includes(item.type))?.type);
const platform2 = stateFromStores2 != null ? Platforms.get(stateFromStores2) : null;
replacedBy = platform2 == null ? void 0 : platform2.migrationData?.replacedBy;
const stateFromStores = useStateFromStores([ApplicationStore], () => ApplicationStore.getApplication(replacedBy));
startAuthorization = useStartAuthorize(stateFromStores).startAuthorization;
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.ACTION_SHEET).analyticsLocations;
callback = useCallback(() => {
claimIncentivizedAccountLinkingReward({
applicationId: replacedBy,
onSuccess: () => {
ActionSheetActionCreators.openLazy(import("./IncentivizedAccountLinkConfirmationBottomSheet"), "IncentivizedAccountLinkConfirmationBottomSheet");
}
});
}, [replacedBy]);
const callback2 = useCallback(() => {
ActionSheetActionCreators.hideActionSheet();
if (markAsDismissed != null) {
markAsDismissed(ContentDismissActionType.PRIMARY);
}
startAuthorization({
analyticsLocations,
onSuccess: callback
});
}, [analyticsLocations, startAuthorization, markAsDismissed, callback]);
if (platform2 != null && stateFromStores != null) {
if (applicationName == null) {
applicationName = stateFromStores.name;
}
return <BottomSheet startExpanded contentStyles={styles.content} header={<BottomSheetTitleHeader title={null} />} onDismiss={() => markAsDismissed(ContentDismissActionType.DISMISS)}>
<Stack spacing={24} style={{
paddingBottom: bottom
}}>
<Stack justify="center" align="center" direction="horizontal">
<ConnectionIcon theme={theme} platform={platform2} />
<UnionIcon theme={theme} />
<ApplicationIcon application={stateFromStores} />
</Stack>
<Stack justify="center">
<Text variant="heading-xl/bold" style={styles.text}>
{intl.string(ApplicationAccountLinking_messages.vycLU2)}
</Text>
<Text variant="text-md/medium" style={styles.text}>
{intl.format(ApplicationAccountLinking_messages.DfSSdL, {
connectionName: platform2.name,
applicationName,
orbCount: 200,
orbsIconHook: () => <OrbsIcon size="xs" color={Module712.colors.TEXT_STRONG} />
})}
</Text>
</Stack>
<Stack>
<Button text={intl.string(ApplicationAccountLinking_messages.ZeOhh9)} icon={<WindowLaunchIcon size="sm" color={Module712.colors.WHITE} />} iconPosition="end" size="lg" onPress={callback2} />
<Button text={intl.string(t.TulDPl)} variant="secondary" size="lg" onPress={function onPress() {
ActionSheetActionCreators.hideActionSheet();
if (markAsDismissed != null) {
markAsDismissed(ContentDismissActionType.DISMISS);
}
}} />
</Stack>
</Stack>
</BottomSheet>;
}
return false;
};
export function useShouldShowConnectionDeprecationBottomSheet({ deprecatedPlatformTypes }) {
const stateFromStoresObject = useStateFromStoresObject([ConnectedAccountsStore], () => ({
fetchingConnections: ConnectedAccountsStore.isFetching(),
matchingPlatform: ConnectedAccountsStore.getAccounts().map((item) => Platforms.get(item.type)).find((item) => {
const migrationData = item.migrationData;
return (migrationData == null ? void 0 : migrationData.getMigrationExperimentEnabled("ConnectionDeprecationBottomSheet")) && deprecatedPlatformTypes.includes(item.type);
})
}));
let fetchingConnections = stateFromStoresObject.fetchingConnections;
const matchingPlatform = stateFromStoresObject.matchingPlatform;
const getOrFetchApplication = useGetOrFetchApplication(matchingPlatform == null ? void 0 : matchingPlatform.migrationData?.replacedBy);
const startAuthorize = useStartAuthorize(getOrFetchApplication);
const { hasAlreadyLinked, canStartAuthorization, fetched } = startAuthorize;
if (!fetchingConnections) {
fetchingConnections = !fetched;
}
if (!fetchingConnections) {
fetchingConnections = !canStartAuthorization;
}
if (!fetchingConnections) {
fetchingConnections = getOrFetchApplication == null;
}
return fetchingConnections ? !fetchingConnections : !hasAlreadyLinked;
}
@@ -0,0 +1,43 @@
// Metro module 15771 (f15772).
import { Image as Image2 } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { HelpdeskArticles } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import Module14628 from "../../../_bundle/Module14628";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module6208 from "../../../_bundle/Module6208";
import Module14629 from "../../../_bundle/Module14629";
import FastImage from "../../../components_native/common/FastImage";
import { Button } from "../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../intl/index.native";
import { WindowLaunchIcon } from "../../../design/components/Icon/native/redesign/generated/WindowLaunchIcon";
import Module712 from "../../../_bundle/Module712";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import Linking from "../../../lib/native/Linking";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { PromoSheet } from "../../../design/components/Sheet/native/PromoSheet.native";
import IncentivizedAccountLinking_messages from "../IncentivizedAccountLinking.messages";
const width = 150;
export default function IncentivizedAccountLinkConfirmationBottomSheet() {
const illustration = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion) ? <Image2 source={{
uri: Module14628
}} style={{
width,
height: width
}} /> : isAndroid() ? <Module6208 url={Module14629} style={{
width,
height: width
}} /> : <FastImage source={{
uri: Module14629
}} resizeMode="contain" style={{
width,
height: width
}} />;
const actions = <Button text={intl.string(t.aRIFWD)} icon={<WindowLaunchIcon size="sm" color={Module712.colors.WHITE} />} iconPosition="end" size="lg" onPress={function onPress() {
ActionSheetActionCreators.hideActionSheet();
Linking.openURL(HelpdeskUtils.getArticleURL(HelpdeskArticles.IN_GAME_FEATURES));
}} />;
return <PromoSheet title={intl.string(IncentivizedAccountLinking_messages.ublzTG)} description={intl.string(IncentivizedAccountLinking_messages.JgM2xu)} actions={actions} illustration={illustration} onDismiss={function onDismiss() {
ActionSheetActionCreators.hideActionSheet();
}} />;
};
@@ -0,0 +1,32 @@
// Metro module 10955 (f10956).
import AuthorizedAppsStore, { FetchState } from "../../oauth2/AuthorizedAppsStore";
import { getAuthorizationApp } from "../hooks/useAuthorizationApp";
import AuthorizedAppsActionCreators from "../../oauth2/AuthorizedAppsActionCreators";
export function getShouldShowAppAuthPrompt(a0) {
let r29;
if (a0 == null) {
return false;
}
const authorizationApp = getAuthorizationApp(a0);
if (authorizationApp == null) {
return false;
}
if (authorizationApp?.connectionEntrypointUrl != null) {
let r17 = authorizationApp?.parentId;
if (r17 == null) {
r17 = authorizationApp?.id;
}
let r20 = r17 != null;
if (r20) {
if (AuthorizedAppsStore.getFetchStateForApplication(r17) === FetchState.NOT_FETCHED) {
AuthorizedAppsActionCreators.fetch([r17]);
r29 = false;
} else {
r29 = !(AuthorizedAppsStore.getFetchStateForApplication(r17) === FetchState.FETCHED && AuthorizedAppsStore.getNewestTokenForApplication(r17) != null);
}
r20 = r29;
}
return r20;
}
return false;
}
@@ -0,0 +1,51 @@
// Metro module 10956 (f10957).
import { AnalyticEvents } from "../../../Constants";
import { getAuthorizationApp } from "../hooks/useAuthorizationApp";
import Linking from "../../../lib/native/Linking";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
export async function startAuthorizationNoHook(c26876_0, c26876_1) {
let c26876_5 = 0;
let c30312_0, c30312_1;
L16: {
L15: {
try {
c30312_0 = c26876_1;
c30312_1 = void 0;
if (c26876_0 == null) {
break L16;
}
const authorizationApp = getAuthorizationApp(c26876_0);
c30312_1 = authorizationApp;
if (authorizationApp?.connectionEntrypointUrl != null) {
c26876_5 = 1;
await Linking.openURL(authorizationApp.connectionEntrypointUrl);
AnalyticsUtils.track(AnalyticEvents.ON_PLATFORM_ACCOUNT_LINK_FLOW_STARTED, {
location_stack: c30312_0,
application_id: c30312_1.id,
flow_type: "web"
});
c26876_5 = 0;
break L15;
}
break L16;
} catch ($e) {
let r8 = $e;
if (c26876_5 !== 0) {
while (true) {
try {
c26876_5 = 0;
break L15;
} catch ($e) {
r8 = $e;
if (c26876_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
@@ -0,0 +1,53 @@
// Metro module 15227 (f15228).
import { useRef, useCallback, useEffect } from "react";
import AppStateStore from "../../../stores/native/AppStateStore";
import { AppStates } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useIsInAppBrowserOpen } from "../../links/native/BrowserManager";
import { usePreviousWhen } from "../../../hooks/usePrevious";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl } from "../../../intl/index.native";
import AccountLinking_messages from "../AccountLinking.messages";
export function useDefaultAuthorizationNotifiers(a0, a1) {
let c21783_4, previousWhen;
let c21783_0 = a0;
let r4 = arguments[2];
if (r4 === void 0) {
r4 = {};
}
let showToastOnSuccess = r4.showToastOnSuccess;
if (showToastOnSuccess === void 0) {
showToastOnSuccess = true;
}
let c21783_2 = showToastOnSuccess;
c21783_4 = void 0;
previousWhen = void 0;
const ref = useRef(false);
let shouldUpdate = useStateFromStores([AppStateStore], () => AppStateStore.getState() === AppStates.ACTIVE);
const isInAppBrowserOpen = useIsInAppBrowserOpen();
const callback = useCallback((a0) => {
ref.current = true;
return c21783_0(a0);
}, [a0]);
if (shouldUpdate) {
shouldUpdate = !isInAppBrowserOpen;
}
c21783_4 = shouldUpdate;
previousWhen = usePreviousWhen({
value: a1,
shouldUpdate
});
useEffect(() => {
if (ref.current && previousWhen === false && a1 === true && c21783_4) {
ref.current = false;
if (!c21783_2) {
return void 0;
}
ToastActionCreators.open({
content: intl.string(AccountLinking_messages.uG6teD),
key: "account-linked-toast"
});
}
}, [a1, previousWhen, showToastOnSuccess, shouldUpdate]);
return callback;
}
@@ -0,0 +1,117 @@
// Metro module 5518 (f5519).
import { useCallback } from "react";
import { AuthorizeFlow } from "../ApplicationAccountLinkingConstants";
import { AnalyticEvents } from "../../../Constants";
import { useAuthorizationApp } from "../hooks/useAuthorizationApp";
import { useAuthorizedAppsToken } from "../hooks/useAuthorizedAppsToken";
import Linking from "../../../lib/native/Linking";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { accountLinkAuthorizationStarted } from "../AccountLinkingActionCreators";
let env3391 = {};
export default function useStartAuthorize(a0, r5 = {}) {
let env14896 = {
$parent: env3391
};
env14896[0] = void 0;
const debug = r5.debug;
const r6 = debug !== void 0 && debug;
const authorizationApp = useAuthorizationApp(a0);
env14896[0] = authorizationApp;
const canStartAuthorization = authorizationApp?.connectionEntrypointUrl != null;
const chosenFlow = canStartAuthorization ? AuthorizeFlow.WEB : null;
let r26 = authorizationApp?.parentId;
if (r26 == null) {
r26 = authorizationApp?.id;
}
const authorizedAppsToken = useAuthorizedAppsToken(r26);
const token = authorizedAppsToken.token;
let fetched = authorizedAppsToken.fetched;
let c14897_0 = async (c29518_0) => {
let c29518_3;
let c29518_4 = 0;
let c31371_0, c31371_1;
L16: {
try {
c31371_0 = c29518_0;
if (env14896[0]?.connectionEntrypointUrl == null) {
break L16;
}
c29518_4 = 1;
await Linking.openURL(env14896[0].connectionEntrypointUrl);
const r62 = c31371_0;
const onConfirm = r62.onConfirm;
if (onConfirm != null) {
onConfirm.call(r62);
}
AnalyticsUtils.track(AnalyticEvents.ON_PLATFORM_ACCOUNT_LINK_FLOW_STARTED, {
location_stack: c31371_0.analyticsLocations,
application_id: env14896[0].id,
flow_type: AuthorizeFlow.WEB
});
accountLinkAuthorizationStarted(env14896[0].id, {
onSuccess: c31371_0.onSuccess,
onError: c31371_0.onError
});
c29518_4 = 0;
} catch ($e) {
const r29 = $e;
let r7 = r29;
c29518_3 = r29;
if (c29518_4 !== 0) {
while (true) {
try {
const r99 = c29518_3;
c29518_4 = 0;
c31371_1 = r99;
const r101 = c31371_0;
const onError = r101.onError;
if (onError != null) {
onError.call(r101, c31371_1);
}
} catch (r96) {
r7 = r96;
c29518_3 = r96;
if (c29518_4 === 0) {
break;
}
continue;
}
return false;
}
}
throw r7;
}
return true;
}
return false;
};
const callback = useCallback(function() {
return c14897_0.apply(this, arguments);
}, [authorizationApp]);
const r38 = {
fetched,
hasAlreadyLinked: null,
canStartAuthorization: null,
startAuthorization: null,
connectionApp: null,
chosenFlow: null,
token: null,
debug: null
};
if (fetched) {
fetched = token != null;
}
r38.hasAlreadyLinked = fetched;
r38.canStartAuthorization = canStartAuthorization;
r38.startAuthorization = callback;
r38.connectionApp = authorizationApp;
r38.chosenFlow = chosenFlow;
r38.token = token;
r38.debug = r6 ? {
isSubscribedToAuthorizeRequest: false,
oauth2Token: token,
hasConnectionEntrypointUrl: authorizationApp?.connectionEntrypointUrl != null,
validFlows: canStartAuthorization ? [AuthorizeFlow.WEB] : []
} : void 0;
return r38;
};
@@ -0,0 +1,70 @@
// Metro module 5533 (f5534).
import { useCallback } from "react";
import { useProviderConnection } from "../hooks/useProviderConnection";
import Linking from "../../../lib/native/Linking";
let env3401 = {};
export function useStartProviderConnection(a0) {
let env14905 = {
$parent: env3401
};
const providerConnection = useProviderConnection(a0);
const { loading, hasConnection, canConnect, startConnection } = providerConnection;
env14905[0] = startConnection;
const account = providerConnection.account;
let c14906_0 = async (c29520_0) => {
let c29520_4 = 0;
let c31372_0;
L15: {
L14: {
try {
c31372_0 = void 0;
c31372_0 = await (0, env14905[0])(c29520_0);
if (!c31372_0.success) {
break L15;
}
if (c31372_0.url != null) {
c29520_4 = 1;
await Linking.openURL(c31372_0.url);
c29520_4 = 0;
break L14;
}
break L15;
} catch ($e) {
let r7 = $e;
if (c29520_4 !== 0) {
while (true) {
try {
c29520_4 = 0;
} catch ($e) {
r7 = $e;
if (c29520_4 === 0) {
break;
}
continue;
}
return {
success: false
};
}
}
throw r7;
}
}
return {
success: true
};
}
return {
success: false
};
};
return {
loading,
hasConnection,
canConnect,
startConnection: useCallback(function() {
return c14906_0.apply(this, arguments);
}, [startConnection]),
account
};
}