82 lines
3.4 KiB
TypeScript
82 lines
3.4 KiB
TypeScript
// Metro module 13764 (f13765).
|
|
import { Image as Image2, View } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
|
|
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { ActionSheetCloseButton } from "../../../design/components/Sheet/native/ActionSheetCloseButton.native";
|
|
import Module13765 from "../../../_bundle/Module13765";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
import { deleteWebAuthnCredential } from "../WebAuthnActionCreators";
|
|
import ToastActionCreators from "../../toast/native/ToastActionCreators";
|
|
import Module9690 from "../../../_bundle/Module9690";
|
|
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
|
|
import Module8346 from "../../../_bundle/Module8346";
|
|
import { WarningIcon } from "../../../design/components/Icon/native/redesign/generated/WarningIcon";
|
|
const useStyles = createStyles({
|
|
content: {
|
|
alignItems: "center"
|
|
},
|
|
subtitle: {
|
|
textAlign: "center",
|
|
marginTop: Module712.space.PX_16
|
|
},
|
|
sheetContent: {
|
|
paddingHorizontal: Module712.space.PX_16,
|
|
paddingBottom: Module712.space.PX_16
|
|
},
|
|
sheetBody: {
|
|
gap: Module712.space.PX_16,
|
|
paddingBottom: Module712.space.PX_16
|
|
}
|
|
});
|
|
export default function WebAuthnDeleteActionSheet(props) {
|
|
const { credential, deleting, setDeleting } = props;
|
|
const handleClose = function handleClose() {
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
};
|
|
const styles = useStyles();
|
|
return <BottomSheet contentStyles={styles.sheetContent} bodyStyles={styles.sheetBody}>
|
|
<BottomSheetTitleHeader title={intl.formatToPlainString(t.mI3CoL, {
|
|
keyName: credential.name
|
|
})} trailing={<ActionSheetCloseButton onPress={handleClose} />} />
|
|
<View style={styles.content}>
|
|
<Image2 source={Module13765} />
|
|
<Text variant="heading-md/normal" style={styles.subtitle}>
|
|
{intl.string(t.IfTbc1)}
|
|
</Text>
|
|
</View>
|
|
<View>
|
|
<Button text={intl.string(t["lqK//z"])} onPress={handleClose} variant="primary" grow />
|
|
</View>
|
|
<View>
|
|
<Button text={intl.string(t.zYOk0f)} onPress={function onPress() {
|
|
setDeleting(true);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
deleteWebAuthnCredential(credential).then(() => {
|
|
ToastActionCreators.open({
|
|
key: "WEBAUTHN_CREDENTIAL_DELETE_SUCCESS_TOAST_KEY",
|
|
content: intl.string(t.ZnkeXs),
|
|
icon: Module9690,
|
|
IconComponent: CircleCheckIcon,
|
|
iconColor: "status-positive"
|
|
});
|
|
}).catch((error) => {
|
|
ToastActionCreators.open({
|
|
key: "WEBAUTHN_CREDENTIAL_DELETE_ERROR_TOAST_KEY",
|
|
content: error.message,
|
|
icon: Module8346,
|
|
IconComponent: WarningIcon,
|
|
iconColor: "icon-feedback-critical"
|
|
});
|
|
}).finally(() => {
|
|
setDeleting(false);
|
|
});
|
|
}} variant="destructive" disabled={deleting} loading={deleting} grow />
|
|
</View>
|
|
</BottomSheet>;
|
|
};
|