[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:
@ -20,7 +20,7 @@ runs:
|
|||||||
id: cache-primary-key-builder
|
id: cache-primary-key-builder
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "CACHE_PRIMARY_KEY_PREFIX=${{ inputs.key }}-${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
|
echo "CACHE_PRIMARY_KEY_PREFIX=v2-${{ inputs.key }}-${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
id: restore-cache
|
id: restore-cache
|
||||||
|
|||||||
@ -25,8 +25,8 @@ runs:
|
|||||||
id: cache-node-modules
|
id: cache-node-modules
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
key: ${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-${{github.sha}}
|
key: v2-${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-${{github.sha}}
|
||||||
restore-keys: ${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-
|
restore-keys: v2-${{ steps.globals.outputs.CACHE_KEY_PREFIX }}-
|
||||||
path: ${{ steps.globals.outputs.PATH_TO_CACHE }}
|
path: ${{ steps.globals.outputs.PATH_TO_CACHE }}
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' && steps.cache-node-modules.outputs.cache-matched-key == '' }}
|
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' && steps.cache-node-modules.outputs.cache-matched-key == '' }}
|
||||||
|
|||||||
26
.yarn/patches/@preconstruct-cli-npm-2.8.11-030abfa6ae.patch
Normal file
26
.yarn/patches/@preconstruct-cli-npm-2.8.11-030abfa6ae.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
diff --git a/cli/dist/preconstruct-cli-cli.cjs.js b/cli/dist/preconstruct-cli-cli.cjs.js
|
||||||
|
index 8fbd4efc8ee4d98bc72d16344ff6f6ab4e5e2736..cf451d99128fd06053426d1a265f4e305380dd7b 100644
|
||||||
|
--- a/cli/dist/preconstruct-cli-cli.cjs.js
|
||||||
|
+++ b/cli/dist/preconstruct-cli-cli.cjs.js
|
||||||
|
@@ -1509,7 +1509,7 @@ let memoizedGetProgram = weakMemoize(typescript => memoize(async configFileName
|
||||||
|
return nonMemoizedGetProgram(typescript, configFileName);
|
||||||
|
}));
|
||||||
|
async function getProgram(dirname, pkgName, ts) {
|
||||||
|
- let configFileName = ts.findConfigFile(dirname, ts.sys.fileExists);
|
||||||
|
+ let configFileName = ts.findConfigFile(dirname, ts.sys.fileExists, 'tsconfig.lib.json');
|
||||||
|
if (!configFileName) {
|
||||||
|
throw new FatalError("an entrypoint source file ends with the .ts or tsx extension but no TypeScript config exists, please create one.", pkgName);
|
||||||
|
}
|
||||||
|
diff --git a/cli/dist/preconstruct-cli-cli.esm.js b/cli/dist/preconstruct-cli-cli.esm.js
|
||||||
|
index 0045392b46c8928753af564f67681886e0f15bed..164a9bfbae85f1a8f41fffc87c6a3c4014cb9d33 100644
|
||||||
|
--- a/cli/dist/preconstruct-cli-cli.esm.js
|
||||||
|
+++ b/cli/dist/preconstruct-cli-cli.esm.js
|
||||||
|
@@ -1460,7 +1460,7 @@ let memoizedGetProgram = weakMemoize(typescript => memoize(async configFileName
|
||||||
|
return nonMemoizedGetProgram(typescript, configFileName);
|
||||||
|
}));
|
||||||
|
async function getProgram(dirname, pkgName, ts) {
|
||||||
|
- let configFileName = ts.findConfigFile(dirname, ts.sys.fileExists);
|
||||||
|
+ let configFileName = ts.findConfigFile(dirname, ts.sys.fileExists, 'tsconfig.lib.json');
|
||||||
|
if (!configFileName) {
|
||||||
|
throw new FatalError("an entrypoint source file ends with the .ts or tsx extension but no TypeScript config exists, please create one.", pkgName);
|
||||||
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// Open options page programmatically in a new tab.
|
// Open options page programmatically in a new tab.
|
||||||
// chrome.runtime.onInstalled.addListener((details) => {
|
// chrome.runtime.onInstalled.addListener((details) => {
|
||||||
// if (details.reason === 'install') {
|
// if (details.reason === 'install') {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
interface CustomDiv extends HTMLDivElement {
|
interface CustomDiv extends HTMLDivElement {
|
||||||
onClickHandler: (newHandler: () => void) => void;
|
onClickHandler: (newHandler: () => void) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { createDefaultButton } from '~/contentScript/createButton';
|
import { createDefaultButton } from '~/contentScript/createButton';
|
||||||
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
||||||
import extractCompanyLinkedinLink from '~/contentScript/utils/extractCompanyLinkedinLink';
|
import extractCompanyLinkedinLink from '~/contentScript/utils/extractCompanyLinkedinLink';
|
||||||
import extractDomain from '~/contentScript/utils/extractDomain';
|
import extractDomain from '~/contentScript/utils/extractDomain';
|
||||||
import { createCompany, fetchCompany } from '~/db/company.db';
|
import { createCompany, fetchCompany } from '~/db/company.db';
|
||||||
import { CompanyInput } from '~/db/types/company.types';
|
import { CompanyInput } from '~/db/types/company.types';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const checkIfCompanyExists = async () => {
|
export const checkIfCompanyExists = async () => {
|
||||||
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { createDefaultButton } from '~/contentScript/createButton';
|
import { createDefaultButton } from '~/contentScript/createButton';
|
||||||
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
|
||||||
import extractFirstAndLastName from '~/contentScript/utils/extractFirstAndLastName';
|
import extractFirstAndLastName from '~/contentScript/utils/extractFirstAndLastName';
|
||||||
import { createPerson, fetchPerson } from '~/db/person.db';
|
import { createPerson, fetchPerson } from '~/db/person.db';
|
||||||
import { PersonInput } from '~/db/types/person.types';
|
import { PersonInput } from '~/db/types/person.types';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const checkIfPersonExists = async () => {
|
export const checkIfPersonExists = async () => {
|
||||||
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
const { tab: activeTab } = await chrome.runtime.sendMessage({
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { insertButtonForCompany } from '~/contentScript/extractCompanyProfile';
|
import { insertButtonForCompany } from '~/contentScript/extractCompanyProfile';
|
||||||
import { insertButtonForPerson } from '~/contentScript/extractPersonProfile';
|
import { insertButtonForPerson } from '~/contentScript/extractPersonProfile';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// Inject buttons into the DOM when SPA is reloaded on the resource url.
|
// Inject buttons into the DOM when SPA is reloaded on the resource url.
|
||||||
// e.g. reload the page when on https://www.linkedin.com/in/mabdullahabaid/
|
// e.g. reload the page when on https://www.linkedin.com/in/mabdullahabaid/
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const btn = document.getElementById('twenty-settings-btn');
|
const btn = document.getElementById('twenty-settings-btn');
|
||||||
if (!isDefined(btn)) {
|
if (!isDefined(btn)) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const changeSidePanelUrl = async (url: string) => {
|
const changeSidePanelUrl = async (url: string) => {
|
||||||
if (isDefined(url)) {
|
if (isDefined(url)) {
|
||||||
chrome.storage.local.set({ navigateSidepanel: 'sidepanel' });
|
chrome.storage.local.set({ navigateSidepanel: 'sidepanel' });
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
// Extract "https://www.linkedin.com/company/twenty/" from any of the following urls, which the user can visit while on the company page.
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
// "https://www.linkedin.com/company/twenty/" "https://www.linkedin.com/company/twenty/about/" "https://www.linkedin.com/company/twenty/people/".
|
// "https://www.linkedin.com/company/twenty/" "https://www.linkedin.com/company/twenty/about/" "https://www.linkedin.com/company/twenty/people/".
|
||||||
const extractCompanyLinkedinLink = (activeTabUrl: string) => {
|
const extractCompanyLinkedinLink = (activeTabUrl: string) => {
|
||||||
// Regular expression to match the company ID
|
// Regular expression to match the company ID
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
ExchangeAuthCodeInput,
|
ExchangeAuthCodeInput,
|
||||||
ExchangeAuthCodeResponse,
|
ExchangeAuthCodeResponse,
|
||||||
@ -6,6 +5,7 @@ import {
|
|||||||
} from '~/db/types/auth.types';
|
} from '~/db/types/auth.types';
|
||||||
import { EXCHANGE_AUTHORIZATION_CODE } from '~/graphql/auth/mutations';
|
import { EXCHANGE_AUTHORIZATION_CODE } from '~/graphql/auth/mutations';
|
||||||
import { callMutation } from '~/utils/requestDb';
|
import { callMutation } from '~/utils/requestDb';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const exchangeAuthorizationCode = async (
|
export const exchangeAuthorizationCode = async (
|
||||||
exchangeAuthCodeInput: ExchangeAuthCodeInput,
|
exchangeAuthCodeInput: ExchangeAuthCodeInput,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
CompanyInput,
|
CompanyInput,
|
||||||
CreateCompanyResponse,
|
CreateCompanyResponse,
|
||||||
@ -9,6 +8,7 @@ import { CREATE_COMPANY } from '~/graphql/company/mutations';
|
|||||||
import { FIND_COMPANY } from '~/graphql/company/queries';
|
import { FIND_COMPANY } from '~/graphql/company/queries';
|
||||||
|
|
||||||
import { callMutation, callQuery } from '../utils/requestDb';
|
import { callMutation, callQuery } from '../utils/requestDb';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const fetchCompany = async (
|
export const fetchCompany = async (
|
||||||
companyfilerInput: CompanyFilterInput,
|
companyfilerInput: CompanyFilterInput,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
CreatePersonResponse,
|
CreatePersonResponse,
|
||||||
FindPersonResponse,
|
FindPersonResponse,
|
||||||
@ -9,6 +8,7 @@ import { CREATE_PERSON } from '~/graphql/person/mutations';
|
|||||||
import { FIND_PERSON } from '~/graphql/person/queries';
|
import { FIND_PERSON } from '~/graphql/person/queries';
|
||||||
|
|
||||||
import { callMutation, callQuery } from '../utils/requestDb';
|
import { callMutation, callQuery } from '../utils/requestDb';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const fetchPerson = async (
|
export const fetchPerson = async (
|
||||||
personFilterData: PersonFilterInput,
|
personFilterData: PersonFilterInput,
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { Tokens } from '~/db/types/auth.types';
|
import { Tokens } from '~/db/types/auth.types';
|
||||||
import { RENEW_TOKEN } from '~/graphql/auth/mutations';
|
import { RENEW_TOKEN } from '~/graphql/auth/mutations';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const renewToken = async (
|
export const renewToken = async (
|
||||||
appToken: string,
|
appToken: string,
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import Settings from '~/options/Settings';
|
import Settings from '~/options/Settings';
|
||||||
import Sidepanel from '~/options/Sidepanel';
|
import Sidepanel from '~/options/Sidepanel';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [currentScreen, setCurrentScreen] = useState('');
|
const [currentScreen, setCurrentScreen] = useState('');
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import { useEffect, useState } from 'react';
|
|||||||
|
|
||||||
import { MainButton } from '@/ui/input/button/MainButton';
|
import { MainButton } from '@/ui/input/button/MainButton';
|
||||||
import { TextInput } from '@/ui/input/components/TextInput';
|
import { TextInput } from '@/ui/input/components/TextInput';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { clearStore } from '~/utils/apolloClient';
|
import { clearStore } from '~/utils/apolloClient';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledWrapper = styled.div`
|
const StyledWrapper = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import styled from '@emotion/styled';
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { MainButton } from '@/ui/input/button/MainButton';
|
import { MainButton } from '@/ui/input/button/MainButton';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledIframe = styled.iframe`
|
const StyledIframe = styled.iframe`
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
export type ToggleSize = 'small' | 'medium';
|
export type ToggleSize = 'small' | 'medium';
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client';
|
import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client';
|
||||||
import { setContext } from '@apollo/client/link/context';
|
import { setContext } from '@apollo/client/link/context';
|
||||||
import { onError } from '@apollo/client/link/error';
|
import { onError } from '@apollo/client/link/error';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
export const clearStore = () => {
|
export const clearStore = () => {
|
||||||
chrome.storage.local.remove([
|
chrome.storage.local.remove([
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import { OperationVariables } from '@apollo/client';
|
import { OperationVariables } from '@apollo/client';
|
||||||
import { DocumentNode } from 'graphql';
|
import { DocumentNode } from 'graphql';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import getApolloClient from '~/utils/apolloClient';
|
import getApolloClient from '~/utils/apolloClient';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const callQuery = async <T>(
|
export const callQuery = async <T>(
|
||||||
query: DocumentNode,
|
query: DocumentNode,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from '@lingui/conf';
|
import { defineConfig } from '@lingui/conf';
|
||||||
import { formatter } from '@lingui/format-po';
|
import { formatter } from '@lingui/format-po';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
sourceLocale: 'en',
|
sourceLocale: 'en',
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { PropsWithChildren } from 'react';
|
|||||||
|
|
||||||
import { BaseHead } from 'src/components/BaseHead';
|
import { BaseHead } from 'src/components/BaseHead';
|
||||||
import { Logo } from 'src/components/Logo';
|
import { Logo } from 'src/components/Logo';
|
||||||
import { APP_LOCALES, SOURCE_LOCALE } from 'twenty-shared';
|
|
||||||
import { messages as afMessages } from '../locales/generated/af-ZA';
|
import { messages as afMessages } from '../locales/generated/af-ZA';
|
||||||
import { messages as arMessages } from '../locales/generated/ar-SA';
|
import { messages as arMessages } from '../locales/generated/ar-SA';
|
||||||
import { messages as caMessages } from '../locales/generated/ca-ES';
|
import { messages as caMessages } from '../locales/generated/ca-ES';
|
||||||
@ -37,6 +36,7 @@ import { messages as ukMessages } from '../locales/generated/uk-UA';
|
|||||||
import { messages as viMessages } from '../locales/generated/vi-VN';
|
import { messages as viMessages } from '../locales/generated/vi-VN';
|
||||||
import { messages as zhHansMessages } from '../locales/generated/zh-CN';
|
import { messages as zhHansMessages } from '../locales/generated/zh-CN';
|
||||||
import { messages as zhHantMessages } from '../locales/generated/zh-TW';
|
import { messages as zhHantMessages } from '../locales/generated/zh-TW';
|
||||||
|
import { APP_LOCALES, SOURCE_LOCALE } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type BaseEmailProps = PropsWithChildren<{
|
type BaseEmailProps = PropsWithChildren<{
|
||||||
width?: number;
|
width?: number;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { BaseEmail } from 'src/components/BaseEmail';
|
|||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type CleanSuspendedWorkspaceEmailProps = {
|
type CleanSuspendedWorkspaceEmailProps = {
|
||||||
daysSinceInactive: number;
|
daysSinceInactive: number;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { CallToAction } from 'src/components/CallToAction';
|
|||||||
import { Link } from 'src/components/Link';
|
import { Link } from 'src/components/Link';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type PasswordResetLinkEmailProps = {
|
type PasswordResetLinkEmailProps = {
|
||||||
duration: string;
|
duration: string;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { BaseEmail } from 'src/components/BaseEmail';
|
|||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type PasswordUpdateNotifyEmailProps = {
|
type PasswordUpdateNotifyEmailProps = {
|
||||||
userName: string;
|
userName: string;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { CallToAction } from 'src/components/CallToAction';
|
|||||||
import { Footer } from 'src/components/Footer';
|
import { Footer } from 'src/components/Footer';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type SendEmailVerificationLinkEmailProps = {
|
type SendEmailVerificationLinkEmailProps = {
|
||||||
link: string;
|
link: string;
|
||||||
|
|||||||
@ -11,7 +11,8 @@ import { MainText } from 'src/components/MainText';
|
|||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { WhatIsTwenty } from 'src/components/WhatIsTwenty';
|
import { WhatIsTwenty } from 'src/components/WhatIsTwenty';
|
||||||
import { capitalize } from 'src/utils/capitalize';
|
import { capitalize } from 'src/utils/capitalize';
|
||||||
import { APP_LOCALES, getImageAbsoluteURI } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
import { getImageAbsoluteURI } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type SendInviteLinkEmailProps = {
|
type SendInviteLinkEmailProps = {
|
||||||
link: string;
|
link: string;
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import { MainText } from 'src/components/MainText';
|
|||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { WhatIsTwenty } from 'src/components/WhatIsTwenty';
|
import { WhatIsTwenty } from 'src/components/WhatIsTwenty';
|
||||||
import { capitalize } from 'src/utils/capitalize';
|
import { capitalize } from 'src/utils/capitalize';
|
||||||
import { APP_LOCALES, getImageAbsoluteURI } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
import { getImageAbsoluteURI } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type SendApprovedAccessDomainValidationProps = {
|
type SendApprovedAccessDomainValidationProps = {
|
||||||
link: string;
|
link: string;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { BaseEmail } from 'src/components/BaseEmail';
|
|||||||
import { CallToAction } from 'src/components/CallToAction';
|
import { CallToAction } from 'src/components/CallToAction';
|
||||||
import { MainText } from 'src/components/MainText';
|
import { MainText } from 'src/components/MainText';
|
||||||
import { Title } from 'src/components/Title';
|
import { Title } from 'src/components/Title';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
type WarnSuspendedWorkspaceEmailProps = {
|
type WarnSuspendedWorkspaceEmailProps = {
|
||||||
daysSinceInactive: number;
|
daysSinceInactive: number;
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { lingui } from '@lingui/vite-plugin';
|
import { lingui } from '@lingui/vite-plugin';
|
||||||
import react from '@vitejs/plugin-react-swc';
|
import react from '@vitejs/plugin-react-swc';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import dts from 'vite-plugin-dts';
|
import dts from 'vite-plugin-dts';
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||||
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
root: __dirname,
|
root: __dirname,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from '@lingui/conf';
|
import { defineConfig } from '@lingui/conf';
|
||||||
import { formatter } from '@lingui/format-po';
|
import { formatter } from '@lingui/format-po';
|
||||||
import { APP_LOCALES } from 'twenty-shared';
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
sourceLocale: 'en',
|
sourceLocale: 'en',
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { matchPath, useLocation } from 'react-router-dom';
|
|||||||
|
|
||||||
import { AppBasePath } from '@/types/AppBasePath';
|
import { AppBasePath } from '@/types/AppBasePath';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useIsMatchingLocation = () => {
|
export const useIsMatchingLocation = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|||||||
@ -7,9 +7,10 @@ import { SettingsPath } from '@/types/SettingsPath';
|
|||||||
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
|
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { WorkspaceActivationStatus, isDefined } from 'twenty-shared';
|
|
||||||
import { OnboardingStatus } from '~/generated/graphql';
|
import { OnboardingStatus } from '~/generated/graphql';
|
||||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||||
|
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const usePageChangeEffectNavigateLocation = () => {
|
export const usePageChangeEffectNavigateLocation = () => {
|
||||||
const { isMatchingLocation } = useIsMatchingLocation();
|
const { isMatchingLocation } = useIsMatchingLocation();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { scrollWrapperInstanceComponentState } from '@/ui/utilities/scroll/state
|
|||||||
import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState';
|
import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState';
|
||||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated We should now use useScrollToPosition instead
|
* @deprecated We should now use useScrollToPosition instead
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { CalendarChannel } from '@/accounts/types/CalendarChannel';
|
import { CalendarChannel } from '@/accounts/types/CalendarChannel';
|
||||||
|
|
||||||
import { ConnectedAccountProvider } from 'twenty-shared';
|
|
||||||
import { MessageChannel } from './MessageChannel';
|
import { MessageChannel } from './MessageChannel';
|
||||||
|
import { ConnectedAccountProvider } from 'twenty-shared/types';
|
||||||
|
|
||||||
export type ConnectedAccount = {
|
export type ConnectedAccount = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ConnectedAccountProvider } from 'twenty-shared';
|
|
||||||
import { MessageChannelVisibility } from '~/generated/graphql';
|
import { MessageChannelVisibility } from '~/generated/graphql';
|
||||||
|
import { ConnectedAccountProvider } from 'twenty-shared/types';
|
||||||
|
|
||||||
export enum MessageChannelContactAutoCreationPolicy {
|
export enum MessageChannelContactAutoCreationPolicy {
|
||||||
SENT_AND_RECEIVED = 'SENT_AND_RECEIVED',
|
SENT_AND_RECEIVED = 'SENT_AND_RECEIVED',
|
||||||
|
|||||||
@ -10,8 +10,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { FeatureFlagKey } from '~/generated/graphql';
|
import { FeatureFlagKey } from '~/generated/graphql';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const RecordActionMenuEntriesSetter = () => {
|
export const RecordActionMenuEntriesSetter = () => {
|
||||||
const localContextStoreCurrentObjectMetadataItemId =
|
const localContextStoreCurrentObjectMetadataItemId =
|
||||||
|
|||||||
@ -18,8 +18,8 @@ import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModa
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { getOsControlSymbol } from 'twenty-ui';
|
import { getOsControlSymbol } from 'twenty-ui';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDeleteMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
export const useDeleteMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
||||||
({ objectMetadataItem }) => {
|
({ objectMetadataItem }) => {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObj
|
|||||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDestroyMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
export const useDestroyMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
||||||
({ objectMetadataItem }) => {
|
({ objectMetadataItem }) => {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
|
||||||
@ -19,6 +18,7 @@ import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/u
|
|||||||
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
|
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
|
||||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useRestoreMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
export const useRestoreMultipleRecordsAction: ActionHookWithObjectMetadataItem =
|
||||||
({ objectMetadataItem }) => {
|
({ objectMetadataItem }) => {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { useFavorites } from '@/favorites/hooks/useFavorites';
|
|||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
import { isNull } from '@sniptt/guards';
|
import { isNull } from '@sniptt/guards';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useAddToFavoritesSingleRecordAction: ActionHookWithObjectMetadataItem =
|
export const useAddToFavoritesSingleRecordAction: ActionHookWithObjectMetadataItem =
|
||||||
({ objectMetadataItem }) => {
|
({ objectMetadataItem }) => {
|
||||||
|
|||||||
@ -11,8 +11,8 @@ import { t } from '@lingui/core/macro';
|
|||||||
import { isNull } from '@sniptt/guards';
|
import { isNull } from '@sniptt/guards';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { getOsControlSymbol } from 'twenty-ui';
|
import { getOsControlSymbol } from 'twenty-ui';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDeleteSingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
export const useDeleteSingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
||||||
objectMetadataItem,
|
objectMetadataItem,
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import { AppPath } from '@/types/AppPath';
|
|||||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDestroySingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
export const useDestroySingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
||||||
objectMetadataItem,
|
objectMetadataItem,
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/reco
|
|||||||
import { BlockNoteEditor } from '@blocknote/core';
|
import { BlockNoteEditor } from '@blocknote/core';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useExportNoteAction: ActionHookWithObjectMetadataItem = ({
|
export const useExportNoteAction: ActionHookWithObjectMetadataItem = ({
|
||||||
objectMetadataItem,
|
objectMetadataItem,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
|||||||
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { useDeleteFavorite } from '@/favorites/hooks/useDeleteFavorite';
|
import { useDeleteFavorite } from '@/favorites/hooks/useDeleteFavorite';
|
||||||
import { useFavorites } from '@/favorites/hooks/useFavorites';
|
import { useFavorites } from '@/favorites/hooks/useFavorites';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useRemoveFromFavoritesSingleRecordAction: ActionHookWithObjectMetadataItem =
|
export const useRemoveFromFavoritesSingleRecordAction: ActionHookWithObjectMetadataItem =
|
||||||
({ objectMetadataItem }) => {
|
({ objectMetadataItem }) => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModa
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useRestoreSingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
export const useRestoreSingleRecordAction: ActionHookWithObjectMetadataItem = ({
|
||||||
objectMetadataItem,
|
objectMetadataItem,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
|||||||
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { useActivateWorkflowVersion } from '@/workflow/hooks/useActivateWorkflowVersion';
|
import { useActivateWorkflowVersion } from '@/workflow/hooks/useActivateWorkflowVersion';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useActivateWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useActivateWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
|||||||
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { useDeactivateWorkflowVersion } from '@/workflow/hooks/useDeactivateWorkflowVersion';
|
import { useDeactivateWorkflowVersion } from '@/workflow/hooks/useDeactivateWorkflowVersion';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDeactivateWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useDeactivateWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
|||||||
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { useDeleteOneWorkflowVersion } from '@/workflow/hooks/useDeleteOneWorkflowVersion';
|
import { useDeleteOneWorkflowVersion } from '@/workflow/hooks/useDeleteOneWorkflowVersion';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useDiscardDraftWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useDiscardDraftWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
|||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { useActiveWorkflowVersion } from '@/workflow/hooks/useActiveWorkflowVersion';
|
import { useActiveWorkflowVersion } from '@/workflow/hooks/useActiveWorkflowVersion';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useSeeActiveVersionWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useSeeActiveVersionWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlur
|
|||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useSeeRunsWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useSeeRunsWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlur
|
|||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useSeeVersionsWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useSeeVersionsWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions
|
|||||||
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
import { ActionHookWithoutObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
|
||||||
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useTestWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useTestWorkflowSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import { AppPath } from '@/types/AppPath';
|
|||||||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useSeeRunsWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useSeeRunsWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import { AppPath } from '@/types/AppPath';
|
|||||||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useSeeVersionsWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useSeeVersionsWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import { useWorkflowVersion } from '@/workflow/hooks/useWorkflowVersion';
|
|||||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||||
import { openOverrideWorkflowDraftConfirmationModalState } from '@/workflow/states/openOverrideWorkflowDraftConfirmationModalState';
|
import { openOverrideWorkflowDraftConfirmationModalState } from '@/workflow/states/openOverrideWorkflowDraftConfirmationModalState';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useUseAsDraftWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
export const useUseAsDraftWorkflowVersionSingleRecordAction: ActionHookWithoutObjectMetadataItem =
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@ -12,8 +12,9 @@ import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
|||||||
import { msg } from '@lingui/core/macro';
|
import { msg } from '@lingui/core/macro';
|
||||||
|
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { capitalize, isDefined } from 'twenty-shared';
|
|
||||||
import { IconSettingsAutomation } from 'twenty-ui';
|
import { IconSettingsAutomation } from 'twenty-ui';
|
||||||
|
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useWorkflowRunRecordActions = ({
|
export const useWorkflowRunRecordActions = ({
|
||||||
objectMetadataItem,
|
objectMetadataItem,
|
||||||
}: {
|
}: {
|
||||||
|
|||||||
@ -6,10 +6,9 @@ import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/use
|
|||||||
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { msg } from '@lingui/core/macro';
|
import { msg } from '@lingui/core/macro';
|
||||||
|
|
||||||
import { capitalize, isDefined } from 'twenty-shared';
|
|
||||||
import { IconSettingsAutomation } from 'twenty-ui';
|
import { IconSettingsAutomation } from 'twenty-ui';
|
||||||
import { FeatureFlagKey } from '~/generated/graphql';
|
import { FeatureFlagKey } from '~/generated/graphql';
|
||||||
|
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useRunWorkflowActions = () => {
|
export const useRunWorkflowActions = () => {
|
||||||
const isWorkflowEnabled = useIsFeatureEnabled(
|
const isWorkflowEnabled = useIsFeatureEnabled(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ActionMenuEntry } from '@/action-menu/types/ActionMenuEntry';
|
import { ActionMenuEntry } from '@/action-menu/types/ActionMenuEntry';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const wrapActionInCallbacks = ({
|
export const wrapActionInCallbacks = ({
|
||||||
action,
|
action,
|
||||||
|
|||||||
@ -10,8 +10,8 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context
|
|||||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const RecordShowRightDrawerActionMenu = () => {
|
export const RecordShowRightDrawerActionMenu = () => {
|
||||||
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { actionMenuEntriesComponentState } from '@/action-menu/states/actionMenu
|
|||||||
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
|
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
|
||||||
import { ActionMenuEntry } from '@/action-menu/types/ActionMenuEntry';
|
import { ActionMenuEntry } from '@/action-menu/types/ActionMenuEntry';
|
||||||
import { createComponentSelectorV2 } from '@/ui/utilities/state/component-state/utils/createComponentSelectorV2';
|
import { createComponentSelectorV2 } from '@/ui/utilities/state/component-state/utils/createComponentSelectorV2';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const actionMenuEntriesComponentSelector = createComponentSelectorV2<
|
export const actionMenuEntriesComponentSelector = createComponentSelectorV2<
|
||||||
ActionMenuEntry[]
|
ActionMenuEntry[]
|
||||||
|
|||||||
@ -2,14 +2,13 @@ import { createReactBlockSpec } from '@blocknote/react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { ChangeEvent, useRef } from 'react';
|
import { ChangeEvent, useRef } from 'react';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { Button } from 'twenty-ui';
|
import { Button } from 'twenty-ui';
|
||||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||||
|
|
||||||
import { AttachmentIcon } from '../../files/components/AttachmentIcon';
|
import { AttachmentIcon } from '../../files/components/AttachmentIcon';
|
||||||
import { AttachmentType } from '../../files/types/Attachment';
|
import { AttachmentType } from '../../files/types/Attachment';
|
||||||
import { getFileType } from '../../files/utils/getFileType';
|
import { getFileType } from '../../files/utils/getFileType';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledFileInput = styled.input`
|
const StyledFileInput = styled.input`
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalend
|
|||||||
import { hasCalendarEventEnded } from '@/activities/calendar/utils/hasCalendarEventEnded';
|
import { hasCalendarEventEnded } from '@/activities/calendar/utils/hasCalendarEventEnded';
|
||||||
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
|
||||||
import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu';
|
import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
AvatarGroup,
|
AvatarGroup,
|
||||||
@ -24,6 +23,7 @@ import {
|
|||||||
CalendarChannelVisibility,
|
CalendarChannelVisibility,
|
||||||
TimelineCalendarEvent,
|
TimelineCalendarEvent,
|
||||||
} from '~/generated-metadata/graphql';
|
} from '~/generated-metadata/graphql';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type CalendarEventRowProps = {
|
type CalendarEventRowProps = {
|
||||||
calendarEvent: TimelineCalendarEvent;
|
calendarEvent: TimelineCalendarEvent;
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import { useMemo, useState } from 'react';
|
|||||||
|
|
||||||
import { findUpcomingCalendarEvent } from '@/activities/calendar/utils/findUpcomingCalendarEvent';
|
import { findUpcomingCalendarEvent } from '@/activities/calendar/utils/findUpcomingCalendarEvent';
|
||||||
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
|
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { TimelineCalendarEvent } from '~/generated/graphql';
|
import { TimelineCalendarEvent } from '~/generated/graphql';
|
||||||
import { groupArrayItemsBy } from '~/utils/array/groupArrayItemsBy';
|
import { groupArrayItemsBy } from '~/utils/array/groupArrayItemsBy';
|
||||||
import { sortDesc } from '~/utils/sort';
|
import { sortDesc } from '~/utils/sort';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useCalendarEvents = (calendarEvents: TimelineCalendarEvent[]) => {
|
export const useCalendarEvents = (calendarEvents: TimelineCalendarEvent[]) => {
|
||||||
const calendarEventsByDayTime = groupArrayItemsBy(
|
const calendarEventsByDayTime = groupArrayItemsBy(
|
||||||
|
|||||||
@ -21,7 +21,6 @@ import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
|
|||||||
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
|
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
|
|
||||||
import { ActivityRichTextEditorChangeOnActivityIdEffect } from '@/activities/components/ActivityRichTextEditorChangeOnActivityIdEffect';
|
import { ActivityRichTextEditorChangeOnActivityIdEffect } from '@/activities/components/ActivityRichTextEditorChangeOnActivityIdEffect';
|
||||||
@ -34,6 +33,7 @@ import '@blocknote/mantine/style.css';
|
|||||||
import { useCreateBlockNote } from '@blocknote/react';
|
import { useCreateBlockNote } from '@blocknote/react';
|
||||||
import '@blocknote/react/style.css';
|
import '@blocknote/react/style.css';
|
||||||
import { isArray, isNonEmptyString } from '@sniptt/guards';
|
import { isArray, isNonEmptyString } from '@sniptt/guards';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type ActivityRichTextEditorProps = {
|
type ActivityRichTextEditorProps = {
|
||||||
activityId: string;
|
activityId: string;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
|
|
||||||
import { EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
|
import { EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const getDisplayNameFromParticipant = ({
|
export const getDisplayNameFromParticipant = ({
|
||||||
participant,
|
participant,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { TextInput } from '@/ui/input/components/TextInput';
|
|||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import {
|
import {
|
||||||
IconCalendar,
|
IconCalendar,
|
||||||
OverflowingTextWithTooltip,
|
OverflowingTextWithTooltip,
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import { useAttachments } from '@/activities/files/hooks/useAttachments';
|
|||||||
import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
|
import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
|
||||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||||
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
|
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledAttachmentsContainer = styled.div`
|
const StyledAttachmentsContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { TaskTarget } from '@/activities/types/TaskTarget';
|
|||||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useActivityTargetObjectRecords = (
|
export const useActivityTargetObjectRecords = (
|
||||||
activityRecordId?: string,
|
activityRecordId?: string,
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import { NoteTarget } from '@/activities/types/NoteTarget';
|
|||||||
import { TaskTarget } from '@/activities/types/TaskTarget';
|
import { TaskTarget } from '@/activities/types/TaskTarget';
|
||||||
import { getJoinObjectNameSingular } from '@/activities/utils/getJoinObjectNameSingular';
|
import { getJoinObjectNameSingular } from '@/activities/utils/getJoinObjectNameSingular';
|
||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback } from 'recoil';
|
||||||
import { capitalize } from 'twenty-shared';
|
import { capitalize } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useCreateActivityInDB = ({
|
export const useCreateActivityInDB = ({
|
||||||
activityObjectNameSingular,
|
activityObjectNameSingular,
|
||||||
|
|||||||
@ -13,8 +13,8 @@ import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordF
|
|||||||
import { useUpsertFindManyRecordsQueryInCache } from '@/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache';
|
import { useUpsertFindManyRecordsQueryInCache } from '@/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache';
|
||||||
import { getRecordFromCache } from '@/object-record/cache/utils/getRecordFromCache';
|
import { getRecordFromCache } from '@/object-record/cache/utils/getRecordFromCache';
|
||||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { sortByAscString } from '~/utils/array/sortByAscString';
|
import { sortByAscString } from '~/utils/array/sortByAscString';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const usePrepareFindManyActivitiesQuery = ({
|
export const usePrepareFindManyActivitiesQuery = ({
|
||||||
activityObjectNameSingular,
|
activityObjectNameSingular,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { useRecoilValue } from 'recoil';
|
|||||||
import { usePrepareFindManyActivitiesQuery } from '@/activities/hooks/usePrepareFindManyActivitiesQuery';
|
import { usePrepareFindManyActivitiesQuery } from '@/activities/hooks/usePrepareFindManyActivitiesQuery';
|
||||||
import { objectShowPageTargetableObjectState } from '@/activities/timeline-activities/states/objectShowPageTargetableObjectIdState';
|
import { objectShowPageTargetableObjectState } from '@/activities/timeline-activities/states/objectShowPageTargetableObjectIdState';
|
||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// This hook should only be executed if the normalized cache is up-to-date
|
// This hook should only be executed if the normalized cache is up-to-date
|
||||||
// It will take a targetableObject and prepare the queries for the activities
|
// It will take a targetableObject and prepare the queries for the activities
|
||||||
|
|||||||
@ -2,8 +2,8 @@ import { BLOCK_SCHEMA } from '@/activities/blocks/constants/Schema';
|
|||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useReplaceActivityBlockEditorContent = (
|
export const useReplaceActivityBlockEditorContent = (
|
||||||
editor: typeof BLOCK_SCHEMA.BlockNoteEditor,
|
editor: typeof BLOCK_SCHEMA.BlockNoteEditor,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { Note } from '@/activities/types/Note';
|
|||||||
import { Task } from '@/activities/types/Task';
|
import { Task } from '@/activities/types/Task';
|
||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useUpsertActivity = ({
|
export const useUpsertActivity = ({
|
||||||
activityObjectNameSingular,
|
activityObjectNameSingular,
|
||||||
|
|||||||
@ -11,8 +11,8 @@ import { RecordPickerPickableMorphItem } from '@/object-record/record-picker/typ
|
|||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
import { isNull } from '@sniptt/guards';
|
import { isNull } from '@sniptt/guards';
|
||||||
import { useRecoilCallback, useSetRecoilState } from 'recoil';
|
import { useRecoilCallback, useSetRecoilState } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type UpdateActivityTargetFromInlineCellProps = {
|
type UpdateActivityTargetFromInlineCellProps = {
|
||||||
recordPickerInstanceId: string;
|
recordPickerInstanceId: string;
|
||||||
|
|||||||
@ -7,13 +7,13 @@ import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
|||||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||||
import { UserContext } from '@/users/contexts/UserContext';
|
import { UserContext } from '@/users/contexts/UserContext';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
formatToHumanReadableDay,
|
formatToHumanReadableDay,
|
||||||
formatToHumanReadableMonth,
|
formatToHumanReadableMonth,
|
||||||
formatToHumanReadableTime,
|
formatToHumanReadableTime,
|
||||||
} from '~/utils/format/formatDate';
|
} from '~/utils/format/formatDate';
|
||||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledEventCardCalendarEventContainer = styled.div`
|
const StyledEventCardCalendarEventContainer = styled.div`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
|||||||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||||
import { useSetRecordValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
|
import { useSetRecordValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
|
||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const EventFieldDiffValueEffect = ({
|
export const EventFieldDiffValueEffect = ({
|
||||||
diffArtificialRecordStoreId,
|
diffArtificialRecordStoreId,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { EventCardMessageNotShared } from '@/activities/timeline-activities/rows
|
|||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
||||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledEventCardMessageContainer = styled.div`
|
const StyledEventCardMessageContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { TimelineActivity } from '@/activities/timeline-activities/types/TimelineActivity';
|
import { TimelineActivity } from '@/activities/timeline-activities/types/TimelineActivity';
|
||||||
import { CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';
|
import { CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const getTimelineActivityAuthorFullName = (
|
export const getTimelineActivityAuthorFullName = (
|
||||||
event: TimelineActivity,
|
event: TimelineActivity,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { TimelineActivity } from '@/activities/timeline-activities/types/TimelineActivity';
|
import { TimelineActivity } from '@/activities/timeline-activities/types/TimelineActivity';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export type EventGroup = {
|
export type EventGroup = {
|
||||||
month: number;
|
month: number;
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import { previousUrlState } from '@/auth/states/previousUrlState';
|
|||||||
import { tokenPairState } from '@/auth/states/tokenPairState';
|
import { tokenPairState } from '@/auth/states/tokenPairState';
|
||||||
import { workspacesState } from '@/auth/states/workspaces';
|
import { workspacesState } from '@/auth/states/workspaces';
|
||||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||||
import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
||||||
@ -18,6 +17,7 @@ import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
|||||||
import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
|
import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
|
||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { ApolloFactory, Options } from '../services/apollo.factory';
|
import { ApolloFactory, Options } from '../services/apollo.factory';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
|
export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
|
||||||
// eslint-disable-next-line @nx/workspace-no-state-useref
|
// eslint-disable-next-line @nx/workspace-no-state-useref
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { ReadFieldFunction } from '@apollo/client/cache/core/types/common';
|
|||||||
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
||||||
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
|
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
|
||||||
import { OrderBy } from '@/types/OrderBy';
|
import { OrderBy } from '@/types/OrderBy';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { sortAsc, sortDesc, sortNullsFirst, sortNullsLast } from '~/utils/sort';
|
import { sortAsc, sortDesc, sortNullsFirst, sortNullsLast } from '~/utils/sort';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const sortCachedObjectEdges = ({
|
export const sortCachedObjectEdges = ({
|
||||||
edges,
|
edges,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { ApolloCache, StoreObject } from '@apollo/client';
|
|||||||
|
|
||||||
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
||||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||||
import { capitalize, isDefined } from 'twenty-shared';
|
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const triggerAttachRelationOptimisticEffect = ({
|
export const triggerAttachRelationOptimisticEffect = ({
|
||||||
cache,
|
cache,
|
||||||
|
|||||||
@ -13,8 +13,8 @@ import { CachedObjectRecordQueryVariables } from '@/apollo/types/CachedObjectRec
|
|||||||
import { encodeCursor } from '@/apollo/utils/encodeCursor';
|
import { encodeCursor } from '@/apollo/utils/encodeCursor';
|
||||||
import { getRecordFromCache } from '@/object-record/cache/utils/getRecordFromCache';
|
import { getRecordFromCache } from '@/object-record/cache/utils/getRecordFromCache';
|
||||||
import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNodeFromRecord';
|
import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNodeFromRecord';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: for now new records are added to all cached record lists, no matter what the variables (filters, orderBy, etc.) are.
|
TODO: for now new records are added to all cached record lists, no matter what the variables (filters, orderBy, etc.) are.
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
|||||||
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge';
|
||||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||||
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const triggerDestroyRecordsOptimisticEffect = ({
|
export const triggerDestroyRecordsOptimisticEffect = ({
|
||||||
cache,
|
cache,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ApolloCache, StoreObject } from '@apollo/client';
|
import { ApolloCache, StoreObject } from '@apollo/client';
|
||||||
|
|
||||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||||
import { capitalize } from 'twenty-shared';
|
import { capitalize } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const triggerDetachRelationOptimisticEffect = ({
|
export const triggerDetachRelationOptimisticEffect = ({
|
||||||
cache,
|
cache,
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import { getEdgeTypename } from '@/object-record/cache/utils/getEdgeTypename';
|
|||||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||||
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
||||||
import { isRecordMatchingFilter } from '@/object-record/record-filter/utils/isRecordMatchingFilter';
|
import { isRecordMatchingFilter } from '@/object-record/record-filter/utils/isRecordMatchingFilter';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// TODO: add extensive unit tests for this function
|
// TODO: add extensive unit tests for this function
|
||||||
// That will also serve as documentation
|
// That will also serve as documentation
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import { getEdgeTypename } from '@/object-record/cache/utils/getEdgeTypename';
|
|||||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||||
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
||||||
import { isRecordMatchingFilter } from '@/object-record/record-filter/utils/isRecordMatchingFilter';
|
import { isRecordMatchingFilter } from '@/object-record/record-filter/utils/isRecordMatchingFilter';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
import { parseApolloStoreFieldName } from '~/utils/parseApolloStoreFieldName';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// TODO: add extensive unit tests for this function
|
// TODO: add extensive unit tests for this function
|
||||||
// That will also serve as documentation
|
// That will also serve as documentation
|
||||||
|
|||||||
@ -9,9 +9,9 @@ import { RecordGqlConnection } from '@/object-record/graphql/types/RecordGqlConn
|
|||||||
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
||||||
import { ApolloCache } from '@apollo/client';
|
import { ApolloCache } from '@apollo/client';
|
||||||
import { isArray } from '@sniptt/guards';
|
import { isArray } from '@sniptt/guards';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type triggerUpdateRelationsOptimisticEffectArgs = {
|
type triggerUpdateRelationsOptimisticEffectArgs = {
|
||||||
cache: ApolloCache<unknown>;
|
cache: ApolloCache<unknown>;
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import { createUploadLink } from 'apollo-upload-client';
|
|||||||
|
|
||||||
import { renewToken } from '@/auth/services/AuthService';
|
import { renewToken } from '@/auth/services/AuthService';
|
||||||
import { CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';
|
import { CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { AuthTokenPair } from '~/generated/graphql';
|
import { AuthTokenPair } from '~/generated/graphql';
|
||||||
import { logDebug } from '~/utils/logDebug';
|
import { logDebug } from '~/utils/logDebug';
|
||||||
|
|
||||||
@ -21,6 +20,7 @@ import { i18n } from '@lingui/core';
|
|||||||
import { GraphQLFormattedError } from 'graphql';
|
import { GraphQLFormattedError } from 'graphql';
|
||||||
import { ApolloManager } from '../types/apolloManager.interface';
|
import { ApolloManager } from '../types/apolloManager.interface';
|
||||||
import { loggerLink } from '../utils/loggerLink';
|
import { loggerLink } from '../utils/loggerLink';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const logger = loggerLink(() => 'Twenty');
|
const logger = loggerLink(() => 'Twenty');
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const encodeCursor = (record: ObjectRecord) => {
|
export const encodeCursor = (record: ObjectRecord) => {
|
||||||
if (!('id' in record) || !isDefined(record.id)) {
|
if (!('id' in record) || !isDefined(record.id)) {
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import { ApolloLink, gql, Operation } from '@apollo/client';
|
import { ApolloLink, gql, Operation } from '@apollo/client';
|
||||||
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { logDebug } from '~/utils/logDebug';
|
import { logDebug } from '~/utils/logDebug';
|
||||||
import { logError } from '~/utils/logError';
|
import { logError } from '~/utils/logError';
|
||||||
|
|
||||||
import formatTitle from './formatTitle';
|
import formatTitle from './formatTitle';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const getGroup = (collapsed: boolean) =>
|
const getGroup = (collapsed: boolean) =>
|
||||||
collapsed
|
collapsed
|
||||||
|
|||||||
@ -21,10 +21,10 @@ import { AppPath } from '@/types/AppPath';
|
|||||||
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
|
||||||
import { SettingsPath } from '@/types/SettingsPath';
|
import { SettingsPath } from '@/types/SettingsPath';
|
||||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||||
import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation';
|
import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation';
|
||||||
import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath';
|
import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
// TODO: break down into smaller functions and / or hooks
|
// TODO: break down into smaller functions and / or hooks
|
||||||
// - moved usePageChangeEffectNavigateLocation into dedicated hook
|
// - moved usePageChangeEffectNavigateLocation into dedicated hook
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
|
|
||||||
import { getImageAbsoluteURI } from 'twenty-shared';
|
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
|
import { getImageAbsoluteURI } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type LogoProps = {
|
type LogoProps = {
|
||||||
primaryLogo?: string | null;
|
primaryLogo?: string | null;
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import { useVerifyLogin } from '@/auth/hooks/useVerifyLogin';
|
|||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const VerifyEffect = () => {
|
export const VerifyEffect = () => {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { i18n } from '@lingui/core';
|
|||||||
import { I18nProvider } from '@lingui/react';
|
import { I18nProvider } from '@lingui/react';
|
||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
import { RecoilRoot } from 'recoil';
|
import { RecoilRoot } from 'recoil';
|
||||||
import { SOURCE_LOCALE } from 'twenty-shared';
|
|
||||||
|
|
||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||||
@ -12,6 +11,8 @@ import { useAuth } from '../useAuth';
|
|||||||
import { useVerifyLogin } from '../useVerifyLogin';
|
import { useVerifyLogin } from '../useVerifyLogin';
|
||||||
|
|
||||||
import { dynamicActivate } from '~/utils/i18n/dynamicActivate';
|
import { dynamicActivate } from '~/utils/i18n/dynamicActivate';
|
||||||
|
import { SOURCE_LOCALE } from 'twenty-shared/translations';
|
||||||
|
|
||||||
jest.mock('../useAuth', () => ({
|
jest.mock('../useAuth', () => ({
|
||||||
useAuth: jest.fn(),
|
useAuth: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import { clientConfigApiStatusState } from '@/client-config/states/clientConfigA
|
|||||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||||
import { supportChatState } from '@/client-config/states/supportChatState';
|
import { supportChatState } from '@/client-config/states/supportChatState';
|
||||||
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
|
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
|
||||||
import { APP_LOCALES, isDefined } from 'twenty-shared';
|
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
import {
|
import {
|
||||||
useCheckUserExistsLazyQuery,
|
useCheckUserExistsLazyQuery,
|
||||||
@ -65,6 +64,8 @@ import { i18n } from '@lingui/core';
|
|||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';
|
import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';
|
||||||
import { dynamicActivate } from '~/utils/i18n/dynamicActivate';
|
import { dynamicActivate } from '~/utils/i18n/dynamicActivate';
|
||||||
|
import { APP_LOCALES } from 'twenty-shared/translations';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useAuth = () => {
|
export const useAuth = () => {
|
||||||
const setTokenPair = useSetRecoilState(tokenPairState);
|
const setTokenPair = useSetRecoilState(tokenPairState);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
} from '@apollo/client';
|
} from '@apollo/client';
|
||||||
|
|
||||||
import { loggerLink } from '@/apollo/utils/loggerLink';
|
import { loggerLink } from '@/apollo/utils/loggerLink';
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import {
|
import {
|
||||||
AuthTokenPair,
|
AuthTokenPair,
|
||||||
RenewTokenDocument,
|
RenewTokenDocument,
|
||||||
@ -15,6 +14,7 @@ import {
|
|||||||
RenewTokenMutationVariables,
|
RenewTokenMutationVariables,
|
||||||
} from '~/generated/graphql';
|
} from '~/generated/graphql';
|
||||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const logger = loggerLink(() => 'Twenty-Refresh');
|
const logger = loggerLink(() => 'Twenty-Refresh');
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { Controller, useFormContext } from 'react-hook-form';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';
|
import { Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
const StyledFullWidthMotionDiv = styled(motion.div)`
|
const StyledFullWidthMotionDiv = styled(motion.div)`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user