Skip to content

Commit

Permalink
feat(chat): show to gold users
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed Jan 29, 2021
1 parent 35cb719 commit 1cf380b
Showing 1 changed file with 10 additions and 14 deletions.
@@ -1,12 +1,11 @@
import { any } from 'ramda'
import { connect } from 'react-redux'
import { RootState } from 'data/rootReducer'
import { SBOrderType, WalletOptionsType } from 'core/types'
import React from 'react'
import styled from 'styled-components'

import { RootState } from 'data/rootReducer'
import { selectors } from 'data'
import { UserDataType } from 'data/types'
import React from 'react'
import styled from 'styled-components'
import { WalletOptionsType } from 'core/types'

const Wrapper = styled.div`
position: absolute;
Expand Down Expand Up @@ -62,14 +61,13 @@ class ZendeskWidget extends React.PureComponent<Props, State> {
}

render () {
const { domains, sbOrders, userData } = this.props
const pendingSbOrder = any(
o => o.state === 'PENDING_CONFIRMATION' || o.state === 'PENDING_DEPOSIT',
sbOrders
)
const { domains, userData } = this.props

if (!userData) return null
const tier = userData.tiers?.current || 0

// only show chat to users with pending sb orders for now
if (userData && pendingSbOrder && !this.state.chatEnabled) {
// only show chat to gold users
if (tier === 2 && !this.state.chatEnabled) {
this.postMsgToWalletHelper('showChat', {
fullName:
userData.firstName && userData.lastName
Expand All @@ -95,7 +93,6 @@ const mapStateToProps = (state: RootState): LinkStatePropsType => ({
domains: selectors.core.walletOptions.getDomains(state).getOrElse({
walletHelper: 'https://wallet-helper.blockchain.com'
} as WalletOptionsType['domains']),
sbOrders: selectors.components.simpleBuy.getSBOrders(state).getOrElse([]),
userData: selectors.modules.profile
.getUserData(state)
.getOrElse({} as UserDataType)
Expand All @@ -105,7 +102,6 @@ const connector = connect(mapStateToProps)

type LinkStatePropsType = {
domains: { [key in string]: string }
sbOrders: Array<SBOrderType>
userData: UserDataType | null
}
type State = { chatEnabled: boolean; widgetOpen: boolean }
Expand Down

0 comments on commit 1cf380b

Please sign in to comment.