(state = initialState, action)
| 10 | } |
| 11 | |
| 12 | export default function queueReducer(state = initialState, action) { |
| 13 | const { type, payload } = action |
| 14 | |
| 15 | switch (type) { |
| 16 | case 'queue': |
| 17 | let actionChain |
| 18 | /* prioritize identify in event queue */ |
| 19 | if (payload && payload.type && payload.type === EVENTS.identify) { |
| 20 | actionChain = [action].concat(state.actions) |
| 21 | } else { |
| 22 | actionChain = state.actions.concat(action) |
| 23 | } |
| 24 | return { |
| 25 | ...state, |
| 26 | actions: actionChain |
| 27 | } |
| 28 | case 'dequeue': |
| 29 | return [] |
| 30 | // todo push events to history |
| 31 | default: |
| 32 | return state |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | export const queueAction = (data, timestamp) => { |
| 37 | return { |
nothing calls this directly
no outgoing calls
no test coverage detected