diff --git a/browser/ui/webui/brave_tip_ui.cc b/browser/ui/webui/brave_tip_ui.cc index bbd7c6164782..739262abae53 100644 --- a/browser/ui/webui/brave_tip_ui.cc +++ b/browser/ui/webui/brave_tip_ui.cc @@ -62,6 +62,7 @@ class RewardsTipDOMHandler : public WebUIMessageHandler, void OnGetRecurringTips( std::unique_ptr list); void TweetTip(const base::ListValue *args); + void OnlyAnonWallet(const base::ListValue* args); void GetExternalWallet(const base::ListValue* args); void OnExternalWallet( const int32_t result, @@ -145,6 +146,11 @@ void RewardsTipDOMHandler::RegisterMessages() { base::BindRepeating( &RewardsTipDOMHandler::GetExternalWallet, base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "brave_rewards_tip.onlyAnonWallet", + base::BindRepeating( + &RewardsTipDOMHandler::OnlyAnonWallet, + base::Unretained(this))); } void RewardsTipDOMHandler::GetPublisherTipData( @@ -469,3 +475,15 @@ void RewardsTipDOMHandler::OnExternalWallet( web_ui()->CallJavascriptFunctionUnsafe( "brave_rewards_tip.externalWallet", data); } + +void RewardsTipDOMHandler::OnlyAnonWallet(const base::ListValue* args) { + if (!rewards_service_ || !web_ui()->CanCallJavascript()) { + return; + } + + const bool allow = rewards_service_->OnlyAnonWallet(); + + web_ui()->CallJavascriptFunctionUnsafe( + "brave_rewards_tip.onlyAnonWallet", + base::Value(allow)); +} diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index d801ac021ccb..e6026d132c67 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -259,6 +259,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "adsTitle", IDS_BRAVE_REWARDS_LOCAL_ADS_TITLE }, { "bat", IDS_BRAVE_UI_BAT_REWARDS_TEXT }, + { "bap", IDS_BRAVE_UI_BAP_REWARDS_TEXT }, { "batPoints", IDS_BRAVE_UI_BAT_POINTS_TEXT }, { "batPointsMessage", IDS_BRAVE_UI_POINTS_MESSAGE }, { "contributionTitle", IDS_BRAVE_REWARDS_LOCAL_CONTR_TITLE }, @@ -400,6 +401,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "grantFinishTitleUGP", IDS_BRAVE_UI_GRANT_FINISH_TITLE_UGP }, { "grantFinishTokenAds", IDS_BRAVE_UI_GRANT_FINISH_TOKEN_ADS }, { "grantFinishTokenUGP", IDS_BRAVE_UI_GRANT_FINISH_TOKEN_UGP }, + { "grantFinishPointUGP", IDS_BRAVE_UI_GRANT_FINISH_POINT_UGP }, { "grants", IDS_BRAVE_UI_GRANTS }, { "import", IDS_BRAVE_UI_IMPORT }, { "includeInAuto", IDS_BRAVE_UI_INCLUDE_IN_AUTO }, @@ -454,6 +456,9 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "pinnedSitesThree", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_THREE }, { "pinnedSitesFour", IDS_BRAVE_UI_PAYMENT_PINNED_SITES_FOUR }, { "pleaseNote", IDS_BRAVE_UI_PLEASE_NOTE }, + { "point", IDS_BRAVE_UI_POINT }, + { "pointGrantClaimed", IDS_BRAVE_UI_POINT_GRANT_CLAIMED }, + { "points", IDS_BRAVE_UI_POINTS }, { "print", IDS_BRAVE_UI_PRINT }, { "processingRequest", IDS_BRAVE_UI_PROCESSING_REQUEST }, { "processingRequestButton", IDS_BRAVE_UI_PROCESSING_REQUEST_BUTTON }, @@ -517,7 +522,10 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "titleETH", IDS_BRAVE_UI_TITLE_ETH}, { "titleLTC", IDS_BRAVE_UI_TITLE_LTC}, { "tokenGrantClaimed", IDS_BRAVE_UI_TOKEN_GRANT_CLAIMED }, + { "token", IDS_BRAVE_UI_TOKEN }, { "tokens", IDS_BRAVE_UI_TOKENS }, + { "tokenGrants", IDS_BRAVE_UI_TOKEN_GRANTS }, + { "pointGrants", IDS_BRAVE_UI_POINT_GRANTS }, { "total", IDS_BRAVE_UI_TOTAL }, { "transactions", IDS_BRAVE_UI_TRANSACTIONS }, { "turnOnAds", IDS_BRAVE_UI_TURN_ON_ADS }, @@ -556,6 +564,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "welcomeButtonTextTwo", IDS_BRAVE_UI_WELCOME_BUTTON_TEXT_TWO}, { "welcomeDescOne", IDS_BRAVE_UI_WELCOME_DESC_ONE}, { "welcomeDescTwo", IDS_BRAVE_UI_WELCOME_DESC_TWO}, + { "welcomeDescPoints", IDS_BRAVE_UI_WELCOME_DESC_POINTS }, { "welcomeFooterTextOne", IDS_BRAVE_UI_WELCOME_FOOTER_TEXT_ONE}, { "welcomeFooterTextTwo", IDS_BRAVE_UI_WELCOME_FOOTER_TEXT_TWO}, { "welcomeHeaderOne", IDS_BRAVE_UI_WELCOME_HEADER_ONE}, @@ -669,6 +678,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "addFunds", IDS_BRAVE_UI_ADD_FUNDS }, { "autoTipText", IDS_BRAVE_UI_AUTO_TIP_TEXT }, { "bat", IDS_BRAVE_UI_BAT_TEXT }, + { "bap", IDS_BRAVE_UI_BAP_REWARDS_TEXT }, { "donationAmount", IDS_BRAVE_UI_DONATION_AMOUNT }, { "doMonthly", IDS_BRAVE_UI_DO_MONTHLY }, { "firstTipDateText", IDS_BRAVE_UI_FIRST_TIP_TEXT }, @@ -680,6 +690,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "redditTipTitleEmpty", IDS_BRAVE_UI_REDDIT_TIP_TITLE_EMPTY }, { "githubTipTitle", IDS_BRAVE_UI_GITHUB_TIP_TITLE }, { "githubTipTitleEmpty", IDS_BRAVE_UI_GITHUB_TIP_TITLE_EMPTY }, + { "points", IDS_BRAVE_UI_POINTS }, { "rewardsBannerText1", IDS_BRAVE_UI_REWARDS_BANNER_TEXT1 }, { "rewardsBannerText2", IDS_BRAVE_UI_REWARDS_BANNER_TEXT2 }, { "sendDonation", IDS_BRAVE_UI_SEND_DONATION }, diff --git a/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json b/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json index f2fe3fefb73d..557d70db440e 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json +++ b/components/brave_rewards/resources/extension/brave_rewards/_locales/en_US/messages.json @@ -15,9 +15,9 @@ "message": "Get paid for viewing ads and pay it forward to support your favorite content creators.", "description": "Entry text for welcome screen in the panel, existing user" }, - "welcomeDescTwo": { - "message": "You can now earn tokens for watching privacy-respecting ads.", - "description": "Entry text for welcome screen in the panel, new user" + "welcomeDescPoints": { + "message": "You can now earn points for watching privacy-respecting ads.", + "description": "Entry text for welcome screen in the panel, points" }, "welcomeFooterTextOne": { "message": "Check out what’s improved", @@ -144,13 +144,23 @@ "description": "Month" }, "tokenGrant": { - "message": "Token Grants", - "description": "Title for grant notification" + "message": "$currency$ Grants", + "description": "Title for grant notification", + "placeholders": { + "currency": { + "content": "$1", + "example": "Token" + } + } }, "tokenGrantClaimed": { "message": "Token Grants Claimed", "description": "Title for grant section in wallet summary" }, + "pointGrantClaimed": { + "message": "Point Grants Claimed", + "description": "Title for point grant section in wallet summary" + }, "earningsAds": { "message": "Earnings from Ads", "description": "Title for ads section in wallet summary" @@ -196,12 +206,16 @@ "description": "Notification title when we display info about auto contribution" }, "contributeNotificationSuccess": { - "message": "You've contributed $amount$ BAT", + "message": "You've contributed $amount$ $currency$", "description": "We show this string in the notification when contribution is successful", "placeholders": { "amount": { "content": "$1", "example": "10.0" + }, + "currency": { + "content": "$2", + "example": "BAT" } } }, @@ -413,6 +427,10 @@ "message": "BAT", "description": "BAT text for displaying converted tip amount." }, + "bap": { + "message": "BAP", + "description": "BAT Points abbreviation text" + }, "turnOnAds": { "message": "Turn on Ads", "description": "Prompt to turn on Ads via notification" @@ -468,13 +486,23 @@ "description": "Cosmetic text upon captcha success" }, "grantFinishTextUGP": { - "message": "Your token grant is on its way.", - "description": "Cosmetic text indicating grant funds are on the way" + "message": "Your $currency$ grant is on its way.", + "description": "Cosmetic text indicating grant funds are on the way", + "placeholders": { + "currency": { + "content": "$1", + "example": "token" + } + } }, "grantFinishTokenTitleUGP": { "message": "Free Token Grant", "description": "Token title on success screen" }, + "grantFinishPointTitleUGP": { + "message": "Free Point Grant", + "description": "Point title on success screen" + }, "grantFinishTitleAds": { "message": "You've earned an Ads Reward!", "description": "Cosmetic text upon captcha success for ads" @@ -544,5 +572,29 @@ "walletGoToVerifyPage": { "message": "Complete wallet verification", "description": "CTA for completing wallet verification" + }, + "tokens": { + "message": "tokens", + "description": "Standard tokens text" + }, + "point": { + "message": "Point", + "description": "BAT Point text" + }, + "token": { + "message": "Token", + "description": "BAT Token text" + }, + "points": { + "message": "points", + "description": "BAT Points text" + }, + "tokenGrants": { + "message": "Token Grants", + "description": "BAT Tokens Grant Text" + }, + "pointGrants": { + "message": "Point Grants", + "description": "BAT Points Grant Text" } } diff --git a/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts b/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts index effa056966bc..26b2c5171880 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts +++ b/components/brave_rewards/resources/extension/brave_rewards/background/api/locale_api.ts @@ -28,6 +28,7 @@ export const getUIMessages = (): Record => { 'backupWalletNotification', 'backupWalletTitle', 'bat', + 'bap', 'batPoints', 'batPointsMessage', 'braveAdsLaunchTitle', @@ -83,6 +84,9 @@ export const getUIMessages = (): Record => { 'on', 'oneTimeDonation', 'pendingContributionTitle', + 'point', + 'pointGrantClaimed', + 'points', 'privacyPolicy', 'recurringDonations', 'reservedAmountText', @@ -96,6 +100,10 @@ export const getUIMessages = (): Record => { 'tipsProcessedNotification', 'tokenGrant', 'tokenGrantClaimed', + 'token', + 'tokens', + 'tokenGrants', + 'pointGrants', 'unVerifiedCheck', 'turnOnAds', 'unVerifiedPublisher', @@ -107,6 +115,7 @@ export const getUIMessages = (): Record => { 'welcomeButtonTextTwo', 'welcomeDescOne', 'welcomeDescTwo', + 'welcomeDescPoints', 'walletFailedButton', 'walletFailedTitle', 'welcomeBack', diff --git a/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx b/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx index a421fe3159b8..195c638dcd27 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx +++ b/components/brave_rewards/resources/extension/brave_rewards/components/app.tsx @@ -286,6 +286,7 @@ export class RewardsPanel extends React.Component { optInErrorAction={this.onCreate} moreLink={this.openRewards} onTOSClick={this.openTOS} + onlyAnonWallet={this.state.onlyAnonWallet} onPrivacyClick={this.openPrivacyPolicy} /> ) diff --git a/components/brave_rewards/resources/extension/brave_rewards/components/panel.tsx b/components/brave_rewards/resources/extension/brave_rewards/components/panel.tsx index efad1a90c900..23f7bfd2ca89 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/components/panel.tsx +++ b/components/brave_rewards/resources/extension/brave_rewards/components/panel.tsx @@ -303,6 +303,7 @@ export class Panel extends React.Component { getNotification = () => { const { notifications, currentNotification } = this.props.rewardsPanelData + const { onlyAnonWallet } = this.props if ( currentNotification === undefined || @@ -335,8 +336,9 @@ export class Panel extends React.Component { // 16 - error while tipping if (result === '0') { + const currency = onlyAnonWallet ? getMessage('bap') : getMessage('bat') const fixed = utils.convertProbiToFixed(notification.args[3]) - text = getMessage('contributeNotificationSuccess', [fixed]) + text = getMessage('contributeNotificationSuccess', [fixed, currency]) } else if (result === '15') { text = getMessage('contributeNotificationNotEnoughFunds') isAlert = 'warning' @@ -624,6 +626,7 @@ export class Panel extends React.Component { const tipAmounts = defaultContribution !== '0.0' ? this.generateAmounts(publisher) : undefined + const { onlyAnonWallet } = this.props if (notification && notification.notification && @@ -642,7 +645,7 @@ export class Panel extends React.Component { } } - currentGrant = utils.getGrant(currentGrant) + currentGrant = utils.getGrant(currentGrant, this.props.onlyAnonWallet) let walletStatus: WalletState | undefined = undefined let onVerifyClick = undefined @@ -703,6 +706,7 @@ export class Panel extends React.Component { onRefreshPublisher={this.refreshPublisher} refreshingPublisher={this.state.refreshingPublisher} publisherRefreshed={this.state.publisherRefreshed} + onlyAnonWallet={onlyAnonWallet} /> : null } diff --git a/components/brave_rewards/resources/extension/brave_rewards/utils.ts b/components/brave_rewards/resources/extension/brave_rewards/utils.ts index 67866c930a74..b5c87e081459 100644 --- a/components/brave_rewards/resources/extension/brave_rewards/utils.ts +++ b/components/brave_rewards/resources/extension/brave_rewards/utils.ts @@ -49,14 +49,17 @@ export const getGrants = (grants?: RewardsExtension.Grant[]) => { }) } -export const getGrant = (grant?: RewardsExtension.GrantInfo) => { +export const getGrant = (grant?: RewardsExtension.GrantInfo, onlyAnonWallet?: boolean) => { if (!grant) { return grant } + const tokenString = onlyAnonWallet ? getMessage('point') : getMessage('token') grant.finishTitle = getMessage('grantFinishTitleUGP') - grant.finishText = getMessage('grantFinishTextUGP') - grant.finishTokenTitle = getMessage('grantFinishTokenTitleUGP') + grant.finishText = getMessage('grantFinishTextUGP', [tokenString]) + grant.finishTokenTitle = onlyAnonWallet + ? getMessage('grantFinishPointTitleUGP') + : getMessage('grantFinishTokenTitleUGP') if (grant.type === 'ads') { grant.expiryTime = 0 diff --git a/components/brave_rewards/resources/page/components/adsBox.tsx b/components/brave_rewards/resources/page/components/adsBox.tsx index 8587c2d45a1f..f8aa4b04bc26 100644 --- a/components/brave_rewards/resources/page/components/adsBox.tsx +++ b/components/brave_rewards/resources/page/components/adsBox.tsx @@ -263,8 +263,10 @@ class AdsBox extends React.Component { adsHistory, enabledMain, firstLoad, - balance + balance, + ui } = this.props.rewardsData + const { onlyAnonWallet } = ui if (adsData) { adsEnabled = adsData.adsEnabled @@ -283,13 +285,14 @@ class AdsBox extends React.Component { const historyEntries = adsHistory || [] const rows = this.getAdHistoryData(historyEntries, savedOnly) const notEmpty = rows && rows.length !== 0 + const tokenString = onlyAnonWallet ? 'points' : 'tokens' return ( <> { > diff --git a/components/brave_rewards/resources/page/components/contributeBox.tsx b/components/brave_rewards/resources/page/components/contributeBox.tsx index 2c624fa5da8a..7156ddfe4932 100644 --- a/components/brave_rewards/resources/page/components/contributeBox.tsx +++ b/components/brave_rewards/resources/page/components/contributeBox.tsx @@ -149,8 +149,10 @@ class ContributeBox extends React.Component { contributionNonVerified, contributionVideos, contributionMonthly, - enabledMain + enabledMain, + ui } = this.props.rewardsData + const { onlyAnonWallet } = ui if (!enabledMain) { return null @@ -170,6 +172,7 @@ class ContributeBox extends React.Component { }) @@ -228,7 +231,8 @@ class ContributeBox extends React.Component { reconcileStamp, autoContributeList, excludedList, - balance + balance, + ui } = this.props.rewardsData const monthlyList: MonthlyChoice[] = utils.generateContributionMonthly(walletInfo.choices, balance.rates) const contributeRows = this.getContributeRows(autoContributeList) @@ -238,6 +242,7 @@ class ContributeBox extends React.Component { const numExcludedRows = excludedRows && excludedRows.length const allSites = !(excludedRows.length > 0 || numRows > 5) const showDisabled = firstLoad !== false || !enabledMain || !enabledContribute + const { onlyAnonWallet } = ui return ( { monthlyList.map((choice: MonthlyChoice) => { return (
- {getLocale('contributionUpTo')} + {getLocale('contributionUpTo')}
) }) diff --git a/components/brave_rewards/resources/page/components/grant.tsx b/components/brave_rewards/resources/page/components/grant.tsx index 7011bc8c4a65..87e85e417015 100644 --- a/components/brave_rewards/resources/page/components/grant.tsx +++ b/components/brave_rewards/resources/page/components/grant.tsx @@ -137,10 +137,14 @@ class Grant extends React.Component { } grantFinish = (type: string, tokens: string, date: string) => { - let title = getLocale('grantFinishTitleUGP') - let text = getLocale('grantFinishTextUGP') - let tokenTitle = getLocale('grantFinishTokenUGP') const { onlyAnonWallet } = this.props + const tokenString = onlyAnonWallet ? getLocale('point') : getLocale('token') + + let title = getLocale('grantFinishTitleUGP') + let text = getLocale('grantFinishTextUGP', { currency: tokenString }) + let tokenTitle = onlyAnonWallet + ? getLocale('grantFinishPointUGP') + : getLocale('grantFinishTokenUGP') if (type === 'ads') { title = getLocale('grantFinishTitleAds') diff --git a/components/brave_rewards/resources/page/components/pageWallet.tsx b/components/brave_rewards/resources/page/components/pageWallet.tsx index dfc3bbde06c0..25d1dce6a0af 100644 --- a/components/brave_rewards/resources/page/components/pageWallet.tsx +++ b/components/brave_rewards/resources/page/components/pageWallet.tsx @@ -542,6 +542,7 @@ class PageWallet extends React.Component { { this.state.modalPendingContribution ? { const allSites = !(numRows > 5) const total = this.getTotal() const converted = utils.convertBalance(total, balance.rates) + const { onlyAnonWallet } = ui return ( { : null } - + { recurringList && recurringList.length > 0 @@ -268,6 +269,7 @@ class TipBox extends React.Component { allItems={allSites} numItems={numRows} headerColor={true} + onlyAnonWallet={onlyAnonWallet} onShowAll={this.onModalToggle} > {getLocale('donationVisitSome')} diff --git a/components/brave_rewards/resources/tip/actions/tip_actions.ts b/components/brave_rewards/resources/tip/actions/tip_actions.ts index 2d2c067f79b7..7e18fcdb4411 100644 --- a/components/brave_rewards/resources/tip/actions/tip_actions.ts +++ b/components/brave_rewards/resources/tip/actions/tip_actions.ts @@ -63,3 +63,9 @@ export const getExternalWallet = () => action(types.GET_EXTERNAL_WALLET) export const onExternalWallet = (wallet: RewardsTip.ExternalWallet) => action(types.ON_EXTERNAL_WALLET, { wallet }) + +export const onlyAnonWallet = () => action(types.ONLY_ANON_WALLET) + +export const onOnlyAnonWallet = (only: boolean) => action(types.ON_ONLY_ANON_WALLET, { + only +}) diff --git a/components/brave_rewards/resources/tip/brave_rewards_tip.tsx b/components/brave_rewards/resources/tip/brave_rewards_tip.tsx index 792144ae63f9..a9efcfde11e2 100644 --- a/components/brave_rewards/resources/tip/brave_rewards_tip.tsx +++ b/components/brave_rewards/resources/tip/brave_rewards_tip.tsx @@ -90,6 +90,10 @@ window.cr.define('brave_rewards_tip', function () { getActions().onExternalWallet(wallet) } + function onlyAnonWallet (only: boolean) { + getActions().onOnlyAnonWallet(only) + } + return { initialize, publisherBanner, @@ -99,7 +103,8 @@ window.cr.define('brave_rewards_tip', function () { recurringTipRemoved, recurringTipSaved, balance, - externalWallet + externalWallet, + onlyAnonWallet } }) diff --git a/components/brave_rewards/resources/tip/components/app.tsx b/components/brave_rewards/resources/tip/components/app.tsx index 16f2a9cf5048..9f3f6042181c 100644 --- a/components/brave_rewards/resources/tip/components/app.tsx +++ b/components/brave_rewards/resources/tip/components/app.tsx @@ -28,6 +28,10 @@ export class App extends React.Component { return this.props.actions } + componentDidMount () { + this.actions.onlyAnonWallet() + } + getTipBanner = (url: string, publisher: RewardsTip.Publisher, mediaMetaData: RewardsTip.MediaMetaData | undefined) => { if (!mediaMetaData) { return ( diff --git a/components/brave_rewards/resources/tip/components/siteBanner.tsx b/components/brave_rewards/resources/tip/components/siteBanner.tsx index 9f7d33e4e64e..c4d6b50d778a 100644 --- a/components/brave_rewards/resources/tip/components/siteBanner.tsx +++ b/components/brave_rewards/resources/tip/components/siteBanner.tsx @@ -15,6 +15,7 @@ import * as tipActions from '../actions/tip_actions' import * as utils from '../utils' interface Props extends RewardsTip.ComponentProps { + onlyAnonWallet?: boolean publisher: RewardsTip.Publisher mediaMetaData?: RewardsTip.MediaMetaData } @@ -206,9 +207,8 @@ class Banner extends React.Component { render () { const { balance } = this.props.rewardsDonateData const { total } = balance + const { onlyAnonWallet, publisher, mediaMetaData } = this.props - const mediaMetaData = this.props.mediaMetaData - const publisher = this.props.publisher const checkmark = utils.isPublisherConnectedOrVerified(publisher.status) let logo = publisher.logo @@ -222,6 +222,7 @@ class Banner extends React.Component { } return ( { } render () { - const { finished, error } = this.props.rewardsDonateData + const { finished, error, onlyAnonWallet } = this.props.rewardsDonateData const publisher = this.props.publisher const mediaMetaData = this.props.mediaMetaData @@ -78,7 +78,7 @@ class TipMediaUser extends React.Component { <> { !finished && !error - ? + ? : null } { @@ -87,6 +87,7 @@ class TipMediaUser extends React.Component { publisher={publisher} onTweet={this.onTweet} timeout={3000} + onlyAnonWallet={onlyAnonWallet} /> : null } diff --git a/components/brave_rewards/resources/tip/components/tipSite.tsx b/components/brave_rewards/resources/tip/components/tipSite.tsx index 8dd1d35253a3..6af15580c49e 100644 --- a/components/brave_rewards/resources/tip/components/tipSite.tsx +++ b/components/brave_rewards/resources/tip/components/tipSite.tsx @@ -37,13 +37,13 @@ class TipSite extends React.Component { } render () { - const { finished, error } = this.props.rewardsDonateData + const { finished, error, onlyAnonWallet } = this.props.rewardsDonateData return ( <> { !finished && !error - ? + ? : null } { @@ -52,6 +52,7 @@ class TipSite extends React.Component { publisher={this.props.publisher} onTweet={this.onTweet} timeout={3000} + onlyAnonWallet={onlyAnonWallet} /> : null } diff --git a/components/brave_rewards/resources/tip/components/transientTipOverlay.tsx b/components/brave_rewards/resources/tip/components/transientTipOverlay.tsx index 09a1accb954c..84b248a4d5f0 100644 --- a/components/brave_rewards/resources/tip/components/transientTipOverlay.tsx +++ b/components/brave_rewards/resources/tip/components/transientTipOverlay.tsx @@ -16,6 +16,7 @@ import { isPublisherConnectedOrVerified } from '../utils' interface Props extends RewardsTip.ComponentProps { publisher: RewardsTip.Publisher timeout?: number + onlyAnonWallet?: boolean onTweet?: () => void } @@ -45,7 +46,7 @@ class TransientTipOverlay extends React.Component { reconcileStamp } = this.props.rewardsDonateData - const publisher = this.props.publisher + const { onlyAnonWallet, publisher } = this.props const publisherKey = publisher && publisher.publisherKey if (!publisherKey) { @@ -83,6 +84,7 @@ class TransientTipOverlay extends React.Component { amount={currentTipAmount} monthlyDate={monthlyDate} logo={logo} + onlyAnonWallet={onlyAnonWallet} /> ) } diff --git a/components/brave_rewards/resources/tip/constants/tip_types.ts b/components/brave_rewards/resources/tip/constants/tip_types.ts index e6ab130bf8d5..1328f9d8465f 100644 --- a/components/brave_rewards/resources/tip/constants/tip_types.ts +++ b/components/brave_rewards/resources/tip/constants/tip_types.ts @@ -18,5 +18,7 @@ export const enum types { GET_BALANCE = '@@rewards/GET_BALANCE', ON_BALANCE = '@@rewards/ON_BALANCE', GET_EXTERNAL_WALLET = '@@rewards/GET_EXTERNAL_WALLET', - ON_EXTERNAL_WALLET = '@@rewards/ON_EXTERNAL_WALLET' + ON_EXTERNAL_WALLET = '@@rewards/ON_EXTERNAL_WALLET', + ONLY_ANON_WALLET = '@@rewards/ONLY_ANON_WALLET', + ON_ONLY_ANON_WALLET = '@@rewards/ON_ONLY_ANON_WALLET' } diff --git a/components/brave_rewards/resources/tip/reducers/tip_reducer.ts b/components/brave_rewards/resources/tip/reducers/tip_reducer.ts index 797c1bda39c2..784554dae8f1 100644 --- a/components/brave_rewards/resources/tip/reducers/tip_reducer.ts +++ b/components/brave_rewards/resources/tip/reducers/tip_reducer.ts @@ -120,6 +120,14 @@ const publishersReducer: Reducer = (state: RewardsTip.State = state.externalWallet = payload.wallet break } + case types.ONLY_ANON_WALLET: { + chrome.send('brave_rewards_tip.onlyAnonWallet') + break + } + case types.ON_ONLY_ANON_WALLET: { + state.onlyAnonWallet = !!action.payload.only + break + } } return state diff --git a/components/brave_rewards/resources/ui/components/amount/index.tsx b/components/brave_rewards/resources/ui/components/amount/index.tsx index 9ae924f7e37d..c36346bb836d 100644 --- a/components/brave_rewards/resources/ui/components/amount/index.tsx +++ b/components/brave_rewards/resources/ui/components/amount/index.tsx @@ -15,7 +15,8 @@ export interface Props { selected?: boolean type?: 'big' | 'small' currency?: string - isMobile?: boolean + isMobile?: boolean, + onlyAnonWallet?: boolean } export default class Amount extends React.PureComponent { @@ -29,13 +30,23 @@ export default class Amount extends React.PureComponent { return isMobile ? '' : getLocale('about') } + getBatString = () => { + const { onlyAnonWallet, type } = this.props + + if (type !== 'big') { + return null + } + + return getLocale(onlyAnonWallet ? 'bap' : 'bat') + } + render () { const { id, onSelect, amount, selected, type, converted, currency, isMobile } = this.props return ( - {amount} {type === 'big' ? 'BAT' : null} + {amount} {this.getBatString()} {this.getAboutText(isMobile)} {converted} {currency} diff --git a/components/brave_rewards/resources/ui/components/donate/index.tsx b/components/brave_rewards/resources/ui/components/donate/index.tsx index c0e556102efb..cf05aadacc7d 100644 --- a/components/brave_rewards/resources/ui/components/donate/index.tsx +++ b/components/brave_rewards/resources/ui/components/donate/index.tsx @@ -41,6 +41,7 @@ export interface Props { children?: React.ReactNode isMobile?: boolean addFundsLink?: string + onlyAnonWallet?: boolean } interface State { @@ -103,9 +104,11 @@ export default class Donate extends React.PureComponent { currentAmount, donateType, isMobile, - addFundsLink + addFundsLink, + onlyAnonWallet } = this.props const disabled = parseInt(currentAmount, 10) === 0 + const tokenString = onlyAnonWallet ? 'points' : 'tokens' return ( @@ -122,6 +125,7 @@ export default class Donate extends React.PureComponent { onSelect={this.onAmountChange} converted={donation.converted} type={donateType} + onlyAnonWallet={onlyAnonWallet} /> }) @@ -146,7 +150,7 @@ export default class Donate extends React.PureComponent { - {getLocale('notEnoughTokens')} {getLocale('addFunds')}. + {getLocale('notEnoughTokens', { currency: getLocale(tokenString) })} {getLocale('addFunds')}. : null diff --git a/components/brave_rewards/resources/ui/components/donationOverlay/index.tsx b/components/brave_rewards/resources/ui/components/donationOverlay/index.tsx index ba4529573377..5840dffd948d 100644 --- a/components/brave_rewards/resources/ui/components/donationOverlay/index.tsx +++ b/components/brave_rewards/resources/ui/components/donationOverlay/index.tsx @@ -48,6 +48,7 @@ export interface Props { logo?: string amount?: string monthlyDate?: string + onlyAnonWallet?: boolean onTweet?: () => void onClose: () => void } @@ -80,7 +81,8 @@ export default class DonationOverlay extends React.PureComponent { logoBgColor, amount, monthlyDate, - onTweet + onTweet, + onlyAnonWallet } = this.props return ( @@ -139,7 +141,7 @@ export default class DonationOverlay extends React.PureComponent { } - {domain}
{amount} {getLocale('bat')} + {domain}
{amount} {getLocale(onlyAnonWallet ? 'bap' : 'bat')} { monthlyDate ? `, ${getLocale('monthlyText')}` diff --git a/components/brave_rewards/resources/ui/components/grantComplete/index.tsx b/components/brave_rewards/resources/ui/components/grantComplete/index.tsx index 41fc822ac015..711868a03e1d 100644 --- a/components/brave_rewards/resources/ui/components/grantComplete/index.tsx +++ b/components/brave_rewards/resources/ui/components/grantComplete/index.tsx @@ -29,6 +29,7 @@ export default class GrantComplete extends React.PureComponent { render () { const { id, testId, onClose, amount, date, isMobile, tokenTitle, onlyAnonWallet } = this.props const batFormatString = onlyAnonWallet ? getLocale('batPoints') : getLocale('bat') + const tokensString = onlyAnonWallet ? getLocale('points') : ('tokens') return ( @@ -47,7 +48,7 @@ export default class GrantComplete extends React.PureComponent { { !isMobile && date && date.length > 0 ? - {getLocale('grantDisclaimer')} + {getLocale('grantDisclaimer', { currency: tokensString })} : null } diff --git a/components/brave_rewards/resources/ui/components/modalPending/index.tsx b/components/brave_rewards/resources/ui/components/modalPending/index.tsx index 320ebea5d892..62a8137b5ff0 100644 --- a/components/brave_rewards/resources/ui/components/modalPending/index.tsx +++ b/components/brave_rewards/resources/ui/components/modalPending/index.tsx @@ -17,11 +17,12 @@ export interface Props { onClose: () => void onRemoveAll?: () => void id?: string + onlyAnonWallet?: boolean } export default class ModalPending extends React.PureComponent { render () { - const { id, onClose, rows, onRemoveAll } = this.props + const { id, onClose, rows, onRemoveAll, onlyAnonWallet } = this.props return ( @@ -39,6 +40,7 @@ export default class ModalPending extends React.PureComponent { diff --git a/components/brave_rewards/resources/ui/components/panelWelcome/index.tsx b/components/brave_rewards/resources/ui/components/panelWelcome/index.tsx index bd9903710a89..5ad660b9a320 100644 --- a/components/brave_rewards/resources/ui/components/panelWelcome/index.tsx +++ b/components/brave_rewards/resources/ui/components/panelWelcome/index.tsx @@ -30,6 +30,7 @@ export interface Props { variant?: Variant creating?: boolean error?: boolean + onlyAnonWallet?: boolean moreLink?: () => void optInAction: () => void optInErrorAction: () => void @@ -64,7 +65,8 @@ export default class PanelWelcome extends React.PureComponent { optInErrorAction, moreLink, onTOSClick, - onPrivacyClick + onPrivacyClick, + onlyAnonWallet } = this.props let props = {} @@ -75,6 +77,10 @@ export default class PanelWelcome extends React.PureComponent { } } + const descriptionLocale = onlyAnonWallet && this.locale.desc === 'welcomeDescTwo' + ? getLocale('welcomeDescPoints') + : getLocale(this.locale.desc) + return ( @@ -89,7 +95,7 @@ export default class PanelWelcome extends React.PureComponent { TM - {getLocale(this.locale.desc)} + {descriptionLocale} { this.props.creating && !this.props.error diff --git a/components/brave_rewards/resources/ui/components/siteBanner/index.tsx b/components/brave_rewards/resources/ui/components/siteBanner/index.tsx index 855e8ad1676b..57b648b03692 100644 --- a/components/brave_rewards/resources/ui/components/siteBanner/index.tsx +++ b/components/brave_rewards/resources/ui/components/siteBanner/index.tsx @@ -79,6 +79,7 @@ export interface Props { learnMoreNotice?: string addFundsLink?: string isVerified?: boolean + onlyAnonWallet?: boolean } interface State { @@ -255,10 +256,12 @@ export default class SiteBanner extends React.PureComponent { showUnVerifiedNotice, learnMoreNotice, addFundsLink, - isVerified + isVerified, + onlyAnonWallet } = this.props const isTwitterTip: boolean = !!(screenName && screenName !== '') + const batFormatString = onlyAnonWallet ? 'bap' : 'bat' return ( { - {getLocale('walletBalance')} {balance} BAT + {getLocale('walletBalance')} {balance} {getLocale(batFormatString)} { donateType={'big'} currentAmount={currentAmount} addFundsLink={addFundsLink} + onlyAnonWallet={onlyAnonWallet} > { !recurringDonation diff --git a/components/brave_rewards/resources/ui/components/tableDonation/index.tsx b/components/brave_rewards/resources/ui/components/tableDonation/index.tsx index e6938227499f..e493f74268dc 100644 --- a/components/brave_rewards/resources/ui/components/tableDonation/index.tsx +++ b/components/brave_rewards/resources/ui/components/tableDonation/index.tsx @@ -47,6 +47,7 @@ export interface Props { allItems?: boolean onShowAll?: () => void headerColor?: boolean + onlyAnonWallet?: boolean } export default class TableDonation extends React.PureComponent { @@ -89,6 +90,8 @@ export default class TableDonation extends React.PureComponent { return } + const { onlyAnonWallet } = this.props + return rows.map((row: DetailRow): Row => { return { content: [ @@ -108,6 +111,7 @@ export default class TableDonation extends React.PureComponent { { content: ( { } get headers (): Cell[] { + const { headerColor, onlyAnonWallet } = this.props + let customStyle = {} - if (this.props.headerColor) { + if (headerColor) { customStyle = { border: 'none', 'border-bottom': `1px solid #696FDC`, @@ -146,7 +152,7 @@ export default class TableDonation extends React.PureComponent { customStyle }, { - content: getLocale('tokens'), + content: getLocale(onlyAnonWallet ? 'points' : 'tokens'), customStyle: Object.assign({ 'text-align': 'right', 'padding-right': '7px' diff --git a/components/brave_rewards/resources/ui/components/tablePending/index.tsx b/components/brave_rewards/resources/ui/components/tablePending/index.tsx index f1bd66d27c20..dcac27624e07 100644 --- a/components/brave_rewards/resources/ui/components/tablePending/index.tsx +++ b/components/brave_rewards/resources/ui/components/tablePending/index.tsx @@ -39,10 +39,13 @@ export interface Props { id?: string children?: React.ReactNode rows?: DetailRow[] + onlyAnonWallet?: boolean } export default class TableDonation extends React.PureComponent { getRows (rows?: DetailRow[]): Row[] | undefined { + const { onlyAnonWallet } = this.props + if (!rows) { return } @@ -75,6 +78,7 @@ export default class TableDonation extends React.PureComponent { { content: ( { render () { const { id, converted, value, hideText, isNegative, size, color, currency, onlyAnonWallet } = this.props - const batFormatString = onlyAnonWallet ? getLocale('batPoints') : getLocale('bat') + const batFormatString = onlyAnonWallet ? getLocale('bap') : getLocale('bat') return ( diff --git a/components/brave_rewards/resources/ui/components/walletPanel/index.tsx b/components/brave_rewards/resources/ui/components/walletPanel/index.tsx index b9f08f0bfd49..aaf5f87bfcb7 100644 --- a/components/brave_rewards/resources/ui/components/walletPanel/index.tsx +++ b/components/brave_rewards/resources/ui/components/walletPanel/index.tsx @@ -63,6 +63,7 @@ export interface Props { showUnVerified?: boolean moreLink?: string acEnabled?: boolean + onlyAnonWallet?: boolean } export default class WalletPanel extends React.PureComponent { @@ -89,8 +90,9 @@ export default class WalletPanel extends React.PureComponent { } donationDropDown () { - const { donationAmounts } = this.props + const { donationAmounts, onlyAnonWallet } = this.props const monthlyAmount = this.props.monthlyAmount || '5.0' + const batFormatString = onlyAnonWallet ? 'bap' : 'bat' if (!donationAmounts) { return null @@ -108,7 +110,7 @@ export default class WalletPanel extends React.PureComponent { key={`k-${token.tokens}`} value={token.tokens} > - {token.tokens} {getLocale('bat')} ({token.converted} USD) + {token.tokens} {getLocale(batFormatString)} ({token.converted} USD) ) }).concat( @@ -117,7 +119,7 @@ export default class WalletPanel extends React.PureComponent { value={'show'} disabled={true} > - {monthlyAmount} {getLocale('bat')} + {monthlyAmount} {getLocale(batFormatString)} )} diff --git a/components/brave_rewards/resources/ui/components/walletSummary/index.tsx b/components/brave_rewards/resources/ui/components/walletSummary/index.tsx index b39a809d7881..0d976ecc526d 100644 --- a/components/brave_rewards/resources/ui/components/walletSummary/index.tsx +++ b/components/brave_rewards/resources/ui/components/walletSummary/index.tsx @@ -91,6 +91,9 @@ export default class WalletSummary extends React.PureComponent { let current = 0 list.forEach((item, index) => { + const translatedLabel = item.translation === 'tokenGrantClaimed' && onlyAnonWallet + ? getLocale('pointGrantClaimed') + : getLocale(item.translation) const data = (this.props.report as Record)[item.key] if (data) { current++ @@ -102,7 +105,7 @@ export default class WalletSummary extends React.PureComponent { value={data.tokens} converted={data.converted} color={item.color as Type} - title={getLocale(item.translation)} + title={translatedLabel} isNegative={item.negative} onlyAnonWallet={onlyAnonWallet} border={all === current ? 'last' : undefined} diff --git a/components/brave_rewards/resources/ui/components/walletWrapper/index.tsx b/components/brave_rewards/resources/ui/components/walletWrapper/index.tsx index 4737f1463c17..b30e34e8e2e5 100644 --- a/components/brave_rewards/resources/ui/components/walletWrapper/index.tsx +++ b/components/brave_rewards/resources/ui/components/walletWrapper/index.tsx @@ -528,7 +528,9 @@ export default class WalletWrapper extends React.PureComponent { typeText = getLocale('braveContributeTitle') break case 'grant': - typeText = getLocale('tokenGrant') + typeText = this.props.onlyAnonWallet + ? getLocale('pointGrants') + : getLocale('tokenGrants') break case 'insufficientFunds': typeText = getLocale('insufficientFunds') diff --git a/components/definitions/rewardsTip.d.ts b/components/definitions/rewardsTip.d.ts index 8ee63fade674..f74b40e81f0e 100644 --- a/components/definitions/rewardsTip.d.ts +++ b/components/definitions/rewardsTip.d.ts @@ -10,6 +10,7 @@ declare namespace RewardsTip { reconcileStamp: number balance: Balance externalWallet?: ExternalWallet + onlyAnonWallet?: boolean } interface ApplicationState { diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index 8e17883fc86e..994600eba1f5 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -207,7 +207,7 @@ Ads - Earn tokens by viewing ads in Brave. Ads presented are based on your interests, as inferred from your browsing behavior. No personal data or browsing history ever leaves your browser. + Earn {{currency}} by viewing ads in Brave. Ads presented are based on your interests, as inferred from your browsing behavior. No personal data or browsing history ever leaves your browser. Auto-Contribute An automatic way to support publishers and content creators. Set a monthly payment and browse normally. The Brave Verified sites you visit will receive your contributions automatically, based on your attention as measured by Brave. Estimated pending rewards @@ -222,6 +222,7 @@ 4 ads per hour 5 ads per hour BAT + BAP BAT Points can be used in Brave Rewards to contribute to your favorite content creators. BAT Points cannot be exchanged for BAT. The device is offline, please try again later. @@ -404,7 +405,7 @@ Total number of sites you excluded from Auto-Contribute: expires on for - Tokens not used by the expiration date will be automatically returned to the Brave User Growth Pool. + {{currency}} not used by the expiration date will be automatically returned to the Brave User Growth Pool. Grant Expiration Date Grants import @@ -430,7 +431,7 @@ Currently no token grant is available. No activities yet… No, thank you - Not enough tokens. Please + Not enough {{currency}}. Please off ok on @@ -518,8 +519,14 @@ Ethereum (ETH) Litecoin (LTC) Token Grants Claimed + Point Grants Claimed + points tokens + Point + Token Total + Token Grants + Point Grants Transactions Turn on Brave Ads This enables both ads and automatic contributions. You can turn them on or off separately at any time. @@ -541,6 +548,7 @@ Join Rewards You can now earn tokens for watching privacy-respecting ads. Get paid for viewing ads and pay it forward to support your favorite content creators. + You can now earn points for watching privacy-respecting ads. Check out what’s improved Learn More We’ve given Brave Payments a big upgrade. @@ -577,8 +585,9 @@ Your Reward is on its way to your Brave Rewards wallet. Your Reward Amount It’s your lucky day! - Your token grant is on its way. + Your {{currency}} grant is on its way. Free Token Grant + Free Point Grant verify Disconnected