[REFACTOR] twenty-shared multi barrel and CJS/ESM build with preconstruct (#11083)

# Introduction

In this PR we've migrated `twenty-shared` from a `vite` app
[libary-mode](https://vite.dev/guide/build#library-mode) to a
[preconstruct](https://preconstruct.tools/) "atomic" application ( in
the future would like to introduce preconstruct to handle of all our
atomic dependencies such as `twenty-emails` `twenty-ui` etc it will be
integrated at the monorepo's root directly, would be to invasive in the
first, starting incremental via `twenty-shared`)

For more information regarding the motivations please refer to nor:
- https://github.com/twentyhq/core-team-issues/issues/587
-
https://github.com/twentyhq/core-team-issues/issues/281#issuecomment-2630949682

close https://github.com/twentyhq/core-team-issues/issues/589
close https://github.com/twentyhq/core-team-issues/issues/590

## How to test
In order to ease the review this PR will ship all the codegen at the
very end, the actual meaning full diff is `+2,411 −114`
In order to migrate existing dependent packages to `twenty-shared` multi
barrel new arch you need to run in local:
```sh
yarn tsx packages/twenty-shared/scripts/migrateFromSingleToMultiBarrelImport.ts && \
npx nx run-many -t lint --fix -p twenty-front twenty-ui twenty-server twenty-emails twenty-shared twenty-zapier
```
Note that `migrateFromSingleToMultiBarrelImport` is idempotent, it's atm
included in the PR but should not be merged. ( such as codegen will be
added before merging this script will be removed )

## Misc
- related opened issue preconstruct
https://github.com/preconstruct/preconstruct/issues/617

## Closed related PR
- https://github.com/twentyhq/twenty/pull/11028
- https://github.com/twentyhq/twenty/pull/10993
- https://github.com/twentyhq/twenty/pull/10960

## Upcoming enhancement: ( in others dedicated PRs )
- 1/ refactor generate barrel to export atomic module instead of `*`
- 2/ generate barrel own package with several files and tests
- 3/ Migration twenty-ui the same way
- 4/ Use `preconstruct` at monorepo global level

## Conclusion
As always any suggestions are welcomed !
This commit is contained in:
Paul Rastoin
2025-03-22 19:16:06 +01:00
committed by GitHub
parent 8a21c19f03
commit 9ad8287dbc
1091 changed files with 3611 additions and 1297 deletions

View File

@ -4,10 +4,10 @@ import { useCallback } from 'react';
import { Key } from 'ts-key-enum';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { isDefined } from 'twenty-shared';
import { Button } from 'twenty-ui';
import { DialogHotkeyScope } from '../types/DialogHotkeyScope';
import { isDefined } from 'twenty-shared/utils';
const StyledDialogOverlay = styled(motion.div)`
align-items: center;

View File

@ -15,8 +15,7 @@ import {
ProgressBar,
useProgressAnimation,
} from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export enum SnackBarVariant {
Default = 'default',

View File

@ -1,6 +1,5 @@
import { useCallback } from 'react';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared';
import { v4 as uuidv4 } from 'uuid';
import { SnackBarManagerScopeInternalContext } from '@/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext';
@ -9,6 +8,7 @@ import {
SnackBarOptions,
} from '@/ui/feedback/snack-bar-manager/states/snackBarInternalScopedState';
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
import { isDefined } from 'twenty-shared/utils';
export const useSnackBar = () => {
const scopeId = useAvailableScopeIdOrThrow(

View File

@ -1,5 +1,4 @@
import { FieldActorValue } from '@/object-record/record-field/types/FieldMetadata';
import { ConnectedAccountProvider } from 'twenty-shared';
import { useMemo } from 'react';
import {
@ -16,6 +15,7 @@ import {
IconSettingsAutomation,
IconWebhook,
} from 'twenty-ui';
import { ConnectedAccountProvider } from 'twenty-shared/types';
type ActorDisplayProps = Partial<FieldActorValue> & {
avatarUrl?: string | null;

View File

@ -3,9 +3,9 @@ import { styled } from '@linaria/react';
import { FieldCurrencyValue } from '@/object-record/record-field/types/FieldMetadata';
import { SETTINGS_FIELD_CURRENCY_CODES } from '@/settings/data-model/constants/SettingsFieldCurrencyCodes';
import { isDefined } from 'twenty-shared';
import { formatAmount } from '~/utils/format/formatAmount';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
import { isDefined } from 'twenty-shared/utils';
type CurrencyDisplayProps = {
currencyValue: FieldCurrencyValue | null | undefined;

View File

@ -1,9 +1,8 @@
import { MouseEvent } from 'react';
import { isDefined } from 'twenty-shared';
import { ContactLink } from 'twenty-ui';
import { EllipsisDisplay } from './EllipsisDisplay';
import { isDefined } from 'twenty-shared/utils';
const validateEmail = (email: string) => {
// const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

View File

@ -4,7 +4,7 @@ import { RoundedLink, THEME_COMMON } from 'twenty-ui';
import { FieldEmailsValue } from '@/object-record/record-field/types/FieldMetadata';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import styled from '@emotion/styled';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
type EmailsDisplayProps = {
value?: FieldEmailsValue;

View File

@ -3,12 +3,12 @@ import { LinkType, RoundedLink, SocialLink } from 'twenty-ui';
import { FieldLinksValue } from '@/object-record/record-field/types/FieldMetadata';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import { checkUrlType } from '~/utils/checkUrlType';
import {
getAbsoluteUrlOrThrow,
getUrlHostnameOrThrow,
isDefined,
} from 'twenty-shared';
import { checkUrlType } from '~/utils/checkUrlType';
} from 'twenty-shared/utils';
type LinksDisplayProps = {
value?: FieldLinksValue;

View File

@ -1,8 +1,7 @@
import { parsePhoneNumber, PhoneNumber } from 'libphonenumber-js';
import { MouseEvent } from 'react';
import { ContactLink } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
interface PhoneDisplayProps {
value: PhoneDisplayValueProps;

View File

@ -7,8 +7,8 @@ import { ExpandableList } from '@/ui/layout/expandable-list/components/Expandabl
import { DEFAULT_PHONE_CALLING_CODE } from '@/object-record/record-field/meta-types/input/components/PhonesFieldInput';
import { parsePhoneNumber } from 'libphonenumber-js';
import { isDefined } from 'twenty-shared';
import { logError } from '~/utils/logError';
import { isDefined } from 'twenty-shared/utils';
type PhonesDisplayProps = {
value?: FieldPhonesValue;

View File

@ -12,8 +12,8 @@ import { activeDropdownFocusIdState } from '@/ui/layout/dropdown/states/activeDr
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { MOBILE_VIEWPORT } from 'twenty-ui';
import { isDefined } from 'twenty-shared/utils';
const StyledAddressContainer = styled.div`
padding: 4px 8px;

View File

@ -10,13 +10,13 @@ import { Key } from 'ts-key-enum';
import { FieldDoubleText } from '@/object-record/record-field/types/FieldDoubleText';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { isDefined } from 'twenty-shared';
import { FieldInputContainer } from '@/ui/field/input/components/FieldInputContainer';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { splitFullName } from '~/utils/format/spiltFullName';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
import { StyledTextInput } from './TextInput';
import { isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
display: flex;

View File

@ -13,9 +13,9 @@ import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/inter
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { isDefined } from 'twenty-shared';
import { MenuItemMultiSelectTag } from 'twenty-ui';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
import { isDefined } from 'twenty-shared/utils';
type MultiSelectInputProps = {
selectableListComponentInstanceId: string;

View File

@ -5,8 +5,8 @@ import { TEXT_INPUT_STYLE } from 'twenty-ui';
import { LightCopyIconButton } from '@/object-record/record-field/components/LightCopyIconButton';
import { useRegisterInputEvents } from '@/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents';
import { isDefined } from 'twenty-shared';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
import { isDefined } from 'twenty-shared/utils';
export type TextAreaInputProps = {
disabled?: boolean;

View File

@ -4,9 +4,9 @@ import { Trans, useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import React from 'react';
import { getImageAbsoluteURI, isDefined } from 'twenty-shared';
import { Button, IconPhotoUp, IconTrash, IconUpload, IconX } from 'twenty-ui';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
display: flex;

View File

@ -9,8 +9,8 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
import { SelectControl } from '@/ui/input/components/SelectControl';
import { isDefined } from 'twenty-shared';
import { SelectHotkeyScope } from '../types/SelectHotkeyScope';
import { isDefined } from 'twenty-shared/utils';
export type SelectOption<Value extends string | number | boolean | null> = {
value: Value;

View File

@ -1,8 +1,8 @@
import { SelectOption, SelectSizeVariant } from '@/ui/input/components/Select';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { isDefined } from 'twenty-shared';
import { IconChevronDown, OverflowingTextWithTooltip } from 'twenty-ui';
import { isDefined } from 'twenty-shared/utils';
const StyledControlContainer = styled.div<{
disabled?: boolean;

View File

@ -8,8 +8,8 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { useEffect, useMemo, useRef, useState } from 'react';
import { Key } from 'ts-key-enum';
import { isDefined } from 'twenty-shared';
import { MenuItemSelectTag, TagColor } from 'twenty-ui';
import { isDefined } from 'twenty-shared/utils';
interface SelectInputProps {
onOptionSelected: (selectedOption: SelectOption) => void;

View File

@ -8,7 +8,7 @@ import {
import { InputHotkeyScope } from '@/ui/input/types/InputHotkeyScope';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export type TextInputProps = TextInputV2ComponentProps & {
disableHotkeys?: boolean;

View File

@ -12,7 +12,7 @@ import { MIN_DATE } from '@/ui/input/components/internal/date/constants/MinDate'
import { parseDateToString } from '@/ui/input/components/internal/date/utils/parseDateToString';
import { parseStringToDate } from '@/ui/input/components/internal/date/utils/parseStringToDate';
import { isNull } from '@sniptt/guards';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
const StyledInputContainer = styled.div`
align-items: center;

View File

@ -8,7 +8,6 @@ import {
} from 'twenty-ui';
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
import { isDefined } from 'twenty-shared';
import { AbsoluteDatePickerHeader } from '@/ui/input/components/internal/date/components/AbsoluteDatePickerHeader';
import { DateTimeInput } from '@/ui/input/components/internal/date/components/DateTimeInput';
@ -22,6 +21,7 @@ import {
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import 'react-datepicker/dist/react-datepicker.css';
import { isDefined } from 'twenty-shared/utils';
export const MONTH_AND_YEAR_DROPDOWN_ID = 'date-picker-month-and-year-dropdown';
export const MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID =

View File

@ -2,9 +2,8 @@ import { useArgs } from '@storybook/preview-api';
import { Meta, StoryObj } from '@storybook/react';
import { expect, userEvent, within } from '@storybook/test';
import { ComponentDecorator } from 'twenty-ui';
import { isDefined } from 'twenty-shared';
import { DateTimePicker } from '../InternalDatePicker';
import { isDefined } from 'twenty-shared/utils';
const meta: Meta<typeof DateTimePicker> = {
title: 'UI/Input/Internal/InternalDatePicker',

View File

@ -5,7 +5,6 @@ import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useEffect, useState } from 'react';
import { isDefined } from 'twenty-shared';
import { IconChevronDown, IconWorld } from 'twenty-ui';
import { CountryPickerHotkeyScope } from '../types/CountryPickerHotkeyScope';
@ -13,6 +12,7 @@ import { CountryPickerHotkeyScope } from '../types/CountryPickerHotkeyScope';
import { PhoneCountryPickerDropdownSelect } from './PhoneCountryPickerDropdownSelect';
import 'react-phone-number-input/style.css';
import { isDefined } from 'twenty-shared/utils';
type StyledDropdownButtonProps = {
isUnfolded: boolean;

View File

@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const useInputFocusWithoutScrollOnMount = () => {
const inputRef = useRef<HTMLInputElement>(null);

View File

@ -18,9 +18,9 @@ import { MouseEvent, ReactNode } from 'react';
import { flushSync } from 'react-dom';
import { Keys } from 'react-hotkeys-hook';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared';
import { sleep } from '~/utils/sleep';
import { useDropdown } from '../hooks/useDropdown';
import { isDefined } from 'twenty-shared/utils';
const StyledDropdownFallbackAnchor = styled.div`
left: 0;

View File

@ -9,7 +9,7 @@ import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
import { useCallback } from 'react';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const useDropdown = (dropdownId?: string) => {
const {

View File

@ -5,7 +5,7 @@ import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDrop
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const useDropdownV2 = () => {
const {

View File

@ -8,7 +8,7 @@ import {
import { ExpandedListDropdown } from '@/ui/layout/expandable-list/components/ExpandedListDropdown';
import { isFirstOverflowingChildElement } from '@/ui/layout/expandable-list/utils/isFirstOverflowingChildElement';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
align-items: center;

View File

@ -4,8 +4,8 @@ import { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/test';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import { isDefined } from 'twenty-shared';
import { ComponentDecorator, MAIN_COLOR_NAMES, Tag } from 'twenty-ui';
import { isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
padding: ${({ theme }) => theme.spacing(1)};

View File

@ -1,5 +1,4 @@
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const isFirstOverflowingChildElement = ({
containerElement,
childElement,

View File

@ -6,9 +6,9 @@ import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus';
import { AppPath } from '@/types/AppPath';
import { isDefaultLayoutAuthModalVisibleState } from '@/ui/layout/states/isDefaultLayoutAuthModalVisibleState';
import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';
import { isDefined } from 'twenty-shared';
import { OnboardingStatus, SubscriptionStatus } from '~/generated/graphql';
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
import { isDefined } from 'twenty-shared/utils';
export const useShowAuthModal = () => {
const { isMatchingLocation } = useIsMatchingLocation();

View File

@ -3,8 +3,8 @@ import { ReactNode, useEffect } from 'react';
import { useSelectableListHotKeys } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys';
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
import { SelectableListScope } from '@/ui/layout/selectable-list/scopes/SelectableListScope';
import { isDefined } from 'twenty-shared';
import { arrayToChunks } from '~/utils/array/arrayToChunks';
import { isDefined } from 'twenty-shared/utils';
type SelectableListProps = {
children: ReactNode;

View File

@ -2,7 +2,7 @@ import { useRecoilCallback, useSetRecoilState } from 'recoil';
import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const useSelectableList = (selectableListId?: string) => {
const {

View File

@ -8,7 +8,7 @@ import styled from '@emotion/styled';
import { lazy, Suspense } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
const ActivityRichTextEditor = lazy(() =>
import('@/activities/components/ActivityRichTextEditor').then((module) => ({

View File

@ -6,12 +6,11 @@ import { ChangeEvent, ReactNode, useRef } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { AppTooltip, Avatar, AvatarType, IconComponent } from 'twenty-ui';
import { v4 as uuidV4 } from 'uuid';
import { isDefined } from 'twenty-shared';
import {
beautifyExactDateTime,
beautifyPastDateRelativeToNow,
} from '~/utils/date-utils';
import { isDefined } from 'twenty-shared/utils';
type ShowPageSummaryCardProps = {
avatarPlaceholder: string;

View File

@ -2,7 +2,7 @@ import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFi
import { TableMetadata } from '@/ui/layout/table/types/TableMetadata';
import { useMemo } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export const useSortedArray = <T>(
arrayToSort: T[],

View File

@ -7,7 +7,7 @@ import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNaviga
import { navigationDrawerExpandedMemorizedState } from '@/ui/navigation/states/navigationDrawerExpandedMemorizedState';
import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
import { WorkspaceActivationStatus } from 'twenty-shared';
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
type NavigationDrawerBackButtonProps = {
title: string;

View File

@ -4,9 +4,9 @@ import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useLis
import styled from '@emotion/styled';
import { FocusEvent, useRef } from 'react';
import { Key } from 'ts-key-enum';
import { isDefined } from 'twenty-shared';
import { IconComponent, TablerIconsProps } from 'twenty-ui';
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
import { isDefined } from 'twenty-shared/utils';
type NavigationDrawerInputProps = {
className?: string;

View File

@ -11,7 +11,6 @@ import styled from '@emotion/styled';
import { ReactNode } from 'react';
import { Link } from 'react-router-dom';
import { useRecoilState } from 'recoil';
import { capitalize, isDefined } from 'twenty-shared';
import {
IconComponent,
Label,
@ -19,6 +18,7 @@ import {
Pill,
TablerIconsProps,
} from 'twenty-ui';
import { capitalize, isDefined } from 'twenty-shared/utils';
const DEFAULT_INDENTATION_LEVEL = 1;

View File

@ -7,8 +7,8 @@ import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import styled from '@emotion/styled';
import React from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { Label } from 'twenty-ui';
import { isDefined } from 'twenty-shared/utils';
const StyledTitle = styled.div`
align-items: center;

View File

@ -3,9 +3,8 @@ import { HotkeyCallback, Keys, Options } from 'react-hotkeys-hook/dist/types';
import { useRecoilState } from 'recoil';
import { pendingHotkeyState } from '../states/internal/pendingHotkeysState';
import { isDefined } from 'twenty-shared';
import { useScopedHotkeyCallback } from './useScopedHotkeyCallback';
import { isDefined } from 'twenty-shared/utils';
type UseHotkeysOptionsWithoutBuggyOptions = Omit<Options, 'enabled'>;

View File

@ -2,11 +2,10 @@ import { Options, useHotkeys } from 'react-hotkeys-hook';
import { Keys } from 'react-hotkeys-hook/dist/types';
import { useRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
import { pendingHotkeyState } from '../states/internal/pendingHotkeysState';
import { useScopedHotkeyCallback } from './useScopedHotkeyCallback';
import { isDefined } from 'twenty-shared/utils';
export const useSequenceHotkeys = (
firstKey: Keys,

View File

@ -1,7 +1,6 @@
import { useRecoilCallback } from 'recoil';
import { DEBUG_HOTKEY_SCOPE } from '@/ui/utilities/hotkey/hooks/useScopedHotkeyCallback';
import { isDefined } from 'twenty-shared';
import { logDebug } from '~/utils/logDebug';
import { DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES } from '../constants/DefaultHotkeysScopeCustomScopes';
@ -10,6 +9,7 @@ import { internalHotkeysEnabledScopesState } from '../states/internal/internalHo
import { AppHotkeyScope } from '../types/AppHotkeyScope';
import { CustomHotkeyScopes } from '../types/CustomHotkeyScope';
import { HotkeyScope } from '../types/HotkeyScope';
import { isDefined } from 'twenty-shared/utils';
const isCustomScopesEqual = (
customScopesA: CustomHotkeyScopes | undefined,

View File

@ -2,8 +2,8 @@ import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState
import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';
import { Helmet } from 'react-helmet-async';
import { useRecoilValue } from 'recoil';
import { getImageAbsoluteURI } from 'twenty-shared';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { getImageAbsoluteURI } from 'twenty-shared/utils';
export const PageFavicon = () => {
const workspacePublicData = useRecoilValue(workspacePublicDataState);

View File

@ -7,7 +7,7 @@ import {
ClickOutsideMode,
useListenClickOutside,
} from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
const containerRef = React.createRef<HTMLDivElement>();
const nullRef = React.createRef<HTMLDivElement>();

View File

@ -4,8 +4,8 @@ import { useRecoilCallback } from 'recoil';
import { useClickOustideListenerStates } from '@/ui/utilities/pointer-event/hooks/useClickOustideListenerStates';
import { ClickOutsideListenerCallback } from '@/ui/utilities/pointer-event/types/ClickOutsideListenerCallback';
import { isDefined } from 'twenty-shared';
import { toSpliced } from '~/utils/array/toSpliced';
import { isDefined } from 'twenty-shared/utils';
export const useClickOutsideListener = (componentId: string) => {
const {

View File

@ -9,7 +9,7 @@ import { ComponentInstanceStateContext } from '@/ui/utilities/state/component-st
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
import { SelectorGetter } from '@/ui/utilities/state/types/SelectorGetter';
import { SelectorSetter } from '@/ui/utilities/state/types/SelectorSetter';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export function createComponentFamilySelectorV2<
ValueType,

View File

@ -10,8 +10,7 @@ import {
SerializableParam,
WrappedValue,
} from 'recoil';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
type CreateComponentFamilyStateArgs<
ValueType,

View File

@ -9,7 +9,7 @@ import { ComponentStateKeyV2 } from '@/ui/utilities/state/component-state/types/
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
import { SelectorGetter } from '@/ui/utilities/state/types/SelectorGetter';
import { SelectorSetter } from '@/ui/utilities/state/types/SelectorSetter';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
export function createComponentSelectorV2<ValueType>(options: {
key: string;

View File

@ -3,8 +3,7 @@ import { ComponentStateKeyV2 } from '@/ui/utilities/state/component-state/types/
import { ComponentStateV2 } from '@/ui/utilities/state/component-state/types/ComponentStateV2';
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
import { AtomEffect, atomFamily } from 'recoil';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
type CreateComponentInstanceStateArgs<ValueType> = {
key: string;

View File

@ -4,7 +4,7 @@ import { ScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-interna
import { RecoilComponentState } from '@/ui/utilities/state/component-state/types/RecoilComponentState';
import { RecoilComponentStateKey } from '@/ui/utilities/state/component-state/types/RecoilComponentStateKey';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
type CreateComponentStateV2Type<ValueType> = {
key: string;

View File

@ -1,5 +1,5 @@
import { ComponentInstanceStateContext } from '@/ui/utilities/state/component-state/types/ComponentInstanceStateContext';
import { isDefined } from 'twenty-shared';
import { isDefined } from 'twenty-shared/utils';
class ComponentInstanceContextMap {
constructor() {