Skip to content

Commit

Permalink
Merge branch 'main' into c--add-create-many-field-metadata-method-to-…
Browse files Browse the repository at this point in the history
…batch-transaction-and-cache-invalidation
  • Loading branch information
Weiko committed Feb 3, 2025
2 parents 22fec0e + 39e7f6c commit 377be71
Show file tree
Hide file tree
Showing 698 changed files with 7,559 additions and 1,641 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@octokit/graphql": "^7.0.2",
"@ptc-org/nestjs-query-core": "^4.2.0",
"@ptc-org/nestjs-query-typeorm": "4.2.1-alpha.2",
"@react-email/components": "0.0.12",
"@react-email/render": "0.0.10",
"@react-email/components": "0.0.32",
"@react-email/render": "0.0.17",
"@sentry/node": "^8",
"@sentry/profiling-node": "^8",
"@sentry/react": "^8",
Expand Down
3 changes: 3 additions & 0 deletions packages/twenty-chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"type": "module",
"scripts": {
"build": "npx vite build"
},
"dependencies": {
"twenty-shared": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/background/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

// Open options page programmatically in a new tab.
// chrome.runtime.onInstalled.addListener((details) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

interface CustomDiv extends HTMLDivElement {
onClickHandler: (newHandler: () => void) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isDefined } from 'twenty-shared';
import { createDefaultButton } from '~/contentScript/createButton';
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
import extractCompanyLinkedinLink from '~/contentScript/utils/extractCompanyLinkedinLink';
import extractDomain from '~/contentScript/utils/extractDomain';
import { createCompany, fetchCompany } from '~/db/company.db';
import { CompanyInput } from '~/db/types/company.types';
import { isDefined } from '~/utils/isDefined';

export const checkIfCompanyExists = async () => {
const { tab: activeTab } = await chrome.runtime.sendMessage({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { isDefined } from 'twenty-shared';
import { createDefaultButton } from '~/contentScript/createButton';
import changeSidePanelUrl from '~/contentScript/utils/changeSidepanelUrl';
import extractFirstAndLastName from '~/contentScript/utils/extractFirstAndLastName';
import { createPerson, fetchPerson } from '~/db/person.db';
import { PersonInput } from '~/db/types/person.types';
import { isDefined } from '~/utils/isDefined';

export const checkIfPersonExists = async () => {
const { tab: activeTab } = await chrome.runtime.sendMessage({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isDefined } from 'twenty-shared';
import { insertButtonForCompany } from '~/contentScript/extractCompanyProfile';
import { insertButtonForPerson } from '~/contentScript/extractPersonProfile';
import { isDefined } from '~/utils/isDefined';

// 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/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

const btn = document.getElementById('twenty-settings-btn');
if (!isDefined(btn)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

const changeSidePanelUrl = async (url: string) => {
if (isDefined(url)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// 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 '~/utils/isDefined';
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/".
const extractCompanyLinkedinLink = (activeTabUrl: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/db/auth.db.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { isDefined } from 'twenty-shared';
import {
ExchangeAuthCodeInput,
ExchangeAuthCodeResponse,
Tokens,
} from '~/db/types/auth.types';
import { EXCHANGE_AUTHORIZATION_CODE } from '~/graphql/auth/mutations';
import { isDefined } from '~/utils/isDefined';
import { callMutation } from '~/utils/requestDb';

export const exchangeAuthorizationCode = async (
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/db/company.db.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isDefined } from 'twenty-shared';
import {
CompanyInput,
CreateCompanyResponse,
Expand All @@ -6,7 +7,6 @@ import {
import { Company, CompanyFilterInput } from '~/generated/graphql';
import { CREATE_COMPANY } from '~/graphql/company/mutations';
import { FIND_COMPANY } from '~/graphql/company/queries';
import { isDefined } from '~/utils/isDefined';

import { callMutation, callQuery } from '../utils/requestDb';

Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/db/person.db.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isDefined } from 'twenty-shared';
import {
CreatePersonResponse,
FindPersonResponse,
Expand All @@ -6,7 +7,6 @@ import {
import { Person, PersonFilterInput } from '~/generated/graphql';
import { CREATE_PERSON } from '~/graphql/person/mutations';
import { FIND_PERSON } from '~/graphql/person/queries';
import { isDefined } from '~/utils/isDefined';

import { callMutation, callQuery } from '../utils/requestDb';

Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/db/token.db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ApolloClient, InMemoryCache } from '@apollo/client';

import { isDefined } from 'twenty-shared';
import { Tokens } from '~/db/types/auth.types';
import { RENEW_TOKEN } from '~/graphql/auth/mutations';
import { isDefined } from '~/utils/isDefined';

export const renewToken = async (
appToken: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/options/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from 'react';

import { isDefined } from 'twenty-shared';
import Settings from '~/options/Settings';
import Sidepanel from '~/options/Sidepanel';
import { isDefined } from '~/utils/isDefined';

const App = () => {
const [currentScreen, setCurrentScreen] = useState('');
Expand Down
4 changes: 2 additions & 2 deletions packages/twenty-chrome-extension/src/options/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react';
import styled from '@emotion/styled';
import { useEffect, useState } from 'react';

import { MainButton } from '@/ui/input/button/MainButton';
import { TextInput } from '@/ui/input/components/TextInput';
import { isDefined } from 'twenty-shared';
import { clearStore } from '~/utils/apolloClient';
import { isDefined } from '~/utils/isDefined';

const StyledWrapper = styled.div`
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions packages/twenty-chrome-extension/src/options/Sidepanel.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import styled from '@emotion/styled';
import { useCallback, useEffect, useRef, useState } from 'react';

import { MainButton } from '@/ui/input/button/MainButton';
import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

const StyledIframe = styled.iframe`
display: block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from 'react';
import styled from '@emotion/styled';
import { motion } from 'framer-motion';
import { useEffect, useState } from 'react';

import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

export type ToggleSize = 'small' | 'medium';

Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/utils/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client';
import { setContext } from '@apollo/client/link/context';
import { onError } from '@apollo/client/link/error';

import { isDefined } from '~/utils/isDefined';
import { isDefined } from 'twenty-shared';

export const clearStore = () => {
chrome.storage.local.remove([
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-chrome-extension/src/utils/requestDb.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { OperationVariables } from '@apollo/client';
import { DocumentNode } from 'graphql';

import { isDefined } from 'twenty-shared';
import getApolloClient from '~/utils/apolloClient';
import { isDefined } from '~/utils/isDefined';

export const callQuery = async <T>(
query: DocumentNode,
Expand Down
18 changes: 18 additions & 0 deletions packages/twenty-emails/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"experimental": {
"plugins": [
[
"@lingui/swc-plugin",
{
"runtimeModules": {
"i18n": ["@lingui/core", "i18n"],
"trans": ["@lingui/react", "Trans"]
}
}
]
]
}
}
}
30 changes: 30 additions & 0 deletions packages/twenty-emails/lingui.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfig } from '@lingui/cli';
import { APP_LOCALES } from 'twenty-shared';

export default defineConfig({
sourceLocale: 'en',
locales: Object.values(APP_LOCALES),
pseudoLocale: 'pseudo-en',
fallbackLocales: {
'pseudo-en': 'en',
},
extractorParserOptions: {
tsExperimentalDecorators: true,
},
catalogs: [
{
path: '<rootDir>/src/locales/{locale}',
include: ['src'],
},
],
catalogsMergePath: '<rootDir>/src/locales/generated/{locale}',
compileNamespace: 'ts',
...(process.env.TRANSLATION_IO_API_KEY_EMAILS
? {
service: {
name: 'TranslationIO',
apiKey: process.env.TRANSLATION_IO_API_KEY_EMAILS,
},
}
: {}),
});
3 changes: 2 additions & 1 deletion packages/twenty-emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"engines": {
Expand Down
14 changes: 14 additions & 0 deletions packages/twenty-emails/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
"configurations": {
"fix": {}
}
},
"lingui:extract": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "lingui extract --overwrite"
}
},
"lingui:compile": {
"executor": "nx:run-commands",
"options": {
"cwd": "{projectRoot}",
"command": "lingui compile --typescript"
}
}
}
}
53 changes: 44 additions & 9 deletions packages/twenty-emails/src/components/BaseEmail.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,56 @@
import { PropsWithChildren } from 'react';
import { i18n } from '@lingui/core';
import { I18nProvider } from '@lingui/react';
import { Container, Html } from '@react-email/components';
import { PropsWithChildren } from 'react';

import { BaseHead } from 'src/components/BaseHead';
import { Logo } from 'src/components/Logo';
import { APP_LOCALES } from 'twenty-shared';
import { messages as deMessages } from '../locales/generated/de';
import { messages as enMessages } from '../locales/generated/en';
import { messages as esMessages } from '../locales/generated/es';
import { messages as frMessages } from '../locales/generated/fr';
import { messages as itMessages } from '../locales/generated/it';
import { messages as jaMessages } from '../locales/generated/ja';
import { messages as koMessages } from '../locales/generated/ko';
import { messages as pseudoEnMessages } from '../locales/generated/pseudo-en';
import { messages as ptBRMessages } from '../locales/generated/pt-BR';
import { messages as ptPTMessages } from '../locales/generated/pt-PT';
import { messages as zhHansMessages } from '../locales/generated/zh-Hans';
import { messages as zhHantMessages } from '../locales/generated/zh-Hant';

type BaseEmailProps = PropsWithChildren<{
width?: number;
locale: keyof typeof APP_LOCALES;
}>;

export const BaseEmail = ({ children, width }: BaseEmailProps) => {
i18n.load('en', enMessages);
i18n.load('fr', frMessages);
i18n.load('pseudo-en', pseudoEnMessages);
i18n.load('ko', koMessages);
i18n.load('de', deMessages);
i18n.load('it', itMessages);
i18n.load('es', esMessages);
i18n.load('ja', jaMessages);
i18n.load('pt-PT', ptPTMessages);
i18n.load('pt-BR', ptBRMessages);
i18n.load('zh-Hans', zhHansMessages);
i18n.load('zh-Hant', zhHantMessages);

i18n.activate('en');

export const BaseEmail = ({ children, width, locale }: BaseEmailProps) => {
i18n.activate(locale);

return (
<Html lang="en">
<BaseHead />
<Container width={width || 290}>
<Logo />
{children}
</Container>
</Html>
<I18nProvider i18n={i18n}>
<Html lang={locale}>
<BaseHead />
<Container width={width || 290}>
<Logo />
{children}
</Container>
</Html>
</I18nProvider>
);
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Trans } from '@lingui/react/macro';
import { BaseEmail } from 'src/components/BaseEmail';
import { CallToAction } from 'src/components/CallToAction';
import { MainText } from 'src/components/MainText';
Expand All @@ -17,20 +18,24 @@ export const CleanSuspendedWorkspaceEmail = ({
const helloString = userName?.length > 1 ? `Hello ${userName}` : 'Hello';

return (
<BaseEmail width={333}>
<BaseEmail width={333} locale="en">
<Title value="Deleted Workspace 🥺" />
<MainText>
{helloString},
<br />
<br />
Your workspace <b>{workspaceDisplayName}</b> has been deleted as your
subscription expired {inactiveDaysBeforeDelete} days ago.
<Trans>
Your workspace <b>{workspaceDisplayName}</b> has been deleted as your
subscription expired {inactiveDaysBeforeDelete} days ago.
</Trans>
<br />
<br />
All data in this workspace has been permanently deleted.
<Trans>All data in this workspace has been permanently deleted.</Trans>
<br />
<br />
If you wish to use Twenty again, you can create a new workspace.
<Trans>
If you wish to use Twenty again, you can create a new workspace.
</Trans>
</MainText>
<CallToAction
href="https://app.twenty.com/"
Expand Down
Loading

0 comments on commit 377be71

Please sign in to comment.