Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
const isMobile = this.props.isMobile
const ModalComp = isMobile ? MobileModal : Modal
const titleContent = fbt('Edit Profile', 'EditModal.editProfile')
return (
// Using css hide Edit Profile dialog when image cropper is opened
this.props.onClose()}
shouldClose={this.state.shouldClose}
classNameOuter={this.state.imageCropperOpened ? 'd-none' : ''}
lightMode={this.props.lightMode}
>
{
this.setState({
imageCropperOpened: open
})
}}
showDeploySuccessMessage(type) {
let message
if ('profile' === type) {
// Not one of attestation changes
message = fbt('Profile updated', 'profile.profileUpdated')
} else {
message = fbt(
fbt.param('provider', getProviderDisplayName(type)) + ' updated',
'profile.attestationUpdated'
)
}
this.handleShowNotification(message, 'blue')
}
showDeploySuccessMessage(type) {
let message
if ('profile' === type) {
// Not one of attestation changes
message = fbt('Profile updated', 'profile.profileUpdated')
} else {
message = fbt(
fbt.param('provider', getProviderDisplayName(type)) + ' updated',
'profile.attestationUpdated'
)
}
this.handleShowNotification(message, 'blue')
}
)
} else if (this.state.title.length > 100) {
// Limit from origin-validator/src/schemas/listing.json
newState.titleError = fbt(
'Title is too long',
'create.error.Title is too long'
)
}
if (!this.state.description) {
newState.descriptionError = fbt(
'Description is required',
'create.error.Description is required'
)
} else if (this.state.description.length < 10) {
newState.descriptionError = fbt(
'Description is too short',
'create.error.Description is too short'
)
} else if (this.state.description.length > 1024) {
// Limit from origin-validator/src/schemas/listing.json
newState.descriptionError = fbt(
'Description is too long',
'create.error.Description is too long'
)
}
if (!this.state.timeZone) {
newState.timeZoneError = fbt(
'Time Zone is required',
'Time Zone is required'
)
validate() {
const newState = {}
if (!this.state.description) {
newState.descriptionError = fbt(
'Description is required',
'create.error.Description is required'
)
} else if (this.state.description.length < 10) {
newState.descriptionError = fbt(
'Description is too short',
'create.error.Description is too short'
)
} else if (this.state.description.length > 1024) {
// Limit from origin-validator/src/schemas/listing.json
newState.descriptionError = fbt(
'Description is too long',
'create.error.Description is too long'
)
}
if (!this.state.retailer) {
newState.retailerError = fbt(
'Please select a card retailer',
'create.listing.giftcard.select-retailer'
)
const getToastMessage = (action, decimalDivision) => {
const tokensEarned = formatTokens(action.reward.amount, decimalDivision)
return fbt(
`You earned ` + fbt.param('amount', tokensEarned) + ' OGN',
'GrowthPromotions.tokensEarned'
)
}
const getToastMessage = (action, decimalDivision) => {
const tokensEarned = formatTokens(action.reward.amount, decimalDivision)
return fbt(
`You earned ` + fbt.param('amount', tokensEarned) + ' OGN',
'GrowthFollowOrigin.tokensEarned'
)
}
constructor(props) {
super(props)
this.state = {
stage: 'AddEmail',
modal: true,
shouldClose: false,
title: fbt('Create a profile', 'MobileUserActivation.createProfile')
}
this.portal = document.createElement('div')
}
handleTwitterShareClick() {
let text = fbt(
'Join me on Origin and earn Origin cryptocurrency tokens (OGN). Origin is a new marketplace to buy and sell with other users. Earn Origin tokens when you create your profile, invite your friends, and buy and sell on the marketplace.',
'RewardInvite.twitterInvite'
)
text += ' ' + this.getInviteCode()
window.open(
`https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}`
)
}
)
this.initialStage =
props.skipjoincampaign === 'false'
? 'JoinActiveCampaign'
: 'TermsAndEligibilityCheck'
this.countryCode = undefined
this.state = {
open: props.startopen === 'true',
stage: this.initialStage,
notCitizenChecked: false,
notCitizenConfirmed: false,
termsAccepted: false,
enableSignupButton: false,
userAlreadyEnrolled: false,
modalTitle: fbt('Origin Rewards', 'WithEnrolmentModal.OriginRewards')
}
}