mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
* base implementation of client script with envs values * better ENVs setup for pw tests * fix tests
26 lines
680 B
TypeScript
26 lines
680 B
TypeScript
import type { BlockFieldId } from 'types/views/block';
|
|
import { BLOCK_FIELDS_IDS } from 'types/views/block';
|
|
|
|
import { getEnvValue, parseEnvJson } from 'configs/app/utils';
|
|
|
|
const blockHiddenFields = (() => {
|
|
const parsedValue = parseEnvJson<Array<BlockFieldId>>(getEnvValue('NEXT_PUBLIC_VIEWS_BLOCK_HIDDEN_FIELDS')) || [];
|
|
|
|
if (!Array.isArray(parsedValue)) {
|
|
return undefined;
|
|
}
|
|
|
|
const result = BLOCK_FIELDS_IDS.reduce((result, item) => {
|
|
result[item] = parsedValue.includes(item);
|
|
return result;
|
|
}, {} as Record<BlockFieldId, boolean>);
|
|
|
|
return result;
|
|
})();
|
|
|
|
const config = Object.freeze({
|
|
hiddenFields: blockHiddenFields,
|
|
});
|
|
|
|
export default config;
|