aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/communityRecipes/index.js
blob: 553b423f3dfee79cb3bbc6842bbd9e13b5e80e8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { reaction } from 'mobx';
import { CommunityRecipesStore } from './store';

const debug = require('debug')('Ferdi:feature:communityRecipes');

export const DEFAULT_SERVICE_LIMIT = 3;

export const communityRecipesStore = new CommunityRecipesStore();

export default function initCommunityRecipes(stores, actions) {
  const { features } = stores;

  communityRecipesStore.start(stores, actions);

  // Toggle communityRecipe premium status
  reaction(
    () => (
      features.features.isCommunityRecipesIncludedInCurrentPlan
    ),
    (isPremiumFeature) => {
      debug('Community recipes is premium feature: ', isPremiumFeature);
      communityRecipesStore.isCommunityRecipesIncludedInCurrentPlan = true;
    },
    {
      fireImmediately: true,
    },
  );
}