aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/planSelection/index.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-10-15 21:40:14 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-10-15 21:40:14 +0200
commit91a0fb20ef02dfa342cf26df3e047b2bd4370b9f (patch)
treef411b3d7d83a24b015a2a1ed723df2e2a324cc0c /src/features/planSelection/index.js
parentOptimize button width (diff)
downloadferdium-app-91a0fb20ef02dfa342cf26df3e047b2bd4370b9f.tar.gz
ferdium-app-91a0fb20ef02dfa342cf26df3e047b2bd4370b9f.tar.zst
ferdium-app-91a0fb20ef02dfa342cf26df3e047b2bd4370b9f.zip
simplify plan selection
Diffstat (limited to 'src/features/planSelection/index.js')
-rw-r--r--src/features/planSelection/index.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/features/planSelection/index.js b/src/features/planSelection/index.js
new file mode 100644
index 000000000..81189207a
--- /dev/null
+++ b/src/features/planSelection/index.js
@@ -0,0 +1,30 @@
1import { reaction } from 'mobx';
2import PlanSelectionStore from './store';
3
4const debug = require('debug')('Franz:feature:planSelection');
5
6export const GA_CATEGORY_PLAN_SELECTION = 'planSelection';
7
8export const planSelectionStore = new PlanSelectionStore();
9
10export default function initPlanSelection(stores, actions) {
11 stores.planSelection = planSelectionStore;
12 const { features } = stores;
13
14 // Toggle planSelection feature
15 reaction(
16 () => features.features.isPlanSelectionEnabled,
17 (isEnabled) => {
18 if (isEnabled) {
19 debug('Initializing `planSelection` feature');
20 planSelectionStore.start(stores, actions);
21 } else if (planSelectionStore.isFeatureActive) {
22 debug('Disabling `planSelection` feature');
23 planSelectionStore.stop();
24 }
25 },
26 {
27 fireImmediately: true,
28 },
29 );
30}