mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
fix: extract feature-flag zod schema to separate file
This commit is contained in:
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FEATURE_FLAG_POLL_INTERVAL,
|
FEATURE_FLAG_POLL_INTERVAL,
|
||||||
LOCAL_FEATURE_FLAGS,
|
LOCAL_FEATURE_FLAGS,
|
||||||
@ -12,14 +10,7 @@ import {
|
|||||||
|
|
||||||
import { getAllFlags } from '~/helpers/get-feature-flag';
|
import { getAllFlags } from '~/helpers/get-feature-flag';
|
||||||
|
|
||||||
export const ZFeatureFlagValueSchema = z.union([
|
import { TFeatureFlagValue } from './feature-flag.types';
|
||||||
z.boolean(),
|
|
||||||
z.string(),
|
|
||||||
z.number(),
|
|
||||||
z.undefined(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
export type TFeatureFlagValue = z.infer<typeof ZFeatureFlagValueSchema>;
|
|
||||||
|
|
||||||
export type FeatureFlagContextValue = {
|
export type FeatureFlagContextValue = {
|
||||||
getFlag: (_key: string) => TFeatureFlagValue;
|
getFlag: (_key: string) => TFeatureFlagValue;
|
||||||
|
|||||||
10
apps/web/src/providers/feature-flag.types.ts
Normal file
10
apps/web/src/providers/feature-flag.types.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
export const ZFeatureFlagValueSchema = z.union([
|
||||||
|
z.boolean(),
|
||||||
|
z.string(),
|
||||||
|
z.number(),
|
||||||
|
z.undefined(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
export type TFeatureFlagValue = z.infer<typeof ZFeatureFlagValueSchema>;
|
||||||
Reference in New Issue
Block a user