fix(docker): 🐛 Runtime public environment
This commit is contained in:
@@ -9,7 +9,7 @@ import { useDebouncedCallback } from 'use-debounce'
|
||||
import { linter } from '@codemirror/lint'
|
||||
import { VariablesButton } from './buttons/VariablesButton'
|
||||
import { Variable } from 'models'
|
||||
import { isEmpty } from 'utils'
|
||||
import { env } from 'utils'
|
||||
|
||||
const linterExtension = linter(jsonParseLinter())
|
||||
|
||||
@@ -43,7 +43,7 @@ export const CodeEditor = ({
|
||||
setPlainTextValue(value)
|
||||
onChange && onChange(value)
|
||||
},
|
||||
isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? debounceTimeout : 0
|
||||
env('E2E_TEST') === 'enabled' ? 0 : debounceTimeout
|
||||
)
|
||||
|
||||
useEffect(
|
||||
|
||||
@@ -12,6 +12,7 @@ import { SwitchWithLabel } from 'components/shared/SwitchWithLabel'
|
||||
import { Input, Textarea } from 'components/shared/Textbox'
|
||||
import { CredentialsType, SendEmailOptions } from 'models'
|
||||
import React, { useState } from 'react'
|
||||
import { env } from 'utils'
|
||||
import { SmtpConfigModal } from './SmtpConfigModal'
|
||||
|
||||
type Props = {
|
||||
@@ -96,9 +97,9 @@ export const SendEmailSettings = ({ options, onOptionsChange }: Props) => {
|
||||
currentCredentialsId={options.credentialsId}
|
||||
onCredentialsSelect={handleCredentialsSelect}
|
||||
onCreateNewClick={onOpen}
|
||||
defaultCredentialLabel={process.env.NEXT_PUBLIC_SMTP_FROM?.match(
|
||||
/\<(.*)\>/
|
||||
)?.pop()}
|
||||
defaultCredentialLabel={env('SMTP_FROM')
|
||||
?.match(/\<(.*)\>/)
|
||||
?.pop()}
|
||||
refreshDropdownKey={refreshCredentialsKey}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
@@ -4,14 +4,13 @@ import { Grid, SearchContext } from '@giphy/react-components'
|
||||
import { GiphyLogo } from 'assets/logos'
|
||||
import React, { useContext, useState, useEffect } from 'react'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { env } from 'utils'
|
||||
|
||||
type GiphySearchProps = {
|
||||
onSubmit: (url: string) => void
|
||||
}
|
||||
|
||||
const giphyFetch = new GiphyFetch(
|
||||
process.env.NEXT_PUBLIC_GIPHY_API_KEY as string
|
||||
)
|
||||
const giphyFetch = new GiphyFetch(env('GIPHY_API_KEY') as string)
|
||||
|
||||
export const GiphySearch = ({ onSubmit }: GiphySearchProps) => {
|
||||
const { fetchGifs, searchKey, setSearch } = useContext(SearchContext)
|
||||
|
||||
@@ -16,12 +16,7 @@ import { useTypebot } from 'contexts/TypebotContext'
|
||||
import { BaseEmoji, emojiIndex } from 'emoji-mart'
|
||||
import { emojis } from './emojis'
|
||||
import { Input } from '../Textbox/Input'
|
||||
import { isEmpty } from 'utils'
|
||||
import getConfig from 'next/config'
|
||||
|
||||
const {
|
||||
publicRuntimeConfig: { NEXT_PUBLIC_GIPHY_API_KEY },
|
||||
} = getConfig()
|
||||
import { env, isEmpty } from 'utils'
|
||||
|
||||
type Props = {
|
||||
url?: string
|
||||
@@ -188,10 +183,10 @@ const EmojiContent = ({
|
||||
}
|
||||
|
||||
const GiphyContent = ({ onNewUrl }: ContentProps) => {
|
||||
if (isEmpty(NEXT_PUBLIC_GIPHY_API_KEY))
|
||||
if (isEmpty(env('GIPHY_API_KEY')))
|
||||
return <Text>NEXT_PUBLIC_GIPHY_API_KEY is missing in environment</Text>
|
||||
return (
|
||||
<SearchContextManager apiKey={NEXT_PUBLIC_GIPHY_API_KEY}>
|
||||
<SearchContextManager apiKey={env('GIPHY_API_KEY') as string}>
|
||||
<GiphySearch onSubmit={onNewUrl} />
|
||||
</SearchContextManager>
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { Variable } from 'models'
|
||||
import { useState, useRef, useEffect, ChangeEvent } from 'react'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
import { isEmpty } from 'utils'
|
||||
import { env } from 'utils'
|
||||
import { VariablesButton } from './buttons/VariablesButton'
|
||||
|
||||
type Props = {
|
||||
@@ -38,7 +38,7 @@ export const SearchableDropdown = ({
|
||||
const debounced = useDebouncedCallback(
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
onValueChange ? onValueChange : () => {},
|
||||
isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? debounceTimeout : 0
|
||||
env('E2E_TEST') === 'enabled' ? 0 : debounceTimeout
|
||||
)
|
||||
const [filteredItems, setFilteredItems] = useState([
|
||||
...items
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from '@chakra-ui/react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
import { isEmpty } from 'utils'
|
||||
import { env } from 'utils'
|
||||
|
||||
export const SmartNumberInput = ({
|
||||
value,
|
||||
@@ -23,7 +23,7 @@ export const SmartNumberInput = ({
|
||||
const [currentValue, setCurrentValue] = useState(value?.toString() ?? '')
|
||||
const debounced = useDebouncedCallback(
|
||||
onValueChange,
|
||||
isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? debounceTimeout : 0
|
||||
env('E2E_TEST') === 'enabled' ? 0 : debounceTimeout
|
||||
)
|
||||
|
||||
useEffect(
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
import { Variable } from 'models'
|
||||
import React, { ChangeEvent, useEffect, useRef, useState } from 'react'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
import { isEmpty } from 'utils'
|
||||
import { env } from 'utils'
|
||||
import { VariablesButton } from '../buttons/VariablesButton'
|
||||
|
||||
export type TextBoxProps = {
|
||||
@@ -36,7 +36,7 @@ export const TextBox = ({
|
||||
(value) => {
|
||||
onChange(value)
|
||||
},
|
||||
isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? debounceTimeout : 0
|
||||
env('E2E_TEST') === 'enabled' ? 0 : debounceTimeout
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import cuid from 'cuid'
|
||||
import { Variable } from 'models'
|
||||
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
import { byId, isEmpty, isNotDefined } from 'utils'
|
||||
import { byId, env, isNotDefined } from 'utils'
|
||||
|
||||
type Props = {
|
||||
initialVariableId?: string
|
||||
@@ -47,7 +47,7 @@ export const VariableSearchInput = ({
|
||||
const variable = variables.find((v) => v.name === value)
|
||||
if (variable) onSelectVariable(variable)
|
||||
},
|
||||
isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? debounceTimeout : 0
|
||||
env('E2E_TEST') === 'enabled' ? 0 : debounceTimeout
|
||||
)
|
||||
const [filteredItems, setFilteredItems] = useState<Variable[]>(
|
||||
variables ?? []
|
||||
|
||||
Reference in New Issue
Block a user