Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleFlowStateUpdate = (values) => {
const stepNumbers = {
1: 'sign',
2: 'wait-lock-bch',
3: 'verify-script',
4: 'sync-balance',
5: 'lock-eth',
6: 'wait-withdraw-eth',
7: 'withdraw-bch',
8: 'finish',
9: 'end',
}
actions.analytics.swapEvent(stepNumbers[values.step], 'ETH-BCH')
this.setState({
flow: values,
})
// this.overProgress(values, Object.keys(stepNumbers).length)
}
if (!messagingToken) {
resolve(messagingToken)
return
}
console.log('firebase messagingToken: ', messagingToken)
const sendResult = submitUserData(dataBasePath, {
...data,
messagingToken,
})
if (sendResult) {
actions.firebase.setSigned()
actions.analytics.signUpEvent({ action: 'signed', type: 'push' })
}
resolve(sendResult)
})
if (!messagingToken) {
resolve(messagingToken)
return
}
console.log('firebase messagingToken: ', messagingToken)
const sendResult = submitUserData(dataBasePath, {
...data,
messagingToken,
})
if (sendResult) {
reducers.signUp.setSigned()
actions.analytics.signUpEvent({ action: 'signed', type: 'push' })
}
resolve(sendResult)
})
componentDidUpdate() {
const { item: { currency, balance } } = this.props
if (balance > 0) {
actions.analytics.balanceEvent({ action: 'have', currency, balance })
}
}
const ipInfo = await firebase.getIPInfo()
const data = {
...ipInfo,
ethAddress,
btcAddress,
bchAddress,
ltcAddress,
Referrer: refEthAddress,
registrationDomain: window.top.location.host,
userAgentRegistration: navigator.userAgent,
}
if (whatToSubmit === 'isSubmitedPush' || !isSupportedPush) {
await firestore.addUser(data)
}
actions.analytics.signUpEvent({ action: 'request' })
if (!isSupportedPush || isSubmitedPush) {
const result = await firebase.signUpWithEmail({
...data,
email,
})
const resultFirestore = firestore.signUpWithEmail({
email,
})
if (!result) {
this.setState(() => ({
isEmailError: true,
[whatToSubmit]: Boolean(result && resultFirestore),
}))
return
handleWithdraw = () => {
const { currency, address, contractAddress, decimals, balance, token } = this.props
actions.analytics.dataEvent(`balances-withdraw-${currency.toLowerCase()}`)
actions.modals.open(constants.modals.Withdraw, {
currency,
address,
contractAddress,
decimals,
token,
balance,
})
}
new Promise(async resolve => {
const userID = await getUserID()
const date = moment().format('DD-MM-YYYY')
const gaID = actions.analytics.getClientId() || 'None'
if (userID) {
const sendResult = await sendData(userID, dataBasePath, {
date,
gaID,
...data,
})
resolve(sendResult)
}
})
componentDidUpdate(prevProps, prevState) {
const { item: { currency, balance } } = this.props
if (balance > 0) {
actions.analytics.balanceEvent({ action: 'have', currency, balance })
}
}
new Promise(async resolve => {
const sendResult = updateUserData(subscriptionData)
if (sendResult) {
actions.firebase.setSigned()
actions.analytics.signUpEvent({ action: 'signed', type: 'email' })
}
resolve(sendResult)
})
new Promise(async resolve => {
const userID = await getUserID()
const ipInfo = await getIPInfo()
const date = moment().format('DD-MM-YYYY')
const gaID = actions.analytics.getClientId() || 'None'
if (userID) {
const sendResult = await sendData(userID, dataBasePath, {
date,
gaID,
...ipInfo,
...data,
})
resolve(sendResult)
}
})