Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
[PAY-612] Add separate feature flags for enabling Coinbase/Stripe (#2095
Browse files Browse the repository at this point in the history
)

* Add separate feature flag for coinbase pay

* Add feature flag for stripe too, just in case, and change subtitle
  • Loading branch information
rickyrombo authored Oct 6, 2022
1 parent 027d30c commit f84bdce
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
4 changes: 4 additions & 0 deletions packages/common/src/services/remote-config/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export enum FeatureFlags {
NEW_TABLES = 'new_tables',
NEW_ARTIST_DASHBOARD_TABLE = 'new_artist_dashboard_table',
BUY_AUDIO_ENABLED = 'buy_audio_enabled',
BUY_AUDIO_COINBASE_ENABLED = 'buy_audio_coinbase_enabled',
BUY_AUDIO_STRIPE_ENABLED = 'buy_audio_stripe_enabled',
OFFLINE_MODE_ENABLED = 'offline_mode_enabled',
AUTO_SUBSCRIBE_ON_FOLLOW = 'auto_subscribe_on_follow'
}
Expand Down Expand Up @@ -52,6 +54,8 @@ export const flagDefaults: { [key in FeatureFlags]: boolean } = {
[FeatureFlags.NEW_TABLES]: false,
[FeatureFlags.NEW_ARTIST_DASHBOARD_TABLE]: false,
[FeatureFlags.BUY_AUDIO_ENABLED]: false,
[FeatureFlags.BUY_AUDIO_COINBASE_ENABLED]: false,
[FeatureFlags.BUY_AUDIO_STRIPE_ENABLED]: false,
[FeatureFlags.OFFLINE_MODE_ENABLED]: false,
[FeatureFlags.AUTO_SUBSCRIBE_ON_FOLLOW]: false
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
tokenDashboardPageSelectors,
formatWei,
buyAudioActions,
OnRampProvider
OnRampProvider,
FeatureFlags
} from '@audius/common'
import { Button, ButtonType, IconInfo } from '@audius/stems'
import BN from 'bn.js'
Expand All @@ -23,6 +24,7 @@ import { useModalState } from 'common/hooks/useModalState'
import { CollapsibleContent } from 'components/collapsible-content'
import MobileConnectWalletsDrawer from 'components/mobile-connect-wallets-drawer/MobileConnectWalletsDrawer'
import { OnRampButton } from 'components/on-ramp-button/OnRampButton'
import { useFlag } from 'hooks/useRemoteConfig'
import { isMobile } from 'utils/clientUtil'

import TokenHoverTooltip from './TokenHoverTooltip'
Expand All @@ -41,7 +43,9 @@ const messages = {
connectWallets: 'Connect Other Wallets',
totalAudio: 'Total $AUDIO',
buyAudio: 'Buy $AUDIO',
checkoutWithCoinbase: 'Checkout with a credit card or Coinbase Pay',
checkoutWithStripeOrCoinbase: 'Checkout with a credit card or Coinbase Pay',
checkoutWithStripe: 'Checkout with a credit card',
checkoutWithCoinbase: 'Checkout with Coinbase Pay',
showAdvanced: 'Show Advanced',
hideAdvanced: 'Hide Advanced',
advancedOptions: 'Advanced Options'
Expand Down Expand Up @@ -139,6 +143,13 @@ export const WalletManagementTile = () => {
const hasMultipleWallets = useSelector(getHasAssociatedWallets)
const [, setOpen] = useModalState('AudioBreakdown')

const { isEnabled: isCoinbaseEnabled } = useFlag(
FeatureFlags.BUY_AUDIO_COINBASE_ENABLED
)
const { isEnabled: isStripeEnabled } = useFlag(
FeatureFlags.BUY_AUDIO_STRIPE_ENABLED
)

const onClickOpen = useCallback(() => {
setOpen(true)
}, [setOpen])
Expand Down Expand Up @@ -188,21 +199,29 @@ export const WalletManagementTile = () => {
<div className={styles.headerText}>
<div className={styles.title}>{messages.buyAudio}</div>
<div className={styles.subtitle}>
{messages.checkoutWithCoinbase}
{isCoinbaseEnabled && isStripeEnabled
? messages.checkoutWithStripeOrCoinbase
: isCoinbaseEnabled
? messages.checkoutWithCoinbase
: messages.checkoutWithStripe}
</div>
</div>
</div>
<div className={styles.onRampButtons}>
<OnRampButton
provider={OnRampProvider.STRIPE}
className={styles.payWithStripeButton}
onClick={onBuyWithStripeClicked}
/>
<OnRampButton
provider={OnRampProvider.COINBASE}
className={styles.payWithCoinbaseButton}
onClick={onBuyWithCoinbaseClicked}
/>
{isStripeEnabled ? (
<OnRampButton
provider={OnRampProvider.STRIPE}
className={styles.payWithStripeButton}
onClick={onBuyWithStripeClicked}
/>
) : null}
{isCoinbaseEnabled ? (
<OnRampButton
provider={OnRampProvider.COINBASE}
className={styles.payWithCoinbaseButton}
onClick={onBuyWithCoinbaseClicked}
/>
) : null}
</div>
<CollapsibleContent
id='advanced-wallet-actions'
Expand Down

0 comments on commit f84bdce

Please sign in to comment.