This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { StoreSetState } from '../useStoreTypes'; | |
import { RemoteConfigState } from './types'; | |
export const createRemoteConfigSlice = (set: StoreSetState) => ({ | |
isRemoteConfigReady: false, | |
remoteConfig: {}, | |
setRemoteConfig: (remoteConfig: RemoteConfigState) => | |
set(() => ({ isRemoteConfigReady: true, remoteConfig })), | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |