aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/hooks/use-update-ackee-options.tsx
blob: 7c1d98ac9ee6d90c2c66407d4234f19805b50f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { useAckeeTracker } from '@utils/providers/ackee';
import { useEffect } from 'react';

export type AckeeOptions = 'full' | 'partial';

/**
 * Update Ackee settings with the given choice.
 *
 * @param {AckeeOptions} value - Either `full` or `partial`.
 */
const useUpdateAckeeOptions = (value: AckeeOptions) => {
  const { setDetailed } = useAckeeTracker();

  useEffect(() => {
    setDetailed(value === 'full');
  }, [value, setDetailed]);
};

export default useUpdateAckeeOptions;