Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/pages/settings/Wallet/AddDebitCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@ import Form from '../../../components/Form';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';
import usePrevious from '../../../hooks/usePrevious';
import NotFoundPage from '../../ErrorPage/NotFoundPage';
import Permissions from '../../../libs/Permissions';

const propTypes = {
/* Onyx Props */
formData: PropTypes.shape({
setupComplete: PropTypes.bool,
}),

/** List of betas available to current user */
betas: PropTypes.arrayOf(PropTypes.string),
Comment thread
makiour marked this conversation as resolved.
};

const defaultProps = {
formData: {
setupComplete: false,
},
betas: [],
};

function DebitCardPage(props) {
Expand Down Expand Up @@ -94,6 +100,10 @@ function DebitCardPage(props) {
return errors;
};

if (!Permissions.canUseWallet(props.betas)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not A Blocker, but it would have been nice to add a comment explaining why this block is here. Perhaps you can do that in a followup PR?

return <NotFoundPage />;
}

return (
<ScreenWrapper
onEntryTransitionEnd={() => nameOnCardRef.current && nameOnCardRef.current.focus()}
Expand Down Expand Up @@ -194,4 +204,7 @@ export default withOnyx({
formData: {
key: ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM,
},
betas: {
key: ONYXKEYS.BETAS,
},
})(DebitCardPage);