Skip to content

Instantly share code, notes, and snippets.

import { SetState, GetState } from 'zustand';
import { StoresUseState } from './stores/types';
import { BasketUseState } from './basket/types';
import { CustomerUseState } from './customer/types';
import { AppUseState } from './app/types';
import { RemoteConfigUseState } from './remoteConfig/types';
export type AllStoreSlices = StoresUseState &
AppUseState &
RemoteConfigUseState &
import create, { GetState, Mutate, SetState, StateCreator, StoreApi } from 'zustand';
import { persist, subscribeWithSelector } from 'zustand/middleware';
import AsyncStorage from '@react-native-async-storage/async-storage';
import zustandFlipper from 'react-native-flipper-zustand';
import { areWeTestingWithJest } from 'utils/jest';
import { createStoresSlice } from './stores/store';
import { AllStoreSlices } from './useStoreTypes';
import { createAppSlice } from './app/store';
import { createCustomerSlice } from './customer/store';
import { createRemoteConfigSlice } from './remoteConfig/store';
import NetInfo from '@react-native-community/netinfo';
import remoteConfig from '@react-native-firebase/remote-config';
import { AppState } from 'react-native';
import { RemoteConfigState } from 'store/remoteConfig/types';
import { useStore } from 'store/useStore';
import { logError } from 'utils/genericError';
const DEFAULT_CONFIG_DURATION = __DEV__ ? 0 : 30 * 60; // 30 mins
const fbConfig = remoteConfig();
import isEqual from 'react-fast-compare';
import { useStore } from 'store/useStore';
import { getCurrentStoreLocale } from 'store/stores/helpers';
import { StoreCode, StoreLocale } from 'store/stores/types';
// import { logError } from 'utils/genericError';
import { RemoteConfigByLocale, RemoteConfigByStore, RemoteConfigState } from './types';
const safeConfig = <T, U extends string>(config: T, scope: U, name: string) => {
const { isRemoteConfigReady, remoteConfig } = useStore.getState();
if (config || !isRemoteConfigReady) return config;
import { StoreSetState } from '../useStoreTypes';
import { RemoteConfigState } from './types';
export const createRemoteConfigSlice = (set: StoreSetState) => ({
isRemoteConfigReady: false,
remoteConfig: {},
setRemoteConfig: (remoteConfig: RemoteConfigState) =>
set(() => ({ isRemoteConfigReady: true, remoteConfig })),
});
import { WeekDay } from 'components/pages/ChatOptions/constants';
import { StoreCode, StoreLocale } from '../stores/types';
export type FirebaseEnabled = {
enabled: boolean;
};
type FirebaseThreshold = { enabled: boolean; threshold: number };
// AR