Skip to content

Commit

Permalink
Remove demo route (#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed May 15, 2023
1 parent 2aa018b commit fef544c
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 132 deletions.
2 changes: 0 additions & 2 deletions frontend/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ export default {
'event': 'Organisation deleted',
},
'DELETE_USER': { 'category': 'Organisation', 'event': 'User deleted' },
'DEMO_ACCOUNT': { 'category': 'User', 'event': 'User demo login' },
'EDIT_ENVIRONMENT': {
'category': 'Environment',
'event': 'Environment edited',
Expand All @@ -277,7 +276,6 @@ export default {
},
'INVITE': { 'category': 'Invite', 'event': 'Invite sent' },
'LOGIN': { 'category': 'User', 'event': 'User login' },
'LOGIN_DEMO': { 'category': 'User', 'event': 'User demo login' },
'OAUTH': (type: OAuthType) => ({
'category': 'User',
'event': `User oauth ${type}`,
Expand Down
6 changes: 0 additions & 6 deletions frontend/common/providers/AccountProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ const AccountProvider = class extends Component {
login = (details) => {
AppActions.login(details)
}

loginDemo = () => {
AppActions.login(Project.demoAccount)
}

register = (details, isInvite) => {
AppActions.register(details, isInvite)
}
Expand Down Expand Up @@ -110,7 +105,6 @@ const AccountProvider = class extends Component {
editOrganisation: AppActions.editOrganisation,
enableTwoFactor: AppActions.enableTwoFactor,
login: this.login,
loginDemo: this.loginDemo,
register: this.register,
selectOrganisation: AppActions.selectOrganisation,
twoFactorLogin: AppActions.twoFactorLogin,
Expand Down
27 changes: 7 additions & 20 deletions frontend/common/stores/account-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,8 @@ const controller = {
password,
})
.then((res) => {
const isDemo = email === Project.demoAccount.email
store.isDemo = isDemo
if (isDemo) {
AsyncStorage.setItem('isDemo', `${isDemo}`)
API.trackEvent(Constants.events.LOGIN_DEMO)
} else {
API.trackEvent(Constants.events.LOGIN)
}
API.trackEvent(Constants.events.LOGIN)

if (res.ephemeral_token) {
store.ephemeral_token = res.ephemeral_token
store.model = {
Expand Down Expand Up @@ -265,13 +259,9 @@ const controller = {
setToken: (token) => {
store.loading()
store.user = {}
AsyncStorage.getItem('isDemo', (err, res) => {
if (res) {
store.isDemo = true
}
data.setToken(token)
return controller.onLogin()
})

data.setToken(token)
return controller.onLogin()
},

setUser(user) {
Expand Down Expand Up @@ -306,17 +296,14 @@ const controller = {
}

AsyncStorage.setItem('user', JSON.stringify(store.model))
if (!store.isDemo) {
API.alias(user.email)
API.identify(user && user.email, user)
}
API.alias(user.email)
API.identify(user && user.email, user)
store.loaded()
} else if (!user) {
store.ephemeral_token = null
AsyncStorage.clear()
API.setCookie('t', '')
data.setToken(null)
store.isDemo = false
store.model = user
store.organisation = null
store.trigger('logout')
Expand Down
8 changes: 1 addition & 7 deletions frontend/env/project_dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ module.exports = global.Project = {
site: 'flagsmith-test',
},

// trigger maintenance mode
demoAccount: {
email: 'kyle+bullet-train@solidstategroup.com',
password: 'demo_account',
},

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
env: 'staging',

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
flagsmith: 'ENktaJnfLVbLifybz34JmX',

flagsmithClientAPI: 'https://edge.api.flagsmith.com/api/v1/',
Expand Down
6 changes: 0 additions & 6 deletions frontend/env/project_e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ module.exports = global.Project = {
// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
debug: false,

// trigger maintenance mode
demoAccount: {
email: 'kyle+bullet-train@solidstategroup.com',
password: 'demo_account',
},

env: 'dev',

flagsmith: 'ENktaJnfLVbLifybz34JmX',
Expand Down
6 changes: 0 additions & 6 deletions frontend/env/project_local.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ module.exports = global.Project = {

debug: false,

// trigger maintenance mode
demoAccount: {
email: 'kyle+bullet-train@solidstategroup.com',
password: 'demo_account',
},

env: 'dev',

flagsmith: 'ENktaJnfLVbLifybz34JmX',
Expand Down
8 changes: 1 addition & 7 deletions frontend/env/project_prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ module.exports = global.Project = {
site: 'flagsmith',
},

// trigger maintenance mode
cookieDomain: '.flagsmith.com',

demoAccount: {
email: 'kyle+bullet-train@solidstategroup.com',
password: 'demo_account',
},

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
env: 'prod',

excludeAnalytics: 'nightwatch@solidstategroup.com',

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
flagsmith: '4vfqhypYjcPoGGu8ByrBaj',

flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/',
Expand Down
8 changes: 1 addition & 7 deletions frontend/env/project_staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ module.exports = global.Project = {
site: 'flagsmith-test',
},

// trigger maintenance mode
demoAccount: {
email: 'kyle+bullet-train@solidstategroup.com',
password: 'demo_account',
},

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
env: 'staging',

// This is our Bullet Train API key - Bullet Train runs on Bullet Train!
flagsmith: 'ENktaJnfLVbLifybz34JmX',

flagsmithClientAPI: 'https://edge.api.flagsmith.com/api/v1/',
Expand Down
14 changes: 0 additions & 14 deletions frontend/web/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ const App = class extends Component {
this.props.location.pathname === '/saml' ||
this.props.location.pathname.includes('/oauth') ||
this.props.location.pathname === '/login' ||
this.props.location.pathname === '/demo' ||
this.props.location.pathname === '/signup'
) {
if (redirect) {
Expand Down Expand Up @@ -269,16 +268,6 @@ const App = class extends Component {
</div>
) : (
<div>
{AccountStore.isDemo && (
<AlertBar preventClose className='pulse'>
<div>
You are using a demo account. Finding this useful?{' '}
<Link onClick={() => AppActions.setUser(null)} to='/'>
Click here to Sign up
</Link>
</div>
</AlertBar>
)}
<div
className={
pageHasAside
Expand Down Expand Up @@ -518,9 +507,6 @@ const App = class extends Component {
)}
{pageHasAside && (
<Aside
className={`${AccountStore.isDemo ? 'demo' : ''} ${
AccountStore.isDemo ? 'footer' : ''
}`}
projectId={projectId}
environmentId={environmentId}
toggleAside={this.toggleAside}
Expand Down
55 changes: 0 additions & 55 deletions frontend/web/components/pages/DemoPage.js

This file was deleted.

2 changes: 0 additions & 2 deletions frontend/web/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Route, Switch } from 'react-router-dom'
import App from './components/App' // App Wrapper
import BetaFeaturesPage from './components/pages/BetaFeaturesPage'
import HomePage from './components/pages/HomePage'
import DemoPage from './components/pages/DemoPage'
import Maintenance from './components/Maintenance'
import ProjectSelectPage from './components/pages/ProjectSelectPage'
import CreateOrganisationPage from './components/pages/CreateOrganisationPage'
Expand Down Expand Up @@ -38,7 +37,6 @@ export default (
<Route path='/login' exact component={HomePage} />
<Route path='/404' exact component={NotFoundErrorPage} />
<Route path='/signup' exact component={HomePage} />
<Route path='/demo' exact component={DemoPage} />
<Route path='/signup' exact component={HomePage} />
<Route path='/home' exact component={HomePage} />
<Route path='/projects' exact component={ProjectSelectPage} />
Expand Down

0 comments on commit fef544c

Please sign in to comment.