91 lines
3.4 KiB
TypeScript
91 lines
3.4 KiB
TypeScript
// Metro module 9014 (f9015).
|
|
import { View } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { CircleXIcon } from "../../../design/components/Icon/native/redesign/generated/CircleXIcon";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import useInitialValue from "../../../hooks/useInitialValue";
|
|
import { FAKE_SCOPES, getScopeNames } from "../scopes";
|
|
import { ApplicationIntegrationType } from "../../../_bundle/Module8028";
|
|
import { OAuth2Scopes } from "../../../_bundle/Module8174";
|
|
let useStyles;
|
|
const Scope = function Scope(props) {
|
|
const { text, error, isFake } = props;
|
|
const styles = useStyles();
|
|
return <View style={styles.scopeContainer} accessible accessibilityLabel={`${isFake ? intl.string(t.OX8EMU) : intl.string(t["0lpCFG"])}: ${text}${error != null ? `. ${error}` : ""}`}>
|
|
<View style={styles.iconWrapper} accessible={false} importantForAccessibility="no-hide-descendants">
|
|
{isFake ? <CircleXIcon style={styles.fakeScopeIcon} color={Module712.colors.TEXT_MUTED} size="refresh_sm" /> : <CircleCheckIcon color={Module712.colors.TEXT_MUTED} size="refresh_sm" />}
|
|
</View>
|
|
<View style={styles.scope}>
|
|
<Text variant="text-md/normal" color={isFake ? "text-muted" : void 0}>{text}</Text>
|
|
{error != null ? <Text variant="text-xs/normal">{error}</Text> : null}
|
|
</View>
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
scopesContainer: {
|
|
flexDirection: "column",
|
|
gap: 16
|
|
},
|
|
scopes: {
|
|
flexDirection: "column",
|
|
gap: 16
|
|
},
|
|
scopeContainer: {
|
|
flexDirection: "row"
|
|
},
|
|
scope: {
|
|
flex: 1,
|
|
flexDirection: "column",
|
|
justifyContent: "center"
|
|
},
|
|
iconWrapper: {
|
|
marginRight: 12,
|
|
width: 20,
|
|
height: 20
|
|
},
|
|
fakeScopeIcon: {
|
|
opacity: 0.6
|
|
}
|
|
});
|
|
export default function AuthorizeScopes(props) {
|
|
const { application, accountScopes, requestedScopes, integrationType, errors, isTrustedName = false } = props;
|
|
const styles = useStyles();
|
|
const initialValue = useInitialValue(() => FAKE_SCOPES[Math.floor(Math.random() * FAKE_SCOPES.length)]);
|
|
if (accountScopes.length === 0) {
|
|
return null;
|
|
}
|
|
const text = initialValue();
|
|
const r20 = isTrustedName ? t.PZpY9c : t["1Hz+Sl"];
|
|
let r10 = integrationType === ApplicationIntegrationType.USER_INSTALL && requestedScopes.includes(OAuth2Scopes.APPLICATIONS_COMMANDS);
|
|
const r57 = [<Text variant="heading-sm/normal" color="text-default">
|
|
{intl.format(r20, {
|
|
application: application.name
|
|
})}
|
|
</Text>, ,];
|
|
const r65 = [accountScopes.map((accountScope) => {
|
|
return getScopeNames(accountScope, accountScopes).map((item, index) => {
|
|
let error = void 0;
|
|
if (index === 0) {
|
|
const r3 = errors == null;
|
|
let r15 = void 0;
|
|
if (!r3) {
|
|
const r16 = errors[accountScope];
|
|
r15 = r16 == null ? void 0 : r16[0];
|
|
}
|
|
error = r15;
|
|
}
|
|
return <Scope key={`${accountScope}-${index}`} text={item} error={error} />;
|
|
});
|
|
}).flat(), , ,];
|
|
if (r10) {
|
|
r10 = <Scope text={intl.string(t.Ls2XRq)} />;
|
|
}
|
|
r65[1] = r10;
|
|
r65[2] = <Scope text={text} isFake />;
|
|
r57[1] = <View style={styles.scopes}>{r65}</View>;
|
|
return <View style={styles.scopesContainer}>{r57}</View>;
|
|
};
|