Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const storage: ReturnType = yield select(getStorage)
const projects: ReturnType = yield select(getProjects)
const scenes: ReturnType = yield select(getScenes)
const user: ReturnType = yield select(getUser)
const project: Omit = utils.omit(projects[projectId], ['thumbnail'])
const entry = {
version: storage.version,
scene: scenes[project.sceneId],
project,
contest,
user: utils.pick(user, ['id'])
}
const analytics = getAnalytics()
if (contest.ethAddress) {
analytics.identify(contest.ethAddress, { email: contest.email })
} else {
analytics.identify({ email: contest.email })
}
yield call(() => api.submitToContest(JSON.stringify(entry)))
yield put(submitProjectSuccess(projectId, contest))
} catch (error) {
yield put(submitProjectFailure(error.message))
}
}
handleClick = () => {
const { metadata, onClose } = this.props
if (metadata) {
const analytics = getAnalytics()
analytics.track(this.props.metadata.origin, {
campaign: Campaign.DAPPER
})
}
window.open('https://dap.pr/dclinstallp')
onClose()
}
yield call(() => {
const analytics = getAnalytics()
const delighted = (window as any).delighted
const payload = {
recurringPeriod: false,
properties: {
anonymous_id: analytics && analytics.user ? analytics.user().anonymousId() : null
}
}
delighted.survey(email ? { email, ...payload } : payload)
})
}
function handleLocationChange() {
const analytics = getAnalytics()
if (analytics) {
analytics.page()
}
}
handleMobilePageClick = () => {
const analytics = getAnalytics()
analytics.track('MobilePage CTA', {
campaign: Campaign.DAPPER
})
}
const track = (event: string, params: any) => getAnalytics().track(event, params)
function* handleAuthSuccess(action: AuthSuccessAction) {
const userId = action.payload.data.sub
const ethAddress: string | undefined = yield select(getAddress)
const analytics = getAnalytics()
if (!ethAddress) {
analytics.identify(userId)
} else {
analytics.identify(userId, { ethAddress: ethAddress })
}
}
function* handleConnectWalletSuccess(action: ConnectWalletSuccessAction) {
const { wallet } = action.payload
const analytics = getAnalytics()
if (analytics) {
const userId: string = yield select(getSub)
if (userId) {
analytics.identify(userId, { ethAddress: wallet.address })
} else {
analytics.identify({ ethAddress: wallet.address })
}
}
}