📈 Améliore le tracking des saisies
parent
39d75e8f84
commit
a77b18fd60
|
@ -26,7 +26,7 @@ export default () => {
|
|||
dispatch(action)
|
||||
return new Promise(resolve => {
|
||||
timers[key] = setTimeout(() => {
|
||||
resolve(dispatch({ type: 'USER_INPUT_UPDATE' }))
|
||||
resolve(dispatch({ ...action, type: 'USER_INPUT_UPDATE' }))
|
||||
}, time)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,12 +8,11 @@ import reducers from './reducers/reducers'
|
|||
import { changeThemeColour } from './actions'
|
||||
import Layout from './containers/Layout'
|
||||
import { SliderPicker } from 'react-color'
|
||||
import { rules, rulesFr } from 'Engine/rules'
|
||||
import lang from './i18n'
|
||||
import { rulesFr } from 'Engine/rules'
|
||||
|
||||
let tracker = {
|
||||
push: () => {},
|
||||
connectToHistory: () => {}
|
||||
connectToHistory: history => history
|
||||
}
|
||||
|
||||
let store = createStore(reducers(tracker, rulesFr))
|
||||
|
@ -30,7 +29,7 @@ class MyComponent extends React.Component {
|
|||
return (
|
||||
<div>
|
||||
<p className="indication">
|
||||
Visualisez sur cette page l'apparence du module pour différentes
|
||||
Visualisez sur cette page l’apparence du module pour différentes
|
||||
couleurs principales.
|
||||
</p>
|
||||
<SliderPicker
|
||||
|
@ -38,8 +37,9 @@ class MyComponent extends React.Component {
|
|||
onChangeComplete={this.changeColour}
|
||||
/>
|
||||
<p className="indication">
|
||||
La couleur sélectionnée, à déclarer comme attribut "data-couleur" du
|
||||
script sur votre page est : <b>{this.props.couleur}</b>
|
||||
La couleur sélectionnée, à déclarer comme attribut
|
||||
"data-couleur" du script sur votre page est :{' '}
|
||||
<b>{this.props.couleur}</b>
|
||||
</p>
|
||||
<Layout />
|
||||
</div>
|
||||
|
|
|
@ -2,9 +2,9 @@ import React from 'react'
|
|||
import { render } from 'react-dom'
|
||||
import { compose, createStore, applyMiddleware } from 'redux'
|
||||
import reducers from './reducers/reducers'
|
||||
import DevTools from '../DevTools'
|
||||
import DevTools from './DevTools'
|
||||
import { Provider } from 'react-redux'
|
||||
import Layout from './Layout'
|
||||
import Layout from './containers/Layout'
|
||||
import { AppContainer } from 'react-hot-loader'
|
||||
import debounceFormChangeActions from './debounceFormChangeActions'
|
||||
import computeThemeColours from './components/themeColours'
|
||||
|
@ -25,7 +25,7 @@ let enhancer = compose(
|
|||
|
||||
let tracker = {
|
||||
push: console.log,
|
||||
connectToHistory: () => {}
|
||||
connectToHistory: (history) => history
|
||||
}
|
||||
|
||||
let initialRules = lang == 'en' ? rules : rulesFr
|
||||
|
@ -35,7 +35,7 @@ let anchor = document.querySelector('#js')
|
|||
let App = ({ store }) => (
|
||||
<Provider store={store}>
|
||||
<div id="dev">
|
||||
<Layout />
|
||||
<Layout tracker={tracker} />
|
||||
<DevTools />
|
||||
</div>
|
||||
</Provider>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { path, head, reject, concat, without, length, map } from 'ramda'
|
||||
import { path, head, concat, without, length, map } from 'ramda'
|
||||
|
||||
import { rules, collectDefaults, rulesFr } from 'Engine/rules'
|
||||
import {
|
||||
|
@ -46,13 +46,12 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
|
|||
situationWithDefaults(state)
|
||||
)
|
||||
|
||||
let userInput = state =>
|
||||
state.activeTargetInput +
|
||||
':' +
|
||||
answerSource(state)(state.activeTargetInput)
|
||||
|
||||
if (action.type === 'USER_INPUT_UPDATE') {
|
||||
tracker.push(['trackEvent', 'input', userInput(state)])
|
||||
tracker.push([
|
||||
'trackEvent',
|
||||
'input',
|
||||
action.meta.field + ':' + action.payload
|
||||
])
|
||||
return {
|
||||
...state,
|
||||
analysis,
|
||||
|
@ -87,17 +86,20 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
|
|||
}
|
||||
|
||||
if (action.type === 'START_CONVERSATION') {
|
||||
tracker.push(['trackEvent', 'refine', userInput(state)])
|
||||
tracker.push([
|
||||
'trackEvent',
|
||||
'refine',
|
||||
state.activeTargetInput +
|
||||
':' +
|
||||
answerSource(state)(state.activeTargetInput)
|
||||
])
|
||||
}
|
||||
|
||||
if (
|
||||
['SET_ACTIVE_TARGET_INPUT', 'START_CONVERSATION'].includes(action.type)
|
||||
) {
|
||||
if (['SET_ACTIVE_TARGET_INPUT', 'START_CONVERSATION'].includes(action.type)) {
|
||||
// Si rien n'a été renseigné (stillBlank) on renvoie state et pas newState
|
||||
// pour éviter que les cases blanches disparaissent, c'est un hack…
|
||||
let stillBlank =
|
||||
state.activeTargetInput &&
|
||||
!answerSource(state)(state.activeTargetInput)
|
||||
state.activeTargetInput && !answerSource(state)(state.activeTargetInput)
|
||||
|
||||
// Il faut recalculer les missingVariablesByTarget à chaque changement d'objectif
|
||||
// car les variables manquantes du salaire de base calculé par inversion dépendent
|
||||
|
@ -126,9 +128,7 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
|
|||
),
|
||||
initialAnalysis = analyseMany(state.parsedRules, state.targetNames)(
|
||||
name =>
|
||||
qualifiedTargets.includes(name)
|
||||
? answerSource(state)(name)
|
||||
: null
|
||||
qualifiedTargets.includes(name) ? answerSource(state)(name) : null
|
||||
),
|
||||
initialMissingVariablesByTarget = collectMissingVariablesByTarget(
|
||||
initialAnalysis.targets
|
||||
|
|
Loading…
Reference in New Issue