Skip to content

The open alternative to Salesforce, designed for AI.

Add a domain subtype to LINKS fields and normalize domains on write (#24911)

neo77384f513911556
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/application/navigation-menu-items/my-applications.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/application/navigation-menu-items/my-applications.navigation-menu-item.ts
index 54779043062..6f1b9ceabc0 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/application/navigation-menu-items/my-applications.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/application/navigation-menu-items/my-applications.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/application/views/my-applications.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.test.ts
index e33d98e9d89..270e3f5d359 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.test.ts
@@ -21,13 +21,7 @@ const APPLICATION_OBJECT_SOURCE = readFileSync(
describe('HOW_TO_PROCESS_STEPS', () => {
it('uses Deals-board stage labels from OPPORTUNITY_STAGE_OPTIONS', () => {
- const expected = [
- 'New',
- 'Screening',
- 'Meeting',
- 'Proposal',
- 'Customer',
- ];
+ const expected = ['New', 'Screening', 'Meeting', 'Proposal', 'Customer'];
expect(DEAL_BOARD_STAGE_LABELS).toEqual(expected);
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.ts
index b790d10ea73..12d2e8c024a 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/admin-copy.ts
@@ -52,10 +52,7 @@ export const HOW_TO_PROCESS_STEPS: PlaybookStep[] = [
num: '04',
heading: 'Match',
body: 'Briefs to Match is the queue with no Partner yet. You can do all of this through MCP. Ask the agent to make the changes in the CRM. Skills are also available: /twenty-partner-shortlist, or wait for applications. /twenty-lead-brief is available if the brief is still thin. /twenty-partner-intro is available once you name the partners.',
- pills: [
- 'Applied — the partner came in',
- 'Invited — you pushed them',
- ],
+ pills: ['Applied — the partner came in', 'Invited — you pushed them'],
skills: [PLAYBOOK_SKILL_SHORTLIST],
},
{
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/how-to-process.constants.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/how-to-process.constants.ts
index 65e1169b8d6..ed68377e65c 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/how-to-process.constants.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/how-to-process.constants.ts
@@ -13,9 +13,7 @@ export const HOW_TO_APPLY_FRONT_COMPONENT_ID =
'3770f0a4-408c-42cf-ac80-fe1752b40625';
export const HOW_TO_APPLY_PAGE_LAYOUT_ID =
'a35eb9dd-c828-4bad-8bfb-986e1c9e9cde';
-export const HOW_TO_APPLY_PAGE_TAB_ID =
- '8ec88001-040c-474a-af00-372d87a51501';
+export const HOW_TO_APPLY_PAGE_TAB_ID = '8ec88001-040c-474a-af00-372d87a51501';
export const HOW_TO_APPLY_PAGE_WIDGET_ID =
'3ceda86c-e3ab-447c-9be6-b4a692c3d71a';
-export const HOW_TO_APPLY_NAV_ITEM_ID =
- 'b8d751cf-978c-4291-89cb-478d639a8539';
+export const HOW_TO_APPLY_NAV_ITEM_ID = 'b8d751cf-978c-4291-89cb-478d639a8539';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/playbook-skills.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/playbook-skills.test.ts
index c53ee3c6499..8ad562246af 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/playbook-skills.test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/constants/playbook-skills.test.ts
@@ -14,9 +14,9 @@ const SKILLS_ROOT = resolve(
describe('PLAYBOOK_SKILLS', () => {
it('points each GitHub URL at a SKILL.md that exists in this app', () => {
for (const skill of PLAYBOOK_SKILLS) {
- expect(
- existsSync(resolve(SKILLS_ROOT, skill.name, 'SKILL.md')),
- ).toBe(true);
+ expect(existsSync(resolve(SKILLS_ROOT, skill.name, 'SKILL.md'))).toBe(
+ true,
+ );
expect(skill.githubUrl).toBe(
`https://github.com/twentyhq/twenty/blob/main/packages/twenty-apps/internal/twenty-partners/src/skills/${skill.name}/SKILL.md`,
);
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-article.tsx b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-article.tsx
index d67b3de8edf..5b948c4071e 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-article.tsx
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-article.tsx
@@ -29,11 +29,7 @@ export const PlaybookArticle = ({
<article style={styles.article}>
<p style={styles.kicker}>{kicker}</p>
<h1 style={styles.title}>{title}</h1>
- <p
- style={
- headerLinks !== undefined ? styles.ledeWithLinks : styles.lede
- }
- >
+ <p style={headerLinks !== undefined ? styles.ledeWithLinks : styles.lede}>
<PlaybookMarkedText text={lede} links={bodyLinks} skills={skills} />
</p>
{headerLinks !== undefined ? (
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-nav-link.tsx b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-nav-link.tsx
index 66ddd9788f2..1110d3fd096 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-nav-link.tsx
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/front-components/playbook-nav-link.tsx
@@ -25,12 +25,7 @@ export const PlaybookNavLink = ({ link, children }: PlaybookNavLinkProps) => {
}
return (
- <a
- href={link.href}
- target="_blank"
- rel="noreferrer"
- style={styles.link}
- >
+ <a href={link.href} target="_blank" rel="noreferrer" style={styles.link}>
{children}
</a>
);
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-apply.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-apply.navigation-menu-item.ts
index 7e21360abd9..59d90251188 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-apply.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-apply.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import {
HOW_TO_APPLY_NAV_ITEM_ID,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-process.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-process.navigation-menu-item.ts
index e03dad22648..2a0f7c4884a 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-process.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/navigation-menu-items/how-to-process.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import {
HOW_TO_PROCESS_NAV_ITEM_ID,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/page-layouts/how-to-process.page-layout.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/page-layouts/how-to-process.page-layout.ts
index e2f8d08403f..f4163a8d769 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/page-layouts/how-to-process.page-layout.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/page-layouts/how-to-process.page-layout.ts
@@ -25,7 +25,8 @@ export default definePageLayout({
type: 'FRONT_COMPONENT',
configuration: {
configurationType: 'FRONT_COMPONENT',
- frontComponentUniversalIdentifier: HOW_TO_PROCESS_FRONT_COMPONENT_ID,
+ frontComponentUniversalIdentifier:
+ HOW_TO_PROCESS_FRONT_COMPONENT_ID,
},
},
],
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/playbook-nav.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/playbook-nav.ts
index dbcf09d4c00..966ab8872a2 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/playbook-nav.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/playbook-nav.ts
@@ -1,7 +1,4 @@
-import {
- AppPath,
- navigate,
-} from 'twenty-sdk/front-component';
+import { AppPath, navigate } from 'twenty-sdk/front-component';
import { MY_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/application/views/my-applications.view';
import { OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/opportunity/views/open-briefs.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/split-playbook-marks.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/split-playbook-marks.test.ts
index 7f4131f540c..28e8f101daf 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/split-playbook-marks.test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/how-to-process/utils/split-playbook-marks.test.ts
@@ -59,10 +59,9 @@ describe('splitPlaybookMarks', () => {
action: 'myApplications' as const,
};
- const marks = splitPlaybookMarks(
- 'See Open Briefs and My Applications.',
- { links: [openBriefs, myApplications] },
- );
+ const marks = splitPlaybookMarks('See Open Briefs and My Applications.', {
+ links: [openBriefs, myApplications],
+ });
expect(marks).toEqual([
{ kind: 'text', value: 'See ' },
@@ -79,7 +78,9 @@ describe('splitPlaybookMarks', () => {
href: 'https://discord.com/channels/1130383047699738754/1513506376595538032',
};
- expect(splitPlaybookMarks('Ping Discord after list.', { links: [discord] })).toEqual([
+ expect(
+ splitPlaybookMarks('Ping Discord after list.', { links: [discord] }),
+ ).toEqual([
{ kind: 'text', value: 'Ping ' },
{ kind: 'link', value: 'Discord', link: discord },
{ kind: 'text', value: ' after list.' },
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/my-deals.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/my-deals.navigation-menu-item.ts
index 36a6b98323e..a38f97f28ff 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/my-deals.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/my-deals.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { MY_DEALS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/opportunity/views/my-deals.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/open-briefs.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/open-briefs.navigation-menu-item.ts
index b9042c02627..6985cd91f17 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/open-briefs.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/opportunity/navigation-menu-items/open-briefs.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { OPEN_BRIEFS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/opportunity/views/open-briefs.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts
index b4de4507c6b..e50692d672b 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/__tests__/submit-partner-application.integration-test.ts
@@ -12,7 +12,9 @@ process.env.PARTNER_APPLICATION_SECRET = TEST_SECRET;
const client = new CoreApiClient();
-const baseInput = (overrides: Partial<SubmitPartnerApplicationInput> = {}): SubmitPartnerApplicationInput => ({
+const baseInput = (
+ overrides: Partial<SubmitPartnerApplicationInput> = {},
+): SubmitPartnerApplicationInput => ({
firstName: 'Ada',
lastName: 'Lovelace',
@@ -31,17 +33,25 @@ const createdCompanyIds: string[] = [];
async function cleanup(): Promise<void> {
for (const id of createdPartnerIds.splice(0)) {
- await client.mutation({ destroyPartner: { __args: { id }, id: true } }).catch(() => {});
+ await client
+ .mutation({ destroyPartner: { __args: { id }, id: true } })
+ .catch(() => {});
}
for (const id of createdPersonIds.splice(0)) {
- await client.mutation({ destroyPerson: { __args: { id }, id: true } }).catch(() => {});
+ await client
+ .mutation({ destroyPerson: { __args: { id }, id: true } })
+ .catch(() => {});
}
for (const id of createdCompanyIds.splice(0)) {
- await client.mutation({ destroyCompany: { __args: { id }, id: true } }).catch(() => {});
+ await client
+ .mutation({ destroyCompany: { __args: { id }, id: true } })
+ .catch(() => {});
}
}
-async function trackCreated(result: SubmitPartnerApplicationResult): Promise<void> {
+async function trackCreated(
+ result: SubmitPartnerApplicationResult,
+): Promise<void> {
if (!result.ok) return;
createdPartnerIds.push(result.partnerId);
const fetched = await client.query({
@@ -55,11 +65,14 @@ async function trackCreated(result: SubmitPartnerApplicationResult): Promise<voi
const node = fetched.partner;
if (!node) return;
if (node.company) createdCompanyIds.push(node.company.id);
- for (const edge of node.persons?.edges ?? []) createdPersonIds.push(edge.node.id);
+ for (const edge of node.persons?.edges ?? [])
+ createdPersonIds.push(edge.node.id);
}
beforeAll(async () => {
- await client.query({ partners: { __args: { first: 1 }, edges: { node: { id: true } } } });
+ await client.query({
+ partners: { __args: { first: 1 }, edges: { node: { id: true } } },
+ });
});
afterEach(async () => {
@@ -68,7 +81,10 @@ afterEach(async () => {
describe('submit-partner-application handler — auth', () => {
it('returns unauthorized when the x-application-secret header is missing', async () => {
- const result = await handler({ body: baseInput({ email: '[email protected]' }), headers: {} });
+ const result = await handler({
+ body: baseInput({ email: '[email protected]' }),
+ headers: {},
+ });
expect(result.ok).toBe(false);
if (result.ok) return;
expect(result.reason).toBe('unauthorized');
@@ -87,7 +103,14 @@ describe('submit-partner-application handler — auth', () => {
describe('submit-partner-application handler — upsert', () => {
it('creates Company, Person, and Partner on first submission and returns created: true', async () => {
- const result = await handler(authedEvent(baseInput({ email: '[email protected]', companyName: 'YC Agency' })));
+ const result = await handler(
+ authedEvent(
+ baseInput({
+ email: '[email protected]',
+ companyName: 'YC Agency',
+ }),
+ ),
+ );
await trackCreated(result);
expect(result.ok).toBe(true);
@@ -105,7 +128,15 @@ describe('submit-partner-application handler — upsert', () => {
superPartner: true,
partnerTier: true,
company: { id: true, name: true },
- persons: { edges: { node: { id: true, name: { firstName: true, lastName: true }, emails: { primaryEmail: true } } } },
+ persons: {
+ edges: {
+ node: {
+ id: true,
+ name: { firstName: true, lastName: true },
+ emails: { primaryEmail: true },
+ },
+ },
+ },
},
});
const node = partner.partner;
@@ -133,7 +164,12 @@ describe('submit-partner-application handler — upsert', () => {
const submittedVariant = 'https://www.Reuse-Domain-Case.example.com/';
const created = await client.mutation({
createCompany: {
- __args: { data: { name: 'Pre-existing Co', domainName: { primaryLinkUrl: storedDomain } } },
+ __args: {
+ data: {
+ name: 'Pre-existing Co',
+ domainName: { primaryLinkUrl: storedDomain },
+ },
+ },
id: true,
},
});
@@ -169,7 +205,11 @@ describe('submit-partner-application handler — upsert', () => {
});
it('returns created: false and updates fields on resubmission for the same email', async () => {
- const first = await handler(authedEvent(baseInput({ email: '[email protected]', city: 'London' })));
+ const first = await handler(
+ authedEvent(
+ baseInput({ email: '[email protected]', city: 'London' }),
+ ),
+ );
await trackCreated(first);
expect(first.ok).toBe(true);
if (!first.ok) return;
@@ -204,11 +244,16 @@ describe('submit-partner-application handler — upsert', () => {
expect(node?.city).toBe('Paris');
expect(node?.partnerScope).toEqual(['ADVISORY', 'SOLUTIONING']);
expect(node?.typeOfTeam).toBe('SOLO');
- expect(node?.hourlyRate).toEqual({ amountMicros: 175_000_000, currencyCode: 'USD' });
+ expect(node?.hourlyRate).toEqual({
+ amountMicros: 175_000_000,
+ currencyCode: 'USD',
+ });
});
it('preserves staff-owned columns (validationStage, superPartner) on resubmission', async () => {
- const first = await handler(authedEvent(baseInput({ email: '[email protected]' })));
+ const first = await handler(
+ authedEvent(baseInput({ email: '[email protected]' })),
+ );
await trackCreated(first);
expect(first.ok).toBe(true);
if (!first.ok) return;
@@ -223,7 +268,11 @@ describe('submit-partner-application handler — upsert', () => {
},
});
- const second = await handler(authedEvent(baseInput({ email: '[email protected]', city: 'Berlin' })));
+ const second = await handler(
+ authedEvent(
+ baseInput({ email: '[email protected]', city: 'Berlin' }),
+ ),
+ );
expect(second.ok).toBe(true);
if (!second.ok) return;
@@ -271,7 +320,9 @@ describe('submit-partner-application handler — upsert', () => {
it('rejects a legacy scope value as invalid_input', async () => {
const result = await handler(
- authedEvent(baseInput({ email: '[email protected]', partnerScope: ['APPS'] })),
+ authedEvent(
+ baseInput({ email: '[email protected]', partnerScope: ['APPS'] }),
+ ),
);
expect(result.ok).toBe(false);
if (result.ok) return;
@@ -290,7 +341,8 @@ describe('submit-partner-application handler — upsert', () => {
companyName: 'Experience Create Co',
twentyExperience: ['CUSTOM_APPS', 'DATA_MODELS', 'WORKFLOWS'],
twentyExperienceNotes,
- twentyExperienceProofLink: 'https://www.loom.com/share/experience-create',
+ twentyExperienceProofLink:
+ 'https://www.loom.com/share/experience-create',
}),
),
);
@@ -334,7 +386,8 @@ describe('submit-partner-application handler — upsert', () => {
twentyExperience: ['FRONT_COMPONENTS', 'WORKFLOWS'],
twentyExperienceNotes,
- twentyExperienceProofLink: 'https://github.com/example/twenty-case-study',
+ twentyExperienceProofLink:
+ 'https://github.com/example/twenty-case-study',
}),
),
);
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/constants/how-to-review.constants.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/constants/how-to-review.constants.ts
index 7e3b276b529..bca8b3961d8 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/constants/how-to-review.constants.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/constants/how-to-review.constants.ts
@@ -2,12 +2,10 @@ export const HOW_TO_REVIEW_FRONT_COMPONENT_ID =
'c6470933-a33a-4adc-b9a9-1c8d2759f627';
export const HOW_TO_REVIEW_PAGE_LAYOUT_ID =
'47f57740-c43e-4d1a-95be-b503f696786b';
-export const HOW_TO_REVIEW_PAGE_TAB_ID =
- '33c38f18-4e1c-448e-99f7-728650e7e4cd';
+export const HOW_TO_REVIEW_PAGE_TAB_ID = '33c38f18-4e1c-448e-99f7-728650e7e4cd';
export const HOW_TO_REVIEW_PAGE_WIDGET_ID =
'a1890015-e45f-4c09-bd9a-714a092cb324';
-export const HOW_TO_REVIEW_NAV_ITEM_ID =
- '3306c356-d4f1-4582-80f0-b38e37b41dc4';
+export const HOW_TO_REVIEW_NAV_ITEM_ID = '3306c356-d4f1-4582-80f0-b38e37b41dc4';
export const WELCOME_EMAIL_WORKFLOW_URL =
'https://partners.twenty.com/object/workflow/6306ce62-8aa2-4edb-bb8e-033b6524ebef';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts
index 689de985451..cc33c839dec 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/mappers/build-partner-fields.mapper.ts
@@ -6,13 +6,20 @@ import { deriveRegion } from 'src/modules/partner/application-intake/utils/deriv
import { type SubmitPartnerApplicationInput } from 'src/modules/partner/application-intake/services/submit-partner-application-input.schema';
import { slugify } from 'src/scripts/slugify';
-function toMicros(usd: number | undefined): { amountMicros: number; currencyCode: 'USD' } | undefined {
- if (typeof usd !== 'number' || !Number.isFinite(usd) || usd < 0) return undefined;
+function toMicros(
+ usd: number | undefined,
+): { amountMicros: number; currencyCode: 'USD' } | undefined {
+ if (typeof usd !== 'number' || !Number.isFinite(usd) || usd < 0)
+ return undefined;
return { amountMicros: Math.round(usd * 1_000_000), currencyCode: 'USD' };
}
-function buildApplicationNotes(input: SubmitPartnerApplicationInput): string | null {
- return isNonEmptyString(input.applicationNotes) ? input.applicationNotes.trim() : null;
+function buildApplicationNotes(
+ input: SubmitPartnerApplicationInput,
+): string | null {
+ return isNonEmptyString(input.applicationNotes)
+ ? input.applicationNotes.trim()
+ : null;
}
// Mirrors the subset of Partner{Create,Update}Input this handler writes. The
@@ -36,30 +43,43 @@ export type PartnerFieldsForUpsert = {
twentyExperienceProofLink?: { primaryLinkUrl: string };
};
-export function buildPartnerFields(input: SubmitPartnerApplicationInput): PartnerFieldsForUpsert {
+export function buildPartnerFields(
+ input: SubmitPartnerApplicationInput,
+): PartnerFieldsForUpsert {
const fields: PartnerFieldsForUpsert = {
name: input.companyName.trim(),
};
- if (isNonEmptyString(input.linkedin)) fields.linkedin = { primaryLinkUrl: input.linkedin.trim() };
- if (isNonEmptyString(input.domainName)) fields.website = { primaryLinkUrl: input.domainName.trim() };
+ if (isNonEmptyString(input.linkedin))
+ fields.linkedin = { primaryLinkUrl: input.linkedin.trim() };
+ if (isNonEmptyString(input.domainName))
+ fields.website = { primaryLinkUrl: input.domainName.trim() };
if (isNonEmptyString(input.city)) fields.city = input.city.trim();
// validate() has already checked these against the allowed value sets, so
// narrowing the validated strings to their enum types here is sound.
- if (input.country !== undefined) fields.country = input.country as CoreSchema.PartnerCountryEnum;
+ if (input.country !== undefined)
+ fields.country = input.country as CoreSchema.PartnerCountryEnum;
if (input.languages !== undefined && input.languages.length > 0)
- fields.languagesSpoken = input.languages as CoreSchema.PartnerLanguagesSpokenEnum[];
- if (input.typeOfTeam !== undefined) fields.typeOfTeam = input.typeOfTeam as CoreSchema.PartnerTypeOfTeamEnum;
+ fields.languagesSpoken =
+ input.languages as CoreSchema.PartnerLanguagesSpokenEnum[];
+ if (input.typeOfTeam !== undefined)
+ fields.typeOfTeam = input.typeOfTeam as CoreSchema.PartnerTypeOfTeamEnum;
if (input.partnerScope !== undefined && input.partnerScope.length > 0)
- fields.partnerScope = input.partnerScope as CoreSchema.PartnerPartnerScopeEnum[];
- if (input.skills !== undefined && input.skills.length > 0) fields.skills = input.skills.filter(isNonEmptyString);
+ fields.partnerScope =
+ input.partnerScope as CoreSchema.PartnerPartnerScopeEnum[];
+ if (input.skills !== undefined && input.skills.length > 0)
+ fields.skills = input.skills.filter(isNonEmptyString);
const hourly = toMicros(input.hourlyRate);
if (hourly) fields.hourlyRate = hourly;
const min = toMicros(input.projectBudgetMin);
if (min) fields.projectBudgetMin = min;
- if (isNonEmptyString(input.calendarLink)) fields.calendarLink = { primaryLinkUrl: input.calendarLink.trim() };
+ if (isNonEmptyString(input.calendarLink))
+ fields.calendarLink = { primaryLinkUrl: input.calendarLink.trim() };
const notes = buildApplicationNotes(input);
if (notes !== null) fields.applicationNotes = notes;
- if (input.twentyExperience !== undefined && input.twentyExperience.length > 0) {
+ if (
+ input.twentyExperience !== undefined &&
+ input.twentyExperience.length > 0
+ ) {
fields.twentyExperience =
input.twentyExperience as CoreSchema.PartnerTwentyExperienceEnum[];
}
@@ -87,7 +107,9 @@ export function buildPartnerCreateData(
superPartner: false,
partnerTier: 'NEW',
companyId,
- deploymentExpertise: deriveDeploymentExpertise(input.partnerScope) as CoreSchema.PartnerDeploymentExpertiseEnum[],
+ deploymentExpertise: deriveDeploymentExpertise(
+ input.partnerScope,
+ ) as CoreSchema.PartnerDeploymentExpertiseEnum[],
...(region ? { region: [region] as CoreSchema.PartnerRegionEnum[] } : {}),
};
}
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/how-to-review.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/how-to-review.navigation-menu-item.ts
index 1cbac6a3e9f..31c70d8e14c 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/how-to-review.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/how-to-review.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import {
HOW_TO_REVIEW_NAV_ITEM_ID,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/partner-applications.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/partner-applications.navigation-menu-item.ts
index d6c9af89931..2c8a8317f6f 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/partner-applications.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/navigation-menu-items/partner-applications.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { PARTNER_APPLICATIONS_NAV_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
import { PARTNER_APPLICATIONS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/partner/application-intake/views/partner-applications.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/views/partner-applications.view.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/views/partner-applications.view.ts
index b5d3d589666..5fd3f2cba88 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/views/partner-applications.view.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/application-intake/views/partner-applications.view.ts
@@ -50,13 +50,15 @@ export default defineView({
},
{
universalIdentifier: 'c145da29-b040-4070-a726-562460b315c3',
- fieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_COUNTRY_FIELD_UNIVERSAL_IDENTIFIER,
position: 1,
isVisible: true,
},
{
universalIdentifier: '88d68442-514d-43a5-b974-8aa22b65cac8',
- fieldMetadataUniversalIdentifier: PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
position: 2,
isVisible: true,
size: 200,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts
index ef4fb927f2c..8701ce72260 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/navigation-menu-items/super-partners.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { SUPER_PARTNERS_VIEW_UNIVERSAL_IDENTIFIER } from 'src/modules/partner/directory/views/super-partners.view';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts
index 136f96bf40a..b47eef3f707 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/partner-record-page-fields.view.ts
@@ -27,16 +27,10 @@ import {
PARTNER_WEBSITE_FIELD_UNIVERSAL_IDENTIFIER,
} from 'src/modules/partner/constants/partner-field-universal-identifiers';
import { PARTNER_OBJECT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import {
- PARTNER_CONTENTS_ON_PARTNER_FIELD_ID,
-} from 'src/modules/partner/fields/partner-content-partner.field';
+import { PARTNER_CONTENTS_ON_PARTNER_FIELD_ID } from 'src/modules/partner/fields/partner-content-partner.field';
import { PARTNER_COMPANY_FIELD_ID } from 'src/modules/partner/fields/partner-company.field';
-import {
- PARTNER_LINKS_ON_PARTNER_FIELD_ID,
-} from 'src/modules/partner/fields/partner-link-partner.field';
-import {
- PARTNER_SERVICES_ON_PARTNER_FIELD_ID,
-} from 'src/modules/partner/fields/partner-service-partner.field';
+import { PARTNER_LINKS_ON_PARTNER_FIELD_ID } from 'src/modules/partner/fields/partner-link-partner.field';
+import { PARTNER_SERVICES_ON_PARTNER_FIELD_ID } from 'src/modules/partner/fields/partner-service-partner.field';
import { PARTNER_USER_ON_PARTNER_FIELD_ID } from 'src/modules/partner/fields/partner-user-on-partner.field';
export const PARTNER_RECORD_PAGE_FIELDS_VIEW_ID =
@@ -91,7 +85,8 @@ export default defineView({
},
{
universalIdentifier: '2304f4b9-4faf-4813-8ef7-fb7697d64a92',
- fieldMetadataUniversalIdentifier: PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
position: 5,
isVisible: true,
},
@@ -118,7 +113,8 @@ export default defineView({
},
{
universalIdentifier: 'a0c47e12-6435-458a-b608-621bcee57474',
- fieldMetadataUniversalIdentifier: PARTNER_SKILLS_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_SKILLS_FIELD_UNIVERSAL_IDENTIFIER,
position: 9,
isVisible: true,
},
@@ -145,13 +141,15 @@ export default defineView({
},
{
universalIdentifier: 'a85dc9bc-a5f5-446e-a36c-492f1b6c0035',
- fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,
position: 13,
isVisible: true,
},
{
universalIdentifier: '90d11276-1666-4c36-9055-00c4680c3168',
- fieldMetadataUniversalIdentifier: PARTNER_COUNTRY_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_COUNTRY_FIELD_UNIVERSAL_IDENTIFIER,
position: 14,
isVisible: true,
},
@@ -177,13 +175,15 @@ export default defineView({
},
{
universalIdentifier: '5c8727a3-6e4b-41c7-adf9-530ab6599bf9',
- fieldMetadataUniversalIdentifier: PARTNER_LINKEDIN_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_LINKEDIN_FIELD_UNIVERSAL_IDENTIFIER,
position: 18,
isVisible: true,
},
{
universalIdentifier: 'a6ef3c3b-103b-41b7-ba85-9d93a9af3296',
- fieldMetadataUniversalIdentifier: PARTNER_WEBSITE_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_WEBSITE_FIELD_UNIVERSAL_IDENTIFIER,
position: 19,
isVisible: true,
},
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts
index cddb08fd19e..5a3cb70ba63 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/directory/views/super-partners.view.ts
@@ -52,14 +52,16 @@ export default defineView({
},
{
universalIdentifier: '83e5d3e6-38c3-4f56-adeb-2265ec61201f',
- fieldMetadataUniversalIdentifier: PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_SCOPE_FIELD_UNIVERSAL_IDENTIFIER,
position: 4,
isVisible: true,
size: 200,
},
{
universalIdentifier: '98de8562-2d00-4965-8963-872d4e5cdff9',
- fieldMetadataUniversalIdentifier: PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldMetadataUniversalIdentifier:
+ PARTNER_REGION_FIELD_UNIVERSAL_IDENTIFIER,
position: 5,
isVisible: true,
size: 200,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts
index 4d30c3d3b46..69b983a1d9c 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.test.ts
@@ -194,9 +194,9 @@ describe('mapPartnerForMarketplace', () => {
},
];
- expect(mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl).toBe(
- 'https://file.example.com/cover.png',
- );
+ expect(
+ mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl,
+ ).toBe('https://file.example.com/cover.png');
});
it('prefers the pasted coverImageUrl over the uploaded coverImage file in portfolio', () => {
@@ -217,9 +217,9 @@ describe('mapPartnerForMarketplace', () => {
},
];
- expect(mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl).toBe(
- 'https://paste.example.com/cover.png',
- );
+ expect(
+ mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl,
+ ).toBe('https://paste.example.com/cover.png');
});
it('falls back to the coverImage file url when coverImageUrl is absent', () => {
@@ -240,9 +240,9 @@ describe('mapPartnerForMarketplace', () => {
},
];
- expect(mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl).toBe(
- 'https://file.example.com/cover.png',
- );
+ expect(
+ mapPartnerForMarketplace(node, 'profile').portfolio[0].imageUrl,
+ ).toBe('https://file.example.com/cover.png');
});
it('sorts services by sortOrder ascending with nulls last', () => {
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts
index 872d5c09fe8..137bcfc1883 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/marketplace/mappers/map-partner-for-marketplace.mapper.ts
@@ -146,7 +146,9 @@ const sortBySortOrderAscNullsLast = <
return leftOrder - rightOrder;
});
-const sortByPositionAscNullsLast = <T extends { node: { position: number | null } }>(
+const sortByPositionAscNullsLast = <
+ T extends { node: { position: number | null } },
+>(
edges: ReadonlyArray<T>,
): T[] =>
[...edges].sort((left, right) => {
@@ -182,8 +184,9 @@ const dedupeUrls = (urls: ReadonlyArray<string | null>): string[] => {
};
const mapProfileLinks = (node: PartnerMarketplaceQueryNode): PrimaryLink[] => {
- const partnerLinkUrls = sortBySortOrderAscNullsLast(node.partnerLinks?.edges ?? [])
- .map((edge) => edge.node.url?.primaryLinkUrl ?? null);
+ const partnerLinkUrls = sortBySortOrderAscNullsLast(
+ node.partnerLinks?.edges ?? [],
+ ).map((edge) => edge.node.url?.primaryLinkUrl ?? null);
const legacyUrls = [
node.website?.primaryLinkUrl ?? null,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts
index 8cca386eea5..ee3265f17dc 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/objects/partner.object.ts
@@ -11,7 +11,8 @@ export default defineObject({
description: 'A certified implementation partner',
icon: 'IconBuildingStore',
isSearchable: true,
- labelIdentifierFieldMetadataUniversalIdentifier: 'a0000001-0000-4000-8000-000000000001',
+ labelIdentifierFieldMetadataUniversalIdentifier:
+ 'a0000001-0000-4000-8000-000000000001',
fields: [
{
universalIdentifier: 'a0000001-0000-4000-8000-000000000001',
@@ -37,11 +38,41 @@ export default defineObject({
icon: 'IconProgressCheck',
defaultValue: "'APPLICATION'",
options: [
- { id: '1b4f8b0b-68ec-4c02-a7e6-fbd0cda2f3b9', value: 'APPLICATION', label: 'Application', position: 0, color: 'gray' },
- { id: '901181af-b2cb-4052-9ac8-3c84281671f8', value: 'POTENTIAL', label: 'Potential partner', position: 1, color: 'blue' },
- { id: '3ebbc425-e5e3-412d-93df-5f70fefa1798', value: 'VALIDATED', label: 'Validated partner', position: 2, color: 'green' },
- { id: '3d0ec027-0d51-4df7-932e-13c60d4b4382', value: 'FORMER', label: 'Former partner', position: 3, color: 'orange' },
- { id: '19dc4929-735a-4b64-8f57-f34f3eaa3a73', value: 'REJECTED', label: 'Rejected', position: 4, color: 'red' },
+ {
+ id: '1b4f8b0b-68ec-4c02-a7e6-fbd0cda2f3b9',
+ value: 'APPLICATION',
+ label: 'Application',
+ position: 0,
+ color: 'gray',
+ },
+ {
+ id: '901181af-b2cb-4052-9ac8-3c84281671f8',
+ value: 'POTENTIAL',
+ label: 'Potential partner',
+ position: 1,
+ color: 'blue',
+ },
+ {
+ id: '3ebbc425-e5e3-412d-93df-5f70fefa1798',
+ value: 'VALIDATED',
+ label: 'Validated partner',
+ position: 2,
+ color: 'green',
+ },
+ {
+ id: '3d0ec027-0d51-4df7-932e-13c60d4b4382',
+ value: 'FORMER',
+ label: 'Former partner',
+ position: 3,
+ color: 'orange',
+ },
+ {
+ id: '19dc4929-735a-4b64-8f57-f34f3eaa3a73',
+ value: 'REJECTED',
+ label: 'Rejected',
+ position: 4,
+ color: 'red',
+ },
],
},
{
@@ -62,9 +93,27 @@ export default defineObject({
icon: 'IconMedal',
isNullable: true,
options: [
- { id: '63806cc0-02a8-4fe9-b2ba-0efe43a33109', value: 'NEW', label: 'New', position: 0, color: 'gray' },
- { id: '1ea6f5ba-6a4a-4e64-9b56-11e9ae56c97e', value: 'INTERMEDIATE', label: 'Intermediate', position: 1, color: 'blue' },
- { id: 'b44de8b4-caea-4ca6-94cd-fb67221b5fdb', value: 'ADVANCED', label: 'Advanced', position: 2, color: 'green' },
+ {
+ id: '63806cc0-02a8-4fe9-b2ba-0efe43a33109',
+ value: 'NEW',
+ label: 'New',
+ position: 0,
+ color: 'gray',
+ },
+ {
+ id: '1ea6f5ba-6a4a-4e64-9b56-11e9ae56c97e',
+ value: 'INTERMEDIATE',
+ label: 'Intermediate',
+ position: 1,
+ color: 'blue',
+ },
+ {
+ id: 'b44de8b4-caea-4ca6-94cd-fb67221b5fdb',
+ value: 'ADVANCED',
+ label: 'Advanced',
+ position: 2,
+ color: 'green',
+ },
],
},
{
@@ -75,11 +124,41 @@ export default defineObject({
icon: 'IconListCheck',
isNullable: true,
options: [
- { id: 'b1000001-0000-4000-8000-0000000000a1', value: 'ADVISORY', label: 'Advisory & Discovery', position: 0, color: 'blue' },
- { id: 'b1000002-0000-4000-8000-0000000000a2', value: 'SOLUTIONING', label: 'Solutioning', position: 1, color: 'green' },
- { id: 'b1000003-0000-4000-8000-0000000000a3', value: 'DEVELOPMENT', label: 'Custom Development', position: 2, color: 'turquoise' },
- { id: 'b1000004-0000-4000-8000-0000000000a4', value: 'HOSTING', label: 'Hosting & Infrastructure', position: 3, color: 'purple' },
- { id: 'b1000005-0000-4000-8000-0000000000a5', value: 'SUPPORT', label: 'Training & Adoption', position: 4, color: 'pink' },
+ {
+ id: 'b1000001-0000-4000-8000-0000000000a1',
+ value: 'ADVISORY',
+ label: 'Advisory & Discovery',
+ position: 0,
+ color: 'blue',
+ },
+ {
+ id: 'b1000002-0000-4000-8000-0000000000a2',
+ value: 'SOLUTIONING',
+ label: 'Solutioning',
+ position: 1,
+ color: 'green',
+ },
+ {
+ id: 'b1000003-0000-4000-8000-0000000000a3',
+ value: 'DEVELOPMENT',
+ label: 'Custom Development',
+ position: 2,
+ color: 'turquoise',
+ },
+ {
+ id: 'b1000004-0000-4000-8000-0000000000a4',
+ value: 'HOSTING',
+ label: 'Hosting & Infrastructure',
+ position: 3,
+ color: 'purple',
+ },
+ {
+ id: 'b1000005-0000-4000-8000-0000000000a5',
+ value: 'SUPPORT',
+ label: 'Training & Adoption',
+ position: 4,
+ color: 'pink',
+ },
],
},
{
@@ -90,8 +169,20 @@ export default defineObject({
icon: 'IconUsersGroup',
isNullable: true,
options: [
- { id: '0f59b781-5a81-4025-92ad-4b93b2c62df0', value: 'SOLO', label: 'Solo', position: 0, color: 'blue' },
- { id: 'db47bc44-93db-4cbf-8d0f-3057cf01d11e', value: 'AGENCY', label: 'Agency', position: 1, color: 'green' },
+ {
+ id: '0f59b781-5a81-4025-92ad-4b93b2c62df0',
+ value: 'SOLO',
+ label: 'Solo',
+ position: 0,
+ color: 'blue',
+ },
+ {
+ id: 'db47bc44-93db-4cbf-8d0f-3057cf01d11e',
+ value: 'AGENCY',
+ label: 'Agency',
+ position: 1,
+ color: 'green',
+ },
],
},
{
@@ -110,8 +201,20 @@ export default defineObject({
icon: 'IconCalendarCheck',
defaultValue: "'AVAILABLE'",
options: [
- { id: '639d74c3-5d38-407b-b0e4-81f3930db451', value: 'AVAILABLE', label: 'Available', position: 0, color: 'green' },
- { id: '6a921479-559a-4446-892a-d4a1b5a3abb4', value: 'UNAVAILABLE', label: 'Unavailable', position: 1, color: 'gray' },
+ {
+ id: '639d74c3-5d38-407b-b0e4-81f3930db451',
+ value: 'AVAILABLE',
+ label: 'Available',
+ position: 0,
+ color: 'green',
+ },
+ {
+ id: '6a921479-559a-4446-892a-d4a1b5a3abb4',
+ value: 'UNAVAILABLE',
+ label: 'Unavailable',
+ position: 1,
+ color: 'gray',
+ },
],
},
{
@@ -122,8 +225,20 @@ export default defineObject({
icon: 'IconCloud',
isNullable: true,
options: [
- { id: 'f2f53365-d909-4a97-bb81-efab43f0a17e', value: 'CLOUD', label: 'Cloud', position: 0, color: 'sky' },
- { id: '5e47226b-4e60-413f-80ee-b8f1d9ee6ad6', value: 'SELF_HOST', label: 'Self-host', position: 1, color: 'purple' },
+ {
+ id: 'f2f53365-d909-4a97-bb81-efab43f0a17e',
+ value: 'CLOUD',
+ label: 'Cloud',
+ position: 0,
+ color: 'sky',
+ },
+ {
+ id: '5e47226b-4e60-413f-80ee-b8f1d9ee6ad6',
+ value: 'SELF_HOST',
+ label: 'Self-host',
+ position: 1,
+ color: 'purple',
+ },
],
},
{
@@ -134,41 +249,251 @@ export default defineObject({
icon: 'IconLanguage',
isNullable: true,
options: [
- { id: '3fe94a92-5f64-46f4-8697-1a44e06e939f', value: 'ENGLISH', label: 'English', position: 0, color: 'blue' },
- { id: 'fdfe8adf-b2f1-4ef9-97c1-449302932698', value: 'FRENCH', label: 'French', position: 1, color: 'red' },
- { id: '820c120a-17ba-4e9a-8dd7-9724ac41d7ca', value: 'GERMAN', label: 'German', position: 2, color: 'yellow' },
- { id: '28171507-753d-4a8e-b9c2-44c698c2a26b', value: 'CHINESE', label: 'Chinese', position: 3, color: 'orange' },
- { id: 'd9111720-26c1-47c3-85bb-a30699737cce', value: 'SPANISH', label: 'Spanish', position: 4, color: 'green' },
- { id: '7dbfcb38-4255-4fe8-91dc-ce0686191521', value: 'ARABIC', label: 'Arabic', position: 5, color: 'sky' },
- { id: 'd4e0e54b-2c57-498a-9ccc-9cfe64f09a36', value: 'BENGALI', label: 'Bengali', position: 6, color: 'purple' },
- { id: '34e765d2-5b03-4a63-a6e6-6c3c75fd8d75', value: 'CATALAN', label: 'Catalan', position: 7, color: 'pink' },
- { id: 'b042b1d3-19d6-4094-b53e-85f9727360b1', value: 'CZECH', label: 'Czech', position: 8, color: 'turquoise' },
- { id: '0a8ebe74-dcfa-44f5-abde-1af3a8dd8879', value: 'DANISH', label: 'Danish', position: 9, color: 'gray' },
- { id: '385e0db5-ab16-4a59-94fd-98921fa367d5', value: 'DUTCH', label: 'Dutch', position: 10, color: 'blue' },
- { id: 'f8ec118f-6652-4fe4-a7dc-a77c079f473e', value: 'FARSI', label: 'Farsi', position: 11, color: 'red' },
- { id: 'cd58db19-6be6-4deb-8f1b-4cd9bdbcacdf', value: 'FINNISH', label: 'Finnish', position: 12, color: 'yellow' },
- { id: 'c20be129-8a93-479c-99f1-89dad2177c0a', value: 'GREEK', label: 'Greek', position: 13, color: 'orange' },
- { id: '7faaec05-22d1-4b37-a700-9dc4733effb6', value: 'HINDI', label: 'Hindi', position: 14, color: 'green' },
- { id: '3400d7db-312f-4d54-ac19-04a2f6fed6e0', value: 'INDONESIAN', label: 'Indonesian', position: 15, color: 'sky' },
- { id: 'd1eb3870-2938-4c87-9596-3980b31df293', value: 'ITALIAN', label: 'Italian', position: 16, color: 'purple' },
- { id: '7a854dd9-6c81-4d16-8b76-79b3571638ec', value: 'JAPANESE', label: 'Japanese', position: 17, color: 'pink' },
- { id: '51be3b14-195c-45e2-815e-a6591d0946b1', value: 'KOREAN', label: 'Korean', position: 18, color: 'turquoise' },
- { id: 'c31168a0-276c-45dc-bd39-a498d39a44d8', value: 'MALAY', label: 'Malay', position: 19, color: 'gray' },
- { id: '7719d197-9e91-41d3-a66f-728cfce32c33', value: 'NORWEGIAN', label: 'Norwegian', position: 20, color: 'blue' },
- { id: '115c5e11-2462-4371-92ca-c4835649de15', value: 'POLISH', label: 'Polish', position: 21, color: 'red' },
- { id: '018e3663-3de8-4110-aceb-48c8083ebb9a', value: 'PORTUGUESE', label: 'Portuguese', position: 22, color: 'yellow' },
- { id: 'ca97987f-4f43-43d0-b7a0-490bc566b42f', value: 'PUNJABI', label: 'Punjabi', position: 23, color: 'orange' },
- { id: '05215653-4d32-49e2-9ff3-73e66e14d97d', value: 'ROMANIAN', label: 'Romanian', position: 24, color: 'green' },
- { id: 'a14e341e-a266-407f-b4c7-936cfa608500', value: 'RUSSIAN', label: 'Russian', position: 25, color: 'sky' },
- { id: '1190a9eb-bd06-4d77-ab59-c619f4e2faa3', value: 'SWAHILI', label: 'Swahili', position: 26, color: 'purple' },
- { id: '0fedffb0-c0d7-47b7-ac5f-0b166d24d670', value: 'SWEDISH', label: 'Swedish', position: 27, color: 'pink' },
- { id: '8205bc44-b2a0-4211-9fe5-1bc64efaa844', value: 'TAGALOG', label: 'Tagalog', position: 28, color: 'turquoise' },
- { id: '866b6438-c172-4c72-b69e-b1ca89342526', value: 'TAMIL', label: 'Tamil', position: 29, color: 'gray' },
- { id: 'a2c4851b-302b-4420-aff2-6d7dc614fa6c', value: 'THAI', label: 'Thai', position: 30, color: 'blue' },
- { id: '0a5672dd-ebe5-48bc-b8ab-7d2bf6a605e2', value: 'TURKISH', label: 'Turkish', position: 31, color: 'red' },
- { id: '36324fb0-5ea2-4e9f-845c-ac65b977ab20', value: 'UKRAINIAN', label: 'Ukrainian', position: 32, color: 'yellow' },
- { id: 'b1aad243-fc85-4df3-a83e-07796ae01d6c', value: 'URDU', label: 'Urdu', position: 33, color: 'orange' },
- { id: '922895f8-3a8a-45b8-a70e-0ae7b0c8ff32', value: 'VIETNAMESE', label: 'Vietnamese', position: 34, color: 'green' },
+ {
+ id: '3fe94a92-5f64-46f4-8697-1a44e06e939f',
+ value: 'ENGLISH',
+ label: 'English',
+ position: 0,
+ color: 'blue',
+ },
+ {
+ id: 'fdfe8adf-b2f1-4ef9-97c1-449302932698',
+ value: 'FRENCH',
+ label: 'French',
+ position: 1,
+ color: 'red',
+ },
+ {
+ id: '820c120a-17ba-4e9a-8dd7-9724ac41d7ca',
+ value: 'GERMAN',
+ label: 'German',
+ position: 2,
+ color: 'yellow',
+ },
+ {
+ id: '28171507-753d-4a8e-b9c2-44c698c2a26b',
+ value: 'CHINESE',
+ label: 'Chinese',
+ position: 3,
+ color: 'orange',
+ },
+ {
+ id: 'd9111720-26c1-47c3-85bb-a30699737cce',
+ value: 'SPANISH',
+ label: 'Spanish',
+ position: 4,
+ color: 'green',
+ },
+ {
+ id: '7dbfcb38-4255-4fe8-91dc-ce0686191521',
+ value: 'ARABIC',
+ label: 'Arabic',
+ position: 5,
+ color: 'sky',
+ },
+ {
+ id: 'd4e0e54b-2c57-498a-9ccc-9cfe64f09a36',
+ value: 'BENGALI',
+ label: 'Bengali',
+ position: 6,
+ color: 'purple',
+ },
+ {
+ id: '34e765d2-5b03-4a63-a6e6-6c3c75fd8d75',
+ value: 'CATALAN',
+ label: 'Catalan',
+ position: 7,
+ color: 'pink',
+ },
+ {
+ id: 'b042b1d3-19d6-4094-b53e-85f9727360b1',
+ value: 'CZECH',
+ label: 'Czech',
+ position: 8,
+ color: 'turquoise',
+ },
+ {
+ id: '0a8ebe74-dcfa-44f5-abde-1af3a8dd8879',
+ value: 'DANISH',
+ label: 'Danish',
+ position: 9,
+ color: 'gray',
+ },
+ {
+ id: '385e0db5-ab16-4a59-94fd-98921fa367d5',
+ value: 'DUTCH',
+ label: 'Dutch',
+ position: 10,
+ color: 'blue',
+ },
+ {
+ id: 'f8ec118f-6652-4fe4-a7dc-a77c079f473e',
+ value: 'FARSI',
+ label: 'Farsi',
+ position: 11,
+ color: 'red',
+ },
+ {
+ id: 'cd58db19-6be6-4deb-8f1b-4cd9bdbcacdf',
+ value: 'FINNISH',
+ label: 'Finnish',
+ position: 12,
+ color: 'yellow',
+ },
+ {
+ id: 'c20be129-8a93-479c-99f1-89dad2177c0a',
+ value: 'GREEK',
+ label: 'Greek',
+ position: 13,
+ color: 'orange',
+ },
+ {
+ id: '7faaec05-22d1-4b37-a700-9dc4733effb6',
+ value: 'HINDI',
+ label: 'Hindi',
+ position: 14,
+ color: 'green',
+ },
+ {
+ id: '3400d7db-312f-4d54-ac19-04a2f6fed6e0',
+ value: 'INDONESIAN',
+ label: 'Indonesian',
+ position: 15,
+ color: 'sky',
+ },
+ {
+ id: 'd1eb3870-2938-4c87-9596-3980b31df293',
+ value: 'ITALIAN',
+ label: 'Italian',
+ position: 16,
+ color: 'purple',
+ },
+ {
+ id: '7a854dd9-6c81-4d16-8b76-79b3571638ec',
+ value: 'JAPANESE',
+ label: 'Japanese',
+ position: 17,
+ color: 'pink',
+ },
+ {
+ id: '51be3b14-195c-45e2-815e-a6591d0946b1',
+ value: 'KOREAN',
+ label: 'Korean',
+ position: 18,
+ color: 'turquoise',
+ },
+ {
+ id: 'c31168a0-276c-45dc-bd39-a498d39a44d8',
+ value: 'MALAY',
+ label: 'Malay',
+ position: 19,
+ color: 'gray',
+ },
+ {
+ id: '7719d197-9e91-41d3-a66f-728cfce32c33',
+ value: 'NORWEGIAN',
+ label: 'Norwegian',
+ position: 20,
+ color: 'blue',
+ },
+ {
+ id: '115c5e11-2462-4371-92ca-c4835649de15',
+ value: 'POLISH',
+ label: 'Polish',
+ position: 21,
+ color: 'red',
+ },
+ {
+ id: '018e3663-3de8-4110-aceb-48c8083ebb9a',
+ value: 'PORTUGUESE',
+ label: 'Portuguese',
+ position: 22,
+ color: 'yellow',
+ },
+ {
+ id: 'ca97987f-4f43-43d0-b7a0-490bc566b42f',
+ value: 'PUNJABI',
+ label: 'Punjabi',
+ position: 23,
+ color: 'orange',
+ },
+ {
+ id: '05215653-4d32-49e2-9ff3-73e66e14d97d',
+ value: 'ROMANIAN',
+ label: 'Romanian',
+ position: 24,
+ color: 'green',
+ },
+ {
+ id: 'a14e341e-a266-407f-b4c7-936cfa608500',
+ value: 'RUSSIAN',
+ label: 'Russian',
+ position: 25,
+ color: 'sky',
+ },
+ {
+ id: '1190a9eb-bd06-4d77-ab59-c619f4e2faa3',
+ value: 'SWAHILI',
+ label: 'Swahili',
+ position: 26,
+ color: 'purple',
+ },
+ {
+ id: '0fedffb0-c0d7-47b7-ac5f-0b166d24d670',
+ value: 'SWEDISH',
+ label: 'Swedish',
+ position: 27,
+ color: 'pink',
+ },
+ {
+ id: '8205bc44-b2a0-4211-9fe5-1bc64efaa844',
+ value: 'TAGALOG',
+ label: 'Tagalog',
+ position: 28,
+ color: 'turquoise',
+ },
+ {
+ id: '866b6438-c172-4c72-b69e-b1ca89342526',
+ value: 'TAMIL',
+ label: 'Tamil',
+ position: 29,
+ color: 'gray',
+ },
+ {
+ id: 'a2c4851b-302b-4420-aff2-6d7dc614fa6c',
+ value: 'THAI',
+ label: 'Thai',
+ position: 30,
+ color: 'blue',
+ },
+ {
+ id: '0a5672dd-ebe5-48bc-b8ab-7d2bf6a605e2',
+ value: 'TURKISH',
+ label: 'Turkish',
+ position: 31,
+ color: 'red',
+ },
+ {
+ id: '36324fb0-5ea2-4e9f-845c-ac65b977ab20',
+ value: 'UKRAINIAN',
+ label: 'Ukrainian',
+ position: 32,
+ color: 'yellow',
+ },
+ {
+ id: 'b1aad243-fc85-4df3-a83e-07796ae01d6c',
+ value: 'URDU',
+ label: 'Urdu',
+ position: 33,
+ color: 'orange',
+ },
+ {
+ id: '922895f8-3a8a-45b8-a70e-0ae7b0c8ff32',
+ value: 'VIETNAMESE',
+ label: 'Vietnamese',
+ position: 34,
+ color: 'green',
+ },
],
},
{
@@ -187,219 +512,1437 @@ export default defineObject({
icon: 'IconFlag',
isNullable: true,
options: [
- { id: '03332728-50b1-49ec-bdec-a938cb97ca74', value: 'AFGHANISTAN', label: 'Afghanistan 🇦🇫', position: 0, color: 'blue' },
- { id: 'c39c7baa-6f52-4349-bc28-97b59f2a9a3a', value: 'ALBANIA', label: 'Albania 🇦🇱', position: 1, color: 'turquoise' },
- { id: '1bce0427-d693-451a-9a6b-a50c0c502c85', value: 'ALGERIA', label: 'Algeria 🇩🇿', position: 2, color: 'green' },
- { id: '634fb580-4f12-4a5b-b43c-5787330d4b60', value: 'ANDORRA', label: 'Andorra 🇦🇩', position: 3, color: 'sky' },
- { id: '545797b9-16df-40d5-ab9b-037d3d875263', value: 'ANGOLA', label: 'Angola 🇦🇴', position: 4, color: 'purple' },
- { id: '83b58c61-8b0d-42e1-9d4f-9a530ace7899', value: 'ANTIGUA_AND_BARBUDA', label: 'Antigua & Barbuda 🇦🇬', position: 5, color: 'orange' },
- { id: '58fd4e0d-b48d-4b22-81d8-de6db6bd22ed', value: 'ARGENTINA', label: 'Argentina 🇦🇷', position: 6, color: 'yellow' },
- { id: '7091a2e3-2095-4693-bd53-366df4ba5c75', value: 'ARMENIA', label: 'Armenia 🇦🇲', position: 7, color: 'red' },
- { id: '479725e7-f185-46c6-9e8b-605fbbb392f8', value: 'AUSTRALIA', label: 'Australia 🇦🇺', position: 8, color: 'pink' },
- { id: 'b7993e1b-5f7d-47b9-a84d-41795160393a', value: 'AUSTRIA', label: 'Austria 🇦🇹', position: 9, color: 'gray' },
- { id: 'e2d324df-2baa-49a2-a016-2c7cab0d0e95', value: 'AZERBAIJAN', label: 'Azerbaijan 🇦🇿', position: 10, color: 'blue' },
- { id: '87dc4b54-c4f7-4813-a0e4-d2214e659a77', value: 'BAHAMAS', label: 'Bahamas 🇧🇸', position: 11, color: 'turquoise' },
- { id: '32149c4f-3319-42a6-a0ca-6afb42bdf3b9', value: 'BAHRAIN', label: 'Bahrain 🇧🇭', position: 12, color: 'green' },
- { id: 'c74d1f90-e17f-4e9a-9341-5c6ffda2d3ac', value: 'BANGLADESH', label: 'Bangladesh 🇧🇩', position: 13, color: 'sky' },
- { id: '61c2e8c4-06af-4daa-ac52-34f4b47e2aad', value: 'BARBADOS', label: 'Barbados 🇧🇧', position: 14, color: 'purple' },
- { id: '1c7dfa46-72e0-4ba3-8af5-3b2d1d46fd4b', value: 'BELARUS', label: 'Belarus 🇧🇾', position: 15, color: 'orange' },
- { id: '771258e5-b16f-47d4-aaed-47a4c931b72d', value: 'BELGIUM', label: 'Belgium 🇧🇪', position: 16, color: 'yellow' },
- { id: 'f3910b68-3f3f-4afb-9f90-5561376e5098', value: 'BELIZE', label: 'Belize 🇧🇿', position: 17, color: 'red' },
- { id: 'b06f1bc7-2058-44fc-b868-631559de7d11', value: 'BENIN', label: 'Benin 🇧🇯', position: 18, color: 'pink' },
- { id: 'acff20b8-b865-47de-9049-c660866f5218', value: 'BHUTAN', label: 'Bhutan 🇧🇹', position: 19, color: 'gray' },
- { id: 'bee20647-c283-40af-9733-37753e42b464', value: 'BOLIVIA', label: 'Bolivia 🇧🇴', position: 20, color: 'blue' },
- { id: '4dd91769-c713-47af-bf48-aed0251115b1', value: 'BOSNIA_AND_HERZEGOVINA', label: 'Bosnia & Herzegovina 🇧🇦', position: 21, color: 'turquoise' },
- { id: 'a6997427-007f-42b4-b6ea-892f7ce58dff', value: 'BOTSWANA', label: 'Botswana 🇧🇼', position: 22, color: 'green' },
- { id: '3ff1f170-d3f0-4ce6-9490-bfc20aadf470', value: 'BRAZIL', label: 'Brazil 🇧🇷', position: 23, color: 'sky' },
- { id: '7b2d6911-4676-433d-93f1-6eca2530d89d', value: 'BRUNEI', label: 'Brunei 🇧🇳', position: 24, color: 'purple' },
- { id: '767c72f3-f951-4b00-958d-856d2a8bda7a', value: 'BULGARIA', label: 'Bulgaria 🇧🇬', position: 25, color: 'orange' },
- { id: 'e16ce6af-86b0-4448-8008-c5efa2ce3fe9', value: 'BURKINA_FASO', label: 'Burkina Faso 🇧🇫', position: 26, color: 'yellow' },
- { id: 'dd7e7b2a-8367-482d-99d4-7877d883c2e3', value: 'BURUNDI', label: 'Burundi 🇧🇮', position: 27, color: 'red' },
- { id: 'd9d6eea9-7724-4c65-be48-e861075121f1', value: 'CAMBODIA', label: 'Cambodia 🇰🇭', position: 28, color: 'pink' },
- { id: '49178472-0bdd-4797-be6c-e0a1ac6e4147', value: 'CAMEROON', label: 'Cameroon 🇨🇲', position: 29, color: 'gray' },
- { id: '849b6361-a83b-48fb-a3e5-2ac6e9089c7f', value: 'CANADA', label: 'Canada 🇨🇦', position: 30, color: 'blue' },
- { id: 'ca22a230-01b1-4099-b7c2-29fd3b8d09de', value: 'CAPE_VERDE', label: 'Cape Verde 🇨🇻', position: 31, color: 'turquoise' },
- { id: '360bef1e-34a9-4467-9ffe-5ebeb6427711', value: 'CENTRAL_AFRICAN_REPUBLIC', label: 'Central African Republic 🇨🇫', position: 32, color: 'green' },
- { id: 'deba0ee2-3027-4646-afc6-24410bf68198', value: 'CHAD', label: 'Chad 🇹🇩', position: 33, color: 'sky' },
- { id: 'd0bf04d5-a40c-45f0-8e82-4d5905c00131', value: 'CHILE', label: 'Chile 🇨🇱', position: 34, color: 'purple' },
- { id: '60522b37-dded-4f18-a25b-05b51a8c9aa7', value: 'CHINA', label: 'China 🇨🇳', position: 35, color: 'orange' },
- { id: '3b2c58f1-4efc-4c0f-9d43-f3a5b5b577cf', value: 'COLOMBIA', label: 'Colombia 🇨🇴', position: 36, color: 'yellow' },
- { id: 'cbea73ba-8a9d-47ee-a38b-b7c3d89d3922', value: 'COMOROS', label: 'Comoros 🇰🇲', position: 37, color: 'red' },
- { id: '895ed0d4-6a00-482a-840e-44edef034d2b', value: 'CONGO', label: 'Congo 🇨🇬', position: 38, color: 'pink' },
- { id: '13db3209-398c-474c-b5f9-269ccf27adc5', value: 'DR_CONGO', label: 'DR Congo 🇨🇩', position: 39, color: 'gray' },
- { id: '150c4227-ce67-420b-bb6c-82d5a4fb9c70', value: 'COSTA_RICA', label: 'Costa Rica 🇨🇷', position: 40, color: 'blue' },
- { id: 'ad1853e2-753d-4245-b9a7-88a29281ca0a', value: 'CROATIA', label: 'Croatia 🇭🇷', position: 41, color: 'turquoise' },
- { id: 'e42cad17-f7ea-450b-8c7f-a0ac0dc31dac', value: 'CUBA', label: 'Cuba 🇨🇺', position: 42, color: 'green' },
- { id: '9035a680-5962-48c3-8d79-ee805a2c8b1c', value: 'CYPRUS', label: 'Cyprus 🇨🇾', position: 43, color: 'sky' },
- { id: 'facb14c9-40e9-47f6-bc4b-b29178761210', value: 'CZECH_REPUBLIC', label: 'Czech Republic 🇨🇿', position: 44, color: 'purple' },
- { id: '47026695-ee4b-47f2-97c1-9d1ea9854cd5', value: 'DENMARK', label: 'Denmark 🇩🇰', position: 45, color: 'orange' },
- { id: '335e3877-1f8b-4f2b-a409-ec74596dd779', value: 'DJIBOUTI', label: 'Djibouti 🇩🇯', position: 46, color: 'yellow' },
- { id: 'ee17957f-f692-495b-a664-61284fa723f2', value: 'DOMINICA', label: 'Dominica 🇩🇲', position: 47, color: 'red' },
- { id: '4114c313-27d7-4f5a-a381-38daca143642', value: 'DOMINICAN_REPUBLIC', label: 'Dominican Republic 🇩🇴', position: 48, color: 'pink' },
- { id: 'ffcfae44-e1b7-4739-87dd-0d957062646d', value: 'ECUADOR', label: 'Ecuador 🇪🇨', position: 49, color: 'gray' },
- { id: '1f4e8ee4-3be1-42cd-96d4-3e5686dee153', value: 'EGYPT', label: 'Egypt 🇪🇬', position: 50, color: 'blue' },
- { id: 'cf98813f-2a7e-4426-b97f-d3f1ac044bb8', value: 'EL_SALVADOR', label: 'El Salvador 🇸🇻', position: 51, color: 'turquoise' },
- { id: '0e787d6e-e864-4ee3-b4c7-20fa873e8649', value: 'EQUATORIAL_GUINEA', label: 'Equatorial Guinea 🇬🇶', position: 52, color: 'green' },
- { id: 'f68b6554-4ed5-4161-933f-a321b41391ea', value: 'ERITREA', label: 'Eritrea 🇪🇷', position: 53, color: 'sky' },
- { id: '7a4387dc-198c-46db-9536-7bc73de4e1b0', value: 'ESTONIA', label: 'Estonia 🇪🇪', position: 54, color: 'purple' },
- { id: '7e0fec86-e04f-499c-a814-72ac9b4cc5ce', value: 'ESWATINI', label: 'Eswatini 🇸🇿', position: 55, color: 'orange' },
- { id: 'a7768d57-5bf2-401e-a82d-ec36e3f3a419', value: 'ETHIOPIA', label: 'Ethiopia 🇪🇹', position: 56, color: 'yellow' },
- { id: '1b9e15c3-4fa5-4cd8-9bfb-8262518665fa', value: 'FIJI', label: 'Fiji 🇫🇯', position: 57, color: 'red' },
- { id: '828a6fe2-3c50-4da3-97c9-11f3b80fbb0d', value: 'FINLAND', label: 'Finland 🇫🇮', position: 58, color: 'pink' },
- { id: '03a1c597-65cf-440f-a20d-9d6bef0540c2', value: 'FRANCE', label: 'France 🇫🇷', position: 59, color: 'gray' },
- { id: 'ab2edd1f-6353-4de8-863f-4b28e774be8e', value: 'GABON', label: 'Gabon 🇬🇦', position: 60, color: 'blue' },
- { id: '12a50b82-c2f8-4d0b-b5f4-e52dfe01ba13', value: 'GAMBIA', label: 'Gambia 🇬🇲', position: 61, color: 'turquoise' },
- { id: '2adf673e-8367-4eaf-83f0-41199718f0ee', value: 'GEORGIA', label: 'Georgia 🇬🇪', position: 62, color: 'green' },
- { id: 'bd61021e-c25b-453e-b0cc-afb3942b063f', value: 'GERMANY', label: 'Germany 🇩🇪', position: 63, color: 'sky' },
- { id: '1c45b7ae-9489-4714-b21e-8c717e6599ab', value: 'GHANA', label: 'Ghana 🇬🇭', position: 64, color: 'purple' },
- { id: 'cc47d864-cd78-4cdd-a711-d679f0cbc133', value: 'GREECE', label: 'Greece 🇬🇷', position: 65, color: 'orange' },
- { id: '2a2c3ca6-611e-49a4-9639-e8f60172c1b3', value: 'GRENADA', label: 'Grenada 🇬🇩', position: 66, color: 'yellow' },
- { id: 'da2024e5-a1a0-49ab-8cf0-0d9e3f10ff9d', value: 'GUATEMALA', label: 'Guatemala 🇬🇹', position: 67, color: 'red' },
- { id: '086c9969-1911-4aa4-8d67-3abdc12b2ce7', value: 'GUINEA', label: 'Guinea 🇬🇳', position: 68, color: 'pink' },
- { id: 'a648d1d3-4d3f-4fc6-a1ea-40f98283df75', value: 'GUINEA_BISSAU', label: 'Guinea-Bissau 🇬🇼', position: 69, color: 'gray' },
- { id: 'b567e119-4dcb-4f8a-b012-febe72262d85', value: 'GUYANA', label: 'Guyana 🇬🇾', position: 70, color: 'blue' },
- { id: '26801d38-c0e6-468a-8c78-a0aed06c16fd', value: 'HAITI', label: 'Haiti 🇭🇹', position: 71, color: 'turquoise' },
- { id: '2e31c5ff-da0a-4c82-b7bc-7a8c18b54f1e', value: 'HONDURAS', label: 'Honduras 🇭🇳', position: 72, color: 'green' },
- { id: 'a78bd322-ac40-4ab3-a46f-6204e42b0712', value: 'HUNGARY', label: 'Hungary 🇭🇺', position: 73, color: 'sky' },
- { id: '0026e951-225d-4e8c-8e64-289ead339bd3', value: 'ICELAND', label: 'Iceland 🇮🇸', position: 74, color: 'purple' },
- { id: 'f5101d7d-9b81-4d2e-a9aa-e20dfab52c58', value: 'INDIA', label: 'India 🇮🇳', position: 75, color: 'orange' },
- { id: '11b30046-58f3-42e5-a3e2-5d4761675056', value: 'INDONESIA', label: 'Indonesia 🇮🇩', position: 76, color: 'yellow' },
- { id: '7345db23-db33-45cb-b8cc-e4d4a1f1b90e', value: 'IRAN', label: 'Iran 🇮🇷', position: 77, color: 'red' },
- { id: '899d0eb1-9f04-4a88-b7f3-351e998b5979', value: 'IRAQ', label: 'Iraq 🇮🇶', position: 78, color: 'pink' },
- { id: 'e45e8143-14c1-4184-84db-c11212cb8e25', value: 'IRELAND', label: 'Ireland 🇮🇪', position: 79, color: 'gray' },
- { id: 'a208dac3-455e-41ed-9db0-aa7352d420ab', value: 'ISRAEL', label: 'Israel 🇮🇱', position: 80, color: 'blue' },
- { id: '4537862d-0565-47a0-8759-ef522996881f', value: 'ITALY', label: 'Italy 🇮🇹', position: 81, color: 'turquoise' },
- { id: '988630a1-dd19-476b-a0dc-cf8904ec5f68', value: 'IVORY_COAST', label: 'Ivory Coast 🇨🇮', position: 82, color: 'green' },
- { id: '30c755e0-61f2-4590-9969-f3150c3b5aff', value: 'JAMAICA', label: 'Jamaica 🇯🇲', position: 83, color: 'sky' },
- { id: '9ca39ab6-e0fb-4bbb-80bc-cbffa48682da', value: 'JAPAN', label: 'Japan 🇯🇵', position: 84, color: 'purple' },
- { id: 'f71aefd9-1dc0-4370-8a31-2a329d8ab15d', value: 'JORDAN', label: 'Jordan 🇯🇴', position: 85, color: 'orange' },
- { id: '7f230c15-2745-4e78-ab35-8ae5bec7bcc6', value: 'KAZAKHSTAN', label: 'Kazakhstan 🇰🇿', position: 86, color: 'yellow' },
- { id: '9e745903-4ac7-432f-bfd2-d0d78e76f3e9', value: 'KENYA', label: 'Kenya 🇰🇪', position: 87, color: 'red' },
- { id: 'ee448c0f-8b3b-4666-bbbb-19e8b62ecbcc', value: 'KIRIBATI', label: 'Kiribati 🇰🇮', position: 88, color: 'pink' },
- { id: '6de78d0a-7a2b-48bb-97b5-2a86c8bab3b6', value: 'KOSOVO', label: 'Kosovo 🇽🇰', position: 89, color: 'gray' },
- { id: '48e160eb-1fdf-4456-99f7-4e97e7d16cfa', value: 'KUWAIT', label: 'Kuwait 🇰🇼', position: 90, color: 'blue' },
- { id: '7d318293-6378-4a02-af49-23d48d887a8f', value: 'KYRGYZSTAN', label: 'Kyrgyzstan 🇰🇬', position: 91, color: 'turquoise' },
- { id: 'dc540210-83bb-40c5-ab0d-585f4648df1b', value: 'LAOS', label: 'Laos 🇱🇦', position: 92, color: 'green' },
- { id: 'fe2c5828-330f-45b8-991c-180723d5bed6', value: 'LATVIA', label: 'Latvia 🇱🇻', position: 93, color: 'sky' },
- { id: 'cff1390a-7548-401b-bfa1-5e062e1e2cd3', value: 'LEBANON', label: 'Lebanon 🇱🇧', position: 94, color: 'purple' },
- { id: '2a1d40fd-a633-4bb0-890a-1009a2126ff9', value: 'LESOTHO', label: 'Lesotho 🇱🇸', position: 95, color: 'orange' },
- { id: 'dee0303d-11c9-4bf9-913b-c5fedfc93766', value: 'LIBERIA', label: 'Liberia 🇱🇷', position: 96, color: 'yellow' },
- { id: '57713732-bd4e-4888-a4e3-ad7761e76dd9', value: 'LIBYA', label: 'Libya 🇱🇾', position: 97, color: 'red' },
- { id: '5ed4e5fd-31dc-4adc-a875-b5036ef5eac6', value: 'LIECHTENSTEIN', label: 'Liechtenstein 🇱🇮', position: 98, color: 'pink' },
- { id: '8facad69-2b22-47a4-a324-75773bd7d4f8', value: 'LITHUANIA', label: 'Lithuania 🇱🇹', position: 99, color: 'gray' },
- { id: 'fb1b4543-7f22-4c44-a953-7c68e2790e27', value: 'LUXEMBOURG', label: 'Luxembourg 🇱🇺', position: 100, color: 'blue' },
- { id: '80009115-d98c-4e63-8401-285f82d94921', value: 'MADAGASCAR', label: 'Madagascar 🇲🇬', position: 101, color: 'turquoise' },
- { id: 'b32ed1f2-3d12-4255-a39a-3a5ab64b425c', value: 'MALAWI', label: 'Malawi 🇲🇼', position: 102, color: 'green' },
- { id: 'd7c744b0-23d2-4dd4-a9f9-3298cfce0d1b', value: 'MALAYSIA', label: 'Malaysia 🇲🇾', position: 103, color: 'sky' },
- { id: 'a878865c-a73f-47d7-bf52-29c1b7b947d7', value: 'MALDIVES', label: 'Maldives 🇲🇻', position: 104, color: 'purple' },
- { id: '2d5e9644-11b6-4b55-8f9a-ed33da2de6ac', value: 'MALI', label: 'Mali 🇲🇱', position: 105, color: 'orange' },
- { id: 'e2fa091a-0e78-41da-937b-42b55e501226', value: 'MALTA', label: 'Malta 🇲🇹', position: 106, color: 'yellow' },
- { id: 'e36301e0-1d79-4540-87c7-4de2bfeface6', value: 'MARSHALL_ISLANDS', label: 'Marshall Islands 🇲🇭', position: 107, color: 'red' },
- { id: '8dc782e6-3578-4d7a-a6ba-a29e48f3cc11', value: 'MAURITANIA', label: 'Mauritania 🇲🇷', position: 108, color: 'pink' },
- { id: 'edf63c87-d621-40fe-b653-a0f7764c8961', value: 'MAURITIUS', label: 'Mauritius 🇲🇺', position: 109, color: 'gray' },
- { id: '86233df1-6c71-4ffb-9298-c61c65dcc79c', value: 'MEXICO', label: 'Mexico 🇲🇽', position: 110, color: 'blue' },
- { id: 'c41c35ff-118b-4119-b12f-93be635fbae3', value: 'MICRONESIA', label: 'Micronesia 🇫🇲', position: 111, color: 'turquoise' },
- { id: '8466a06e-a34f-4dd4-b660-8e9ad2aa5998', value: 'MOLDOVA', label: 'Moldova 🇲🇩', position: 112, color: 'green' },
- { id: '948e9117-486d-40c1-847c-de6cc64b9730', value: 'MONACO', label: 'Monaco 🇲🇨', position: 113, color: 'sky' },
- { id: 'ee33ddb8-3219-4fdb-8a71-8a6f8fdf93d3', value: 'MONGOLIA', label: 'Mongolia 🇲🇳', position: 114, color: 'purple' },
- { id: 'b5c1fa55-0b1a-43d8-a871-ebd004952d0b', value: 'MONTENEGRO', label: 'Montenegro 🇲🇪', position: 115, color: 'orange' },
- { id: '9e98cb68-666e-4116-b35f-bb9711fd7546', value: 'MOROCCO', label: 'Morocco 🇲🇦', position: 116, color: 'yellow' },
- { id: '86c4b5f8-d4bc-4639-a5bf-00a84601b911', value: 'MOZAMBIQUE', label: 'Mozambique 🇲🇿', position: 117, color: 'red' },
- { id: '8b3bcfa4-1797-492e-83d7-7d939e479b1d', value: 'MYANMAR', label: 'Myanmar 🇲🇲', position: 118, color: 'pink' },
- { id: 'b8d01fef-4061-4e8c-bc38-f8226b4be6be', value: 'NAMIBIA', label: 'Namibia 🇳🇦', position: 119, color: 'gray' },
- { id: '71dd1ad1-af94-4cfb-973d-33f87b4ef0cd', value: 'NAURU', label: 'Nauru 🇳🇷', position: 120, color: 'blue' },
- { id: 'dc692171-3adc-4a73-8b45-a25cf659c546', value: 'NEPAL', label: 'Nepal 🇳🇵', position: 121, color: 'turquoise' },
- { id: '3e161b4b-be95-4a6a-910d-628ad32691e1', value: 'NETHERLANDS', label: 'Netherlands 🇳🇱', position: 122, color: 'green' },
- { id: 'b86be59e-a1ae-4df4-937f-ad97c641e0df', value: 'NEW_ZEALAND', label: 'New Zealand 🇳🇿', position: 123, color: 'sky' },
- { id: '4674abdd-0548-4317-8af5-865e4d11327d', value: 'NICARAGUA', label: 'Nicaragua 🇳🇮', position: 124, color: 'purple' },
- { id: '85ff2ce7-ddd8-4be6-b740-d79e70a3d103', value: 'NIGER', label: 'Niger 🇳🇪', position: 125, color: 'orange' },
- { id: 'a69ab8cf-5a59-4879-92da-7cd2dea6b9e6', value: 'NIGERIA', label: 'Nigeria 🇳🇬', position: 126, color: 'yellow' },
- { id: '28736977-b21f-4678-8e22-363be28a8e94', value: 'NORTH_KOREA', label: 'North Korea 🇰🇵', position: 127, color: 'red' },
- { id: '11f87414-633d-48f8-a99d-0b407c281dbd', value: 'NORTH_MACEDONIA', label: 'North Macedonia 🇲🇰', position: 128, color: 'pink' },
- { id: '9637c5aa-d405-4414-a56b-b983ed0bfa51', value: 'NORWAY', label: 'Norway 🇳🇴', position: 129, color: 'gray' },
- { id: '70f79652-7f95-4836-ab2d-4373631910ec', value: 'OMAN', label: 'Oman 🇴🇲', position: 130, color: 'blue' },
- { id: '50e4ae80-79d8-4cdf-aa0a-a2675e6e26fb', value: 'PAKISTAN', label: 'Pakistan 🇵🇰', position: 131, color: 'turquoise' },
- { id: '08d27180-4861-4937-b04e-6cbcd33f507d', value: 'PALAU', label: 'Palau 🇵🇼', position: 132, color: 'green' },
- { id: '6aa50196-ea4b-42cd-b890-8d7d56cc9731', value: 'PALESTINE', label: 'Palestine 🇵🇸', position: 133, color: 'sky' },
- { id: '5663124d-f2fc-4374-8734-f3c53f9ea4f5', value: 'PANAMA', label: 'Panama 🇵🇦', position: 134, color: 'purple' },
- { id: '8bde7cc7-fa6c-4f52-b9df-16c99928f50f', value: 'PAPUA_NEW_GUINEA', label: 'Papua New Guinea 🇵🇬', position: 135, color: 'orange' },
- { id: '3eed4b21-1009-4dd2-bdac-53b11df8400c', value: 'PARAGUAY', label: 'Paraguay 🇵🇾', position: 136, color: 'yellow' },
- { id: 'fbc734c9-63ae-4d2e-af0f-8e2abd874dda', value: 'PERU', label: 'Peru 🇵🇪', position: 137, color: 'red' },
- { id: '211555bc-8f26-4d4d-94f1-c83884c32e20', value: 'PHILIPPINES', label: 'Philippines 🇵🇭', position: 138, color: 'pink' },
- { id: '6d69e1a3-270e-4e36-9a55-40daed5b10ef', value: 'POLAND', label: 'Poland 🇵🇱', position: 139, color: 'gray' },
- { id: '23b1ae16-f00f-4844-8871-ed2b46c1cb51', value: 'PORTUGAL', label: 'Portugal 🇵🇹', position: 140, color: 'blue' },
- { id: '4dc69f6b-b0ee-48ea-95d3-517dc4ec7b91', value: 'QATAR', label: 'Qatar 🇶🇦', position: 141, color: 'turquoise' },
- { id: '8dcd82ce-98b2-45cb-a76d-f1503509035f', value: 'ROMANIA', label: 'Romania 🇷🇴', position: 142, color: 'green' },
- { id: '7e18e241-4fd6-4303-b390-0a9dea9c16bd', value: 'RUSSIA', label: 'Russia 🇷🇺', position: 143, color: 'sky' },
- { id: '966e45fb-7ed8-478e-9c26-25b7d59ae4f4', value: 'RWANDA', label: 'Rwanda 🇷🇼', position: 144, color: 'purple' },
- { id: '22ddf2d7-f1f8-46e9-8eb9-248c02652ad0', value: 'SAINT_KITTS_AND_NEVIS', label: 'Saint Kitts & Nevis 🇰🇳', position: 145, color: 'orange' },
- { id: '3312359a-b9fd-4a95-9db2-ad3e1f67f2b2', value: 'SAINT_LUCIA', label: 'Saint Lucia 🇱🇨', position: 146, color: 'yellow' },
- { id: '159c06c1-14a5-407f-af16-b84ba14f16be', value: 'SAINT_VINCENT', label: 'Saint Vincent 🇻🇨', position: 147, color: 'red' },
- { id: '0dd1cf79-89e2-4442-bd83-c65b43a3a544', value: 'SAMOA', label: 'Samoa 🇼🇸', position: 148, color: 'pink' },
- { id: 'e16851a7-97de-4e17-aeac-0cb828655406', value: 'SAN_MARINO', label: 'San Marino 🇸🇲', position: 149, color: 'gray' },
- { id: '6415861d-5fa9-46b5-a2cd-d58587c9dd03', value: 'SAO_TOME_AND_PRINCIPE', label: 'São Tomé & Príncipe 🇸🇹', position: 150, color: 'blue' },
- { id: '5831720a-3ce0-409c-9694-1b1d12394599', value: 'SAUDI_ARABIA', label: 'Saudi Arabia 🇸🇦', position: 151, color: 'turquoise' },
- { id: '89155d75-e4d0-4115-916c-8b77b9ddc5f3', value: 'SENEGAL', label: 'Senegal 🇸🇳', position: 152, color: 'green' },
- { id: 'f0c3e0e0-8106-4921-a02e-0497c1318efa', value: 'SERBIA', label: 'Serbia 🇷🇸', position: 153, color: 'sky' },
- { id: 'd8633c5d-1c65-44c5-bc71-7eb65cb988c3', value: 'SEYCHELLES', label: 'Seychelles 🇸🇨', position: 154, color: 'purple' },
- { id: '64b9fd47-a748-4add-bacf-a7dc1f1aa0c7', value: 'SIERRA_LEONE', label: 'Sierra Leone 🇸🇱', position: 155, color: 'orange' },
- { id: '5bd24cd5-a233-4d8f-930d-27f15d493c92', value: 'SINGAPORE', label: 'Singapore 🇸🇬', position: 156, color: 'yellow' },
- { id: '63c5df12-b203-4627-91b2-0526a56452d4', value: 'SLOVAKIA', label: 'Slovakia 🇸🇰', position: 157, color: 'red' },
- { id: 'b0deeef1-767a-4730-8743-588bfeb856e6', value: 'SLOVENIA', label: 'Slovenia 🇸🇮', position: 158, color: 'pink' },
- { id: '9274cd87-3400-4ccd-9192-3239b5126691', value: 'SOLOMON_ISLANDS', label: 'Solomon Islands 🇸🇧', position: 159, color: 'gray' },
- { id: '67dc7930-eaa4-4ef0-9fc4-af996eaaae09', value: 'SOMALIA', label: 'Somalia 🇸🇴', position: 160, color: 'blue' },
- { id: '19d96578-107c-4286-9504-5d59077b8290', value: 'SOUTH_AFRICA', label: 'South Africa 🇿🇦', position: 161, color: 'turquoise' },
- { id: '11cb5cb6-d67d-47ae-adf1-ecba3635fe20', value: 'SOUTH_KOREA', label: 'South Korea 🇰🇷', position: 162, color: 'green' },
- { id: '8293e893-0d7d-4002-9929-fea536a9a73c', value: 'SOUTH_SUDAN', label: 'South Sudan 🇸🇸', position: 163, color: 'sky' },
- { id: 'e0b9ba99-d891-4f6c-95df-1f92a0a7e12e', value: 'SPAIN', label: 'Spain 🇪🇸', position: 164, color: 'purple' },
- { id: '18378ce8-e480-4fd9-b90d-379d5daf7ecb', value: 'SRI_LANKA', label: 'Sri Lanka 🇱🇰', position: 165, color: 'orange' },
- { id: '10943324-5ae5-47db-bb2f-5d4bdeafd0b0', value: 'SUDAN', label: 'Sudan 🇸🇩', position: 166, color: 'yellow' },
- { id: 'bfd244e4-87c0-4dca-89b0-a1b581f1aa65', value: 'SURINAME', label: 'Suriname 🇸🇷', position: 167, color: 'red' },
- { id: '6a8f9119-c413-4ece-b432-2ce2e80580a1', value: 'SWEDEN', label: 'Sweden 🇸🇪', position: 168, color: 'pink' },
- { id: '866a8e2d-60a7-40a0-8541-35a9cfa20c09', value: 'SWITZERLAND', label: 'Switzerland 🇨🇭', position: 169, color: 'gray' },
- { id: '93758334-0ebc-4884-bfac-c0dbeec23a35', value: 'SYRIA', label: 'Syria 🇸🇾', position: 170, color: 'blue' },
- { id: 'c785e424-7a6f-4f27-91bc-aadb617525b0', value: 'TAIWAN', label: 'Taiwan 🇹🇼', position: 171, color: 'turquoise' },
- { id: '15ab8a5b-5989-4e3b-92cb-00b88cf7b7f6', value: 'TAJIKISTAN', label: 'Tajikistan 🇹🇯', position: 172, color: 'green' },
- { id: '476a55dd-8c69-4711-8e40-54cbe41d5c3a', value: 'TANZANIA', label: 'Tanzania 🇹🇿', position: 173, color: 'sky' },
- { id: 'bfcbef16-36c4-4350-a614-7ad065276104', value: 'THAILAND', label: 'Thailand 🇹🇭', position: 174, color: 'purple' },
- { id: '6872c804-9baa-498f-9dc6-b5894b64dece', value: 'TIMOR_LESTE', label: 'Timor-Leste 🇹🇱', position: 175, color: 'orange' },
- { id: 'b6429782-b6e1-4404-a5c4-8a44f3818147', value: 'TOGO', label: 'Togo 🇹🇬', position: 176, color: 'yellow' },
- { id: 'f4a7b7f9-aa58-4d23-adac-a96ed2c61ba1', value: 'TONGA', label: 'Tonga 🇹🇴', position: 177, color: 'red' },
- { id: 'a1377467-7a21-40af-861f-4b362b30fcb4', value: 'TRINIDAD_AND_TOBAGO', label: 'Trinidad & Tobago 🇹🇹', position: 178, color: 'pink' },
- { id: '7779c7d6-c7e1-4d6c-8282-31f659988c22', value: 'TUNISIA', label: 'Tunisia 🇹🇳', position: 179, color: 'gray' },
- { id: '5858f81e-629a-4b04-98e8-6441f3984044', value: 'TURKEY', label: 'Turkey 🇹🇷', position: 180, color: 'blue' },
- { id: 'cfdae353-6782-4dde-b229-d4e2c577fbed', value: 'TURKMENISTAN', label: 'Turkmenistan 🇹🇲', position: 181, color: 'turquoise' },
- { id: '755d859a-a8d4-45e0-aa6e-77afcedb29d0', value: 'TUVALU', label: 'Tuvalu 🇹🇻', position: 182, color: 'green' },
- { id: '3b325d46-b8e8-4cb9-9318-53f20baf50bd', value: 'UGANDA', label: 'Uganda 🇺🇬', position: 183, color: 'sky' },
- { id: '10f32cd9-0a6b-4829-913d-50f519dcfc3a', value: 'UKRAINE', label: 'Ukraine 🇺🇦', position: 184, color: 'purple' },
- { id: '0776427b-0dc1-49ef-b1c8-bb7dbba5a1e9', value: 'UNITED_ARAB_EMIRATES', label: 'UAE 🇦🇪', position: 185, color: 'orange' },
- { id: 'edaf21dc-60d4-4550-8b58-2f7a19eedc92', value: 'UNITED_KINGDOM', label: 'UK 🇬🇧', position: 186, color: 'yellow' },
- { id: '553004cd-aeed-4025-aa71-574efcade200', value: 'UNITED_STATES', label: 'USA 🇺🇸', position: 187, color: 'red' },
- { id: 'f925d857-5cb7-467d-bc65-e5c04ae5a238', value: 'URUGUAY', label: 'Uruguay 🇺🇾', position: 188, color: 'pink' },
- { id: '9b50ea41-2b8f-44d1-beeb-f4f4428289c4', value: 'UZBEKISTAN', label: 'Uzbekistan 🇺🇿', position: 189, color: 'gray' },
- { id: 'a7a7cbfd-6999-42e8-874e-c2bfbe6ca567', value: 'VANUATU', label: 'Vanuatu 🇻🇺', position: 190, color: 'blue' },
- { id: '7de0a670-8f04-444c-86dc-d7be00cc8b4e', value: 'VATICAN', label: 'Vatican 🇻🇦', position: 191, color: 'turquoise' },
- { id: '9acc531c-7f17-4b67-804a-035c3c873cce', value: 'VENEZUELA', label: 'Venezuela 🇻🇪', position: 192, color: 'green' },
- { id: '540b908e-f6b6-4f70-bb9c-c86dc5becbe7', value: 'VIETNAM', label: 'Vietnam 🇻🇳', position: 193, color: 'sky' },
- { id: 'a70a3610-9a9b-4fe0-9e97-10d3e60a3d92', value: 'YEMEN', label: 'Yemen 🇾🇪', position: 194, color: 'purple' },
- { id: 'fde30bd3-b2f1-4331-a255-9601259e807e', value: 'ZAMBIA', label: 'Zambia 🇿🇲', position: 195, color: 'orange' },
- { id: 'a83060bf-f55b-4efe-9e0c-b856ad5446c4', value: 'ZIMBABWE', label: 'Zimbabwe 🇿🇼', position: 196, color: 'yellow' },
- ],
- },
- {
- universalIdentifier: '560503de-6330-4c1d-af97-a8dee125f2ad',
- type: FieldType.MULTI_SELECT,
- name: 'region',
- label: 'Region',
- icon: 'IconWorld',
- isNullable: true,
- options: [
- { id: '735d7a75-c032-48b3-8480-c46e15b7e511', value: 'EUROPE', label: 'Europe', position: 0, color: 'blue' },
- { id: '78eb8d0c-841e-48dd-8425-d8546cbcfe25', value: 'US', label: 'US', position: 1, color: 'red' },
- { id: 'b0339081-52dd-4101-b7e7-83ed6ad6ca4f', value: 'LATAM', label: 'LATAM', position: 2, color: 'green' },
- { id: 'f02bd583-87b8-48d1-97db-9395056c96e2', value: 'MENA', label: 'MENA', position: 3, color: 'orange' },
- { id: '5205c25f-a300-4967-b5f3-033c0515a28a', value: 'APAC', label: 'APAC', position: 4, color: 'yellow' },
- { id: '7f55cf70-8c81-4f68-83bc-270d215f0a4e', value: 'AFRICA', label: 'Africa', position: 5, color: 'pink' },
+ {
+ id: '03332728-50b1-49ec-bdec-a938cb97ca74',
+ value: 'AFGHANISTAN',
+ label: 'Afghanistan 🇦🇫',
+ position: 0,
+ color: 'blue',
+ },
+ {
+ id: 'c39c7baa-6f52-4349-bc28-97b59f2a9a3a',
+ value: 'ALBANIA',
+ label: 'Albania 🇦🇱',
+ position: 1,
+ color: 'turquoise',
+ },
+ {
+ id: '1bce0427-d693-451a-9a6b-a50c0c502c85',
+ value: 'ALGERIA',
+ label: 'Algeria 🇩🇿',
+ position: 2,
+ color: 'green',
+ },
+ {
+ id: '634fb580-4f12-4a5b-b43c-5787330d4b60',
+ value: 'ANDORRA',
+ label: 'Andorra 🇦🇩',
+ position: 3,
+ color: 'sky',
+ },
+ {
+ id: '545797b9-16df-40d5-ab9b-037d3d875263',
+ value: 'ANGOLA',
+ label: 'Angola 🇦🇴',
+ position: 4,
+ color: 'purple',
+ },
+ {
+ id: '83b58c61-8b0d-42e1-9d4f-9a530ace7899',
+ value: 'ANTIGUA_AND_BARBUDA',
+ label: 'Antigua & Barbuda 🇦🇬',
+ position: 5,
+ color: 'orange',
+ },
+ {
+ id: '58fd4e0d-b48d-4b22-81d8-de6db6bd22ed',
+ value: 'ARGENTINA',
+ label: 'Argentina 🇦🇷',
+ position: 6,
+ color: 'yellow',
+ },
+ {
+ id: '7091a2e3-2095-4693-bd53-366df4ba5c75',
+ value: 'ARMENIA',
+ label: 'Armenia 🇦🇲',
+ position: 7,
+ color: 'red',
+ },
+ {
+ id: '479725e7-f185-46c6-9e8b-605fbbb392f8',
+ value: 'AUSTRALIA',
+ label: 'Australia 🇦🇺',
+ position: 8,
+ color: 'pink',
+ },
+ {
+ id: 'b7993e1b-5f7d-47b9-a84d-41795160393a',
+ value: 'AUSTRIA',
+ label: 'Austria 🇦🇹',
+ position: 9,
+ color: 'gray',
+ },
+ {
+ id: 'e2d324df-2baa-49a2-a016-2c7cab0d0e95',
+ value: 'AZERBAIJAN',
+ label: 'Azerbaijan 🇦🇿',
+ position: 10,
+ color: 'blue',
+ },
+ {
+ id: '87dc4b54-c4f7-4813-a0e4-d2214e659a77',
+ value: 'BAHAMAS',
+ label: 'Bahamas 🇧🇸',
+ position: 11,
+ color: 'turquoise',
+ },
+ {
+ id: '32149c4f-3319-42a6-a0ca-6afb42bdf3b9',
+ value: 'BAHRAIN',
+ label: 'Bahrain 🇧🇭',
+ position: 12,
+ color: 'green',
+ },
+ {
+ id: 'c74d1f90-e17f-4e9a-9341-5c6ffda2d3ac',
+ value: 'BANGLADESH',
+ label: 'Bangladesh 🇧🇩',
+ position: 13,
+ color: 'sky',
+ },
+ {
+ id: '61c2e8c4-06af-4daa-ac52-34f4b47e2aad',
+ value: 'BARBADOS',
+ label: 'Barbados 🇧🇧',
+ position: 14,
+ color: 'purple',
+ },
+ {
+ id: '1c7dfa46-72e0-4ba3-8af5-3b2d1d46fd4b',
+ value: 'BELARUS',
+ label: 'Belarus 🇧🇾',
+ position: 15,
+ color: 'orange',
+ },
+ {
+ id: '771258e5-b16f-47d4-aaed-47a4c931b72d',
+ value: 'BELGIUM',
+ label: 'Belgium 🇧🇪',
+ position: 16,
+ color: 'yellow',
+ },
+ {
+ id: 'f3910b68-3f3f-4afb-9f90-5561376e5098',
+ value: 'BELIZE',
+ label: 'Belize 🇧🇿',
+ position: 17,
+ color: 'red',
+ },
+ {
+ id: 'b06f1bc7-2058-44fc-b868-631559de7d11',
+ value: 'BENIN',
+ label: 'Benin 🇧🇯',
+ position: 18,
+ color: 'pink',
+ },
+ {
+ id: 'acff20b8-b865-47de-9049-c660866f5218',
+ value: 'BHUTAN',
+ label: 'Bhutan 🇧🇹',
+ position: 19,
+ color: 'gray',
+ },
+ {
+ id: 'bee20647-c283-40af-9733-37753e42b464',
+ value: 'BOLIVIA',
+ label: 'Bolivia 🇧🇴',
+ position: 20,
+ color: 'blue',
+ },
+ {
+ id: '4dd91769-c713-47af-bf48-aed0251115b1',
+ value: 'BOSNIA_AND_HERZEGOVINA',
+ label: 'Bosnia & Herzegovina 🇧🇦',
+ position: 21,
+ color: 'turquoise',
+ },
+ {
+ id: 'a6997427-007f-42b4-b6ea-892f7ce58dff',
+ value: 'BOTSWANA',
+ label: 'Botswana 🇧🇼',
+ position: 22,
+ color: 'green',
+ },
+ {
+ id: '3ff1f170-d3f0-4ce6-9490-bfc20aadf470',
+ value: 'BRAZIL',
+ label: 'Brazil 🇧🇷',
+ position: 23,
+ color: 'sky',
+ },
+ {
+ id: '7b2d6911-4676-433d-93f1-6eca2530d89d',
+ value: 'BRUNEI',
+ label: 'Brunei 🇧🇳',
+ position: 24,
+ color: 'purple',
+ },
+ {
+ id: '767c72f3-f951-4b00-958d-856d2a8bda7a',
+ value: 'BULGARIA',
+ label: 'Bulgaria 🇧🇬',
+ position: 25,
+ color: 'orange',
+ },
+ {
+ id: 'e16ce6af-86b0-4448-8008-c5efa2ce3fe9',
+ value: 'BURKINA_FASO',
+ label: 'Burkina Faso 🇧🇫',
+ position: 26,
+ color: 'yellow',
+ },
+ {
+ id: 'dd7e7b2a-8367-482d-99d4-7877d883c2e3',
+ value: 'BURUNDI',
+ label: 'Burundi 🇧🇮',
+ position: 27,
+ color: 'red',
+ },
+ {
+ id: 'd9d6eea9-7724-4c65-be48-e861075121f1',
+ value: 'CAMBODIA',
+ label: 'Cambodia 🇰🇭',
+ position: 28,
+ color: 'pink',
+ },
+ {
+ id: '49178472-0bdd-4797-be6c-e0a1ac6e4147',
+ value: 'CAMEROON',
+ label: 'Cameroon 🇨🇲',
+ position: 29,
+ color: 'gray',
+ },
+ {
+ id: '849b6361-a83b-48fb-a3e5-2ac6e9089c7f',
+ value: 'CANADA',
+ label: 'Canada 🇨🇦',
+ position: 30,
+ color: 'blue',
+ },
+ {
+ id: 'ca22a230-01b1-4099-b7c2-29fd3b8d09de',
+ value: 'CAPE_VERDE',
+ label: 'Cape Verde 🇨🇻',
+ position: 31,
+ color: 'turquoise',
+ },
+ {
+ id: '360bef1e-34a9-4467-9ffe-5ebeb6427711',
+ value: 'CENTRAL_AFRICAN_REPUBLIC',
+ label: 'Central African Republic 🇨🇫',
+ position: 32,
+ color: 'green',
+ },
+ {
+ id: 'deba0ee2-3027-4646-afc6-24410bf68198',
+ value: 'CHAD',
+ label: 'Chad 🇹🇩',
+ position: 33,
+ color: 'sky',
+ },
+ {
+ id: 'd0bf04d5-a40c-45f0-8e82-4d5905c00131',
+ value: 'CHILE',
+ label: 'Chile 🇨🇱',
+ position: 34,
+ color: 'purple',
+ },
+ {
+ id: '60522b37-dded-4f18-a25b-05b51a8c9aa7',
+ value: 'CHINA',
+ label: 'China 🇨🇳',
+ position: 35,
+ color: 'orange',
+ },
+ {
+ id: '3b2c58f1-4efc-4c0f-9d43-f3a5b5b577cf',
+ value: 'COLOMBIA',
+ label: 'Colombia 🇨🇴',
+ position: 36,
+ color: 'yellow',
+ },
+ {
+ id: 'cbea73ba-8a9d-47ee-a38b-b7c3d89d3922',
+ value: 'COMOROS',
+ label: 'Comoros 🇰🇲',
+ position: 37,
+ color: 'red',
+ },
+ {
+ id: '895ed0d4-6a00-482a-840e-44edef034d2b',
+ value: 'CONGO',
+ label: 'Congo 🇨🇬',
+ position: 38,
+ color: 'pink',
+ },
+ {
+ id: '13db3209-398c-474c-b5f9-269ccf27adc5',
+ value: 'DR_CONGO',
+ label: 'DR Congo 🇨🇩',
+ position: 39,
+ color: 'gray',
+ },
+ {
+ id: '150c4227-ce67-420b-bb6c-82d5a4fb9c70',
+ value: 'COSTA_RICA',
+ label: 'Costa Rica 🇨🇷',
+ position: 40,
+ color: 'blue',
+ },
+ {
+ id: 'ad1853e2-753d-4245-b9a7-88a29281ca0a',
+ value: 'CROATIA',
+ label: 'Croatia 🇭🇷',
+ position: 41,
+ color: 'turquoise',
+ },
+ {
+ id: 'e42cad17-f7ea-450b-8c7f-a0ac0dc31dac',
+ value: 'CUBA',
+ label: 'Cuba 🇨🇺',
+ position: 42,
+ color: 'green',
+ },
+ {
+ id: '9035a680-5962-48c3-8d79-ee805a2c8b1c',
+ value: 'CYPRUS',
+ label: 'Cyprus 🇨🇾',
+ position: 43,
+ color: 'sky',
+ },
+ {
+ id: 'facb14c9-40e9-47f6-bc4b-b29178761210',
+ value: 'CZECH_REPUBLIC',
+ label: 'Czech Republic 🇨🇿',
+ position: 44,
+ color: 'purple',
+ },
+ {
+ id: '47026695-ee4b-47f2-97c1-9d1ea9854cd5',
+ value: 'DENMARK',
+ label: 'Denmark 🇩🇰',
+ position: 45,
+ color: 'orange',
+ },
+ {
+ id: '335e3877-1f8b-4f2b-a409-ec74596dd779',
+ value: 'DJIBOUTI',
+ label: 'Djibouti 🇩🇯',
+ position: 46,
+ color: 'yellow',
+ },
+ {
+ id: 'ee17957f-f692-495b-a664-61284fa723f2',
+ value: 'DOMINICA',
+ label: 'Dominica 🇩🇲',
+ position: 47,
+ color: 'red',
+ },
+ {
+ id: '4114c313-27d7-4f5a-a381-38daca143642',
+ value: 'DOMINICAN_REPUBLIC',
+ label: 'Dominican Republic 🇩🇴',
+ position: 48,
+ color: 'pink',
+ },
+ {
+ id: 'ffcfae44-e1b7-4739-87dd-0d957062646d',
+ value: 'ECUADOR',
+ label: 'Ecuador 🇪🇨',
+ position: 49,
+ color: 'gray',
+ },
+ {
+ id: '1f4e8ee4-3be1-42cd-96d4-3e5686dee153',
+ value: 'EGYPT',
+ label: 'Egypt 🇪🇬',
+ position: 50,
+ color: 'blue',
+ },
+ {
+ id: 'cf98813f-2a7e-4426-b97f-d3f1ac044bb8',
+ value: 'EL_SALVADOR',
+ label: 'El Salvador 🇸🇻',
+ position: 51,
+ color: 'turquoise',
+ },
+ {
+ id: '0e787d6e-e864-4ee3-b4c7-20fa873e8649',
+ value: 'EQUATORIAL_GUINEA',
+ label: 'Equatorial Guinea 🇬🇶',
+ position: 52,
+ color: 'green',
+ },
+ {
+ id: 'f68b6554-4ed5-4161-933f-a321b41391ea',
+ value: 'ERITREA',
+ label: 'Eritrea 🇪🇷',
+ position: 53,
+ color: 'sky',
+ },
+ {
+ id: '7a4387dc-198c-46db-9536-7bc73de4e1b0',
+ value: 'ESTONIA',
+ label: 'Estonia 🇪🇪',
+ position: 54,
+ color: 'purple',
+ },
+ {
+ id: '7e0fec86-e04f-499c-a814-72ac9b4cc5ce',
+ value: 'ESWATINI',
+ label: 'Eswatini 🇸🇿',
+ position: 55,
+ color: 'orange',
+ },
+ {
+ id: 'a7768d57-5bf2-401e-a82d-ec36e3f3a419',
+ value: 'ETHIOPIA',
+ label: 'Ethiopia 🇪🇹',
+ position: 56,
+ color: 'yellow',
+ },
+ {
+ id: '1b9e15c3-4fa5-4cd8-9bfb-8262518665fa',
+ value: 'FIJI',
+ label: 'Fiji 🇫🇯',
+ position: 57,
+ color: 'red',
+ },
+ {
+ id: '828a6fe2-3c50-4da3-97c9-11f3b80fbb0d',
+ value: 'FINLAND',
+ label: 'Finland 🇫🇮',
+ position: 58,
+ color: 'pink',
+ },
+ {
+ id: '03a1c597-65cf-440f-a20d-9d6bef0540c2',
+ value: 'FRANCE',
+ label: 'France 🇫🇷',
+ position: 59,
+ color: 'gray',
+ },
+ {
+ id: 'ab2edd1f-6353-4de8-863f-4b28e774be8e',
+ value: 'GABON',
+ label: 'Gabon 🇬🇦',
+ position: 60,
+ color: 'blue',
+ },
+ {
+ id: '12a50b82-c2f8-4d0b-b5f4-e52dfe01ba13',
+ value: 'GAMBIA',
+ label: 'Gambia 🇬🇲',
+ position: 61,
+ color: 'turquoise',
+ },
+ {
+ id: '2adf673e-8367-4eaf-83f0-41199718f0ee',
+ value: 'GEORGIA',
+ label: 'Georgia 🇬🇪',
+ position: 62,
+ color: 'green',
+ },
+ {
+ id: 'bd61021e-c25b-453e-b0cc-afb3942b063f',
+ value: 'GERMANY',
+ label: 'Germany 🇩🇪',
+ position: 63,
+ color: 'sky',
+ },
+ {
+ id: '1c45b7ae-9489-4714-b21e-8c717e6599ab',
+ value: 'GHANA',
+ label: 'Ghana 🇬🇭',
+ position: 64,
+ color: 'purple',
+ },
+ {
+ id: 'cc47d864-cd78-4cdd-a711-d679f0cbc133',
+ value: 'GREECE',
+ label: 'Greece 🇬🇷',
+ position: 65,
+ color: 'orange',
+ },
+ {
+ id: '2a2c3ca6-611e-49a4-9639-e8f60172c1b3',
+ value: 'GRENADA',
+ label: 'Grenada 🇬🇩',
+ position: 66,
+ color: 'yellow',
+ },
+ {
+ id: 'da2024e5-a1a0-49ab-8cf0-0d9e3f10ff9d',
+ value: 'GUATEMALA',
+ label: 'Guatemala 🇬🇹',
+ position: 67,
+ color: 'red',
+ },
+ {
+ id: '086c9969-1911-4aa4-8d67-3abdc12b2ce7',
+ value: 'GUINEA',
+ label: 'Guinea 🇬🇳',
+ position: 68,
+ color: 'pink',
+ },
+ {
+ id: 'a648d1d3-4d3f-4fc6-a1ea-40f98283df75',
+ value: 'GUINEA_BISSAU',
+ label: 'Guinea-Bissau 🇬🇼',
+ position: 69,
+ color: 'gray',
+ },
+ {
+ id: 'b567e119-4dcb-4f8a-b012-febe72262d85',
+ value: 'GUYANA',
+ label: 'Guyana 🇬🇾',
+ position: 70,
+ color: 'blue',
+ },
+ {
+ id: '26801d38-c0e6-468a-8c78-a0aed06c16fd',
+ value: 'HAITI',
+ label: 'Haiti 🇭🇹',
+ position: 71,
+ color: 'turquoise',
+ },
+ {
+ id: '2e31c5ff-da0a-4c82-b7bc-7a8c18b54f1e',
+ value: 'HONDURAS',
+ label: 'Honduras 🇭🇳',
+ position: 72,
+ color: 'green',
+ },
+ {
+ id: 'a78bd322-ac40-4ab3-a46f-6204e42b0712',
+ value: 'HUNGARY',
+ label: 'Hungary 🇭🇺',
+ position: 73,
+ color: 'sky',
+ },
+ {
+ id: '0026e951-225d-4e8c-8e64-289ead339bd3',
+ value: 'ICELAND',
+ label: 'Iceland 🇮🇸',
+ position: 74,
+ color: 'purple',
+ },
+ {
+ id: 'f5101d7d-9b81-4d2e-a9aa-e20dfab52c58',
+ value: 'INDIA',
+ label: 'India 🇮🇳',
+ position: 75,
+ color: 'orange',
+ },
+ {
+ id: '11b30046-58f3-42e5-a3e2-5d4761675056',
+ value: 'INDONESIA',
+ label: 'Indonesia 🇮🇩',
+ position: 76,
+ color: 'yellow',
+ },
+ {
+ id: '7345db23-db33-45cb-b8cc-e4d4a1f1b90e',
+ value: 'IRAN',
+ label: 'Iran 🇮🇷',
+ position: 77,
+ color: 'red',
+ },
+ {
+ id: '899d0eb1-9f04-4a88-b7f3-351e998b5979',
+ value: 'IRAQ',
+ label: 'Iraq 🇮🇶',
+ position: 78,
+ color: 'pink',
+ },
+ {
+ id: 'e45e8143-14c1-4184-84db-c11212cb8e25',
+ value: 'IRELAND',
+ label: 'Ireland 🇮🇪',
+ position: 79,
+ color: 'gray',
+ },
+ {
+ id: 'a208dac3-455e-41ed-9db0-aa7352d420ab',
+ value: 'ISRAEL',
+ label: 'Israel 🇮🇱',
+ position: 80,
+ color: 'blue',
+ },
+ {
+ id: '4537862d-0565-47a0-8759-ef522996881f',
+ value: 'ITALY',
+ label: 'Italy 🇮🇹',
+ position: 81,
+ color: 'turquoise',
+ },
+ {
+ id: '988630a1-dd19-476b-a0dc-cf8904ec5f68',
+ value: 'IVORY_COAST',
+ label: 'Ivory Coast 🇨🇮',
+ position: 82,
+ color: 'green',
+ },
+ {
+ id: '30c755e0-61f2-4590-9969-f3150c3b5aff',
+ value: 'JAMAICA',
+ label: 'Jamaica 🇯🇲',
+ position: 83,
+ color: 'sky',
+ },
+ {
+ id: '9ca39ab6-e0fb-4bbb-80bc-cbffa48682da',
+ value: 'JAPAN',
+ label: 'Japan 🇯🇵',
+ position: 84,
+ color: 'purple',
+ },
+ {
+ id: 'f71aefd9-1dc0-4370-8a31-2a329d8ab15d',
+ value: 'JORDAN',
+ label: 'Jordan 🇯🇴',
+ position: 85,
+ color: 'orange',
+ },
+ {
+ id: '7f230c15-2745-4e78-ab35-8ae5bec7bcc6',
+ value: 'KAZAKHSTAN',
+ label: 'Kazakhstan 🇰🇿',
+ position: 86,
+ color: 'yellow',
+ },
+ {
+ id: '9e745903-4ac7-432f-bfd2-d0d78e76f3e9',
+ value: 'KENYA',
+ label: 'Kenya 🇰🇪',
+ position: 87,
+ color: 'red',
+ },
+ {
+ id: 'ee448c0f-8b3b-4666-bbbb-19e8b62ecbcc',
+ value: 'KIRIBATI',
+ label: 'Kiribati 🇰🇮',
+ position: 88,
+ color: 'pink',
+ },
+ {
+ id: '6de78d0a-7a2b-48bb-97b5-2a86c8bab3b6',
+ value: 'KOSOVO',
+ label: 'Kosovo 🇽🇰',
+ position: 89,
+ color: 'gray',
+ },
+ {
+ id: '48e160eb-1fdf-4456-99f7-4e97e7d16cfa',
+ value: 'KUWAIT',
+ label: 'Kuwait 🇰🇼',
+ position: 90,
+ color: 'blue',
+ },
+ {
+ id: '7d318293-6378-4a02-af49-23d48d887a8f',
+ value: 'KYRGYZSTAN',
+ label: 'Kyrgyzstan 🇰🇬',
+ position: 91,
+ color: 'turquoise',
+ },
+ {
+ id: 'dc540210-83bb-40c5-ab0d-585f4648df1b',
+ value: 'LAOS',
+ label: 'Laos 🇱🇦',
+ position: 92,
+ color: 'green',
+ },
+ {
+ id: 'fe2c5828-330f-45b8-991c-180723d5bed6',
+ value: 'LATVIA',
+ label: 'Latvia 🇱🇻',
+ position: 93,
+ color: 'sky',
+ },
+ {
+ id: 'cff1390a-7548-401b-bfa1-5e062e1e2cd3',
+ value: 'LEBANON',
+ label: 'Lebanon 🇱🇧',
+ position: 94,
+ color: 'purple',
+ },
+ {
+ id: '2a1d40fd-a633-4bb0-890a-1009a2126ff9',
+ value: 'LESOTHO',
+ label: 'Lesotho 🇱🇸',
+ position: 95,
+ color: 'orange',
+ },
+ {
+ id: 'dee0303d-11c9-4bf9-913b-c5fedfc93766',
+ value: 'LIBERIA',
+ label: 'Liberia 🇱🇷',
+ position: 96,
+ color: 'yellow',
+ },
+ {
+ id: '57713732-bd4e-4888-a4e3-ad7761e76dd9',
+ value: 'LIBYA',
+ label: 'Libya 🇱🇾',
+ position: 97,
+ color: 'red',
+ },
+ {
+ id: '5ed4e5fd-31dc-4adc-a875-b5036ef5eac6',
+ value: 'LIECHTENSTEIN',
+ label: 'Liechtenstein 🇱🇮',
+ position: 98,
+ color: 'pink',
+ },
+ {
+ id: '8facad69-2b22-47a4-a324-75773bd7d4f8',
+ value: 'LITHUANIA',
+ label: 'Lithuania 🇱🇹',
+ position: 99,
+ color: 'gray',
+ },
+ {
+ id: 'fb1b4543-7f22-4c44-a953-7c68e2790e27',
+ value: 'LUXEMBOURG',
+ label: 'Luxembourg 🇱🇺',
+ position: 100,
+ color: 'blue',
+ },
+ {
+ id: '80009115-d98c-4e63-8401-285f82d94921',
+ value: 'MADAGASCAR',
+ label: 'Madagascar 🇲🇬',
+ position: 101,
+ color: 'turquoise',
+ },
+ {
+ id: 'b32ed1f2-3d12-4255-a39a-3a5ab64b425c',
+ value: 'MALAWI',
+ label: 'Malawi 🇲🇼',
+ position: 102,
+ color: 'green',
+ },
+ {
+ id: 'd7c744b0-23d2-4dd4-a9f9-3298cfce0d1b',
+ value: 'MALAYSIA',
+ label: 'Malaysia 🇲🇾',
+ position: 103,
+ color: 'sky',
+ },
+ {
+ id: 'a878865c-a73f-47d7-bf52-29c1b7b947d7',
+ value: 'MALDIVES',
+ label: 'Maldives 🇲🇻',
+ position: 104,
+ color: 'purple',
+ },
+ {
+ id: '2d5e9644-11b6-4b55-8f9a-ed33da2de6ac',
+ value: 'MALI',
+ label: 'Mali 🇲🇱',
+ position: 105,
+ color: 'orange',
+ },
+ {
+ id: 'e2fa091a-0e78-41da-937b-42b55e501226',
+ value: 'MALTA',
+ label: 'Malta 🇲🇹',
+ position: 106,
+ color: 'yellow',
+ },
+ {
+ id: 'e36301e0-1d79-4540-87c7-4de2bfeface6',
+ value: 'MARSHALL_ISLANDS',
+ label: 'Marshall Islands 🇲🇭',
+ position: 107,
+ color: 'red',
+ },
+ {
+ id: '8dc782e6-3578-4d7a-a6ba-a29e48f3cc11',
+ value: 'MAURITANIA',
+ label: 'Mauritania 🇲🇷',
+ position: 108,
+ color: 'pink',
+ },
+ {
+ id: 'edf63c87-d621-40fe-b653-a0f7764c8961',
+ value: 'MAURITIUS',
+ label: 'Mauritius 🇲🇺',
+ position: 109,
+ color: 'gray',
+ },
+ {
+ id: '86233df1-6c71-4ffb-9298-c61c65dcc79c',
+ value: 'MEXICO',
+ label: 'Mexico 🇲🇽',
+ position: 110,
+ color: 'blue',
+ },
+ {
+ id: 'c41c35ff-118b-4119-b12f-93be635fbae3',
+ value: 'MICRONESIA',
+ label: 'Micronesia 🇫🇲',
+ position: 111,
+ color: 'turquoise',
+ },
+ {
+ id: '8466a06e-a34f-4dd4-b660-8e9ad2aa5998',
+ value: 'MOLDOVA',
+ label: 'Moldova 🇲🇩',
+ position: 112,
+ color: 'green',
+ },
+ {
+ id: '948e9117-486d-40c1-847c-de6cc64b9730',
+ value: 'MONACO',
+ label: 'Monaco 🇲🇨',
+ position: 113,
+ color: 'sky',
+ },
+ {
+ id: 'ee33ddb8-3219-4fdb-8a71-8a6f8fdf93d3',
+ value: 'MONGOLIA',
+ label: 'Mongolia 🇲🇳',
+ position: 114,
+ color: 'purple',
+ },
+ {
+ id: 'b5c1fa55-0b1a-43d8-a871-ebd004952d0b',
+ value: 'MONTENEGRO',
+ label: 'Montenegro 🇲🇪',
+ position: 115,
+ color: 'orange',
+ },
+ {
+ id: '9e98cb68-666e-4116-b35f-bb9711fd7546',
+ value: 'MOROCCO',
+ label: 'Morocco 🇲🇦',
+ position: 116,
+ color: 'yellow',
+ },
+ {
+ id: '86c4b5f8-d4bc-4639-a5bf-00a84601b911',
+ value: 'MOZAMBIQUE',
+ label: 'Mozambique 🇲🇿',
+ position: 117,
+ color: 'red',
+ },
+ {
+ id: '8b3bcfa4-1797-492e-83d7-7d939e479b1d',
+ value: 'MYANMAR',
+ label: 'Myanmar 🇲🇲',
+ position: 118,
+ color: 'pink',
+ },
+ {
+ id: 'b8d01fef-4061-4e8c-bc38-f8226b4be6be',
+ value: 'NAMIBIA',
+ label: 'Namibia 🇳🇦',
+ position: 119,
+ color: 'gray',
+ },
+ {
+ id: '71dd1ad1-af94-4cfb-973d-33f87b4ef0cd',
+ value: 'NAURU',
+ label: 'Nauru 🇳🇷',
+ position: 120,
+ color: 'blue',
+ },
+ {
+ id: 'dc692171-3adc-4a73-8b45-a25cf659c546',
+ value: 'NEPAL',
+ label: 'Nepal 🇳🇵',
+ position: 121,
+ color: 'turquoise',
+ },
+ {
+ id: '3e161b4b-be95-4a6a-910d-628ad32691e1',
+ value: 'NETHERLANDS',
+ label: 'Netherlands 🇳🇱',
+ position: 122,
+ color: 'green',
+ },
+ {
+ id: 'b86be59e-a1ae-4df4-937f-ad97c641e0df',
+ value: 'NEW_ZEALAND',
+ label: 'New Zealand 🇳🇿',
+ position: 123,
+ color: 'sky',
+ },
+ {
+ id: '4674abdd-0548-4317-8af5-865e4d11327d',
+ value: 'NICARAGUA',
+ label: 'Nicaragua 🇳🇮',
+ position: 124,
+ color: 'purple',
+ },
+ {
+ id: '85ff2ce7-ddd8-4be6-b740-d79e70a3d103',
+ value: 'NIGER',
+ label: 'Niger 🇳🇪',
+ position: 125,
+ color: 'orange',
+ },
+ {
+ id: 'a69ab8cf-5a59-4879-92da-7cd2dea6b9e6',
+ value: 'NIGERIA',
+ label: 'Nigeria 🇳🇬',
+ position: 126,
+ color: 'yellow',
+ },
+ {
+ id: '28736977-b21f-4678-8e22-363be28a8e94',
+ value: 'NORTH_KOREA',
+ label: 'North Korea 🇰🇵',
+ position: 127,
+ color: 'red',
+ },
+ {
+ id: '11f87414-633d-48f8-a99d-0b407c281dbd',
+ value: 'NORTH_MACEDONIA',
+ label: 'North Macedonia 🇲🇰',
+ position: 128,
+ color: 'pink',
+ },
+ {
+ id: '9637c5aa-d405-4414-a56b-b983ed0bfa51',
+ value: 'NORWAY',
+ label: 'Norway 🇳🇴',
+ position: 129,
+ color: 'gray',
+ },
+ {
+ id: '70f79652-7f95-4836-ab2d-4373631910ec',
+ value: 'OMAN',
+ label: 'Oman 🇴🇲',
+ position: 130,
+ color: 'blue',
+ },
+ {
+ id: '50e4ae80-79d8-4cdf-aa0a-a2675e6e26fb',
+ value: 'PAKISTAN',
+ label: 'Pakistan 🇵🇰',
+ position: 131,
+ color: 'turquoise',
+ },
+ {
+ id: '08d27180-4861-4937-b04e-6cbcd33f507d',
+ value: 'PALAU',
+ label: 'Palau 🇵🇼',
+ position: 132,
+ color: 'green',
+ },
+ {
+ id: '6aa50196-ea4b-42cd-b890-8d7d56cc9731',
+ value: 'PALESTINE',
+ label: 'Palestine 🇵🇸',
+ position: 133,
+ color: 'sky',
+ },
+ {
+ id: '5663124d-f2fc-4374-8734-f3c53f9ea4f5',
+ value: 'PANAMA',
+ label: 'Panama 🇵🇦',
+ position: 134,
+ color: 'purple',
+ },
+ {
+ id: '8bde7cc7-fa6c-4f52-b9df-16c99928f50f',
+ value: 'PAPUA_NEW_GUINEA',
+ label: 'Papua New Guinea 🇵🇬',
+ position: 135,
+ color: 'orange',
+ },
+ {
+ id: '3eed4b21-1009-4dd2-bdac-53b11df8400c',
+ value: 'PARAGUAY',
+ label: 'Paraguay 🇵🇾',
+ position: 136,
+ color: 'yellow',
+ },
+ {
+ id: 'fbc734c9-63ae-4d2e-af0f-8e2abd874dda',
+ value: 'PERU',
+ label: 'Peru 🇵🇪',
+ position: 137,
+ color: 'red',
+ },
+ {
+ id: '211555bc-8f26-4d4d-94f1-c83884c32e20',
+ value: 'PHILIPPINES',
+ label: 'Philippines 🇵🇭',
+ position: 138,
+ color: 'pink',
+ },
+ {
+ id: '6d69e1a3-270e-4e36-9a55-40daed5b10ef',
+ value: 'POLAND',
+ label: 'Poland 🇵🇱',
+ position: 139,
+ color: 'gray',
+ },
+ {
+ id: '23b1ae16-f00f-4844-8871-ed2b46c1cb51',
+ value: 'PORTUGAL',
+ label: 'Portugal 🇵🇹',
+ position: 140,
+ color: 'blue',
+ },
+ {
+ id: '4dc69f6b-b0ee-48ea-95d3-517dc4ec7b91',
+ value: 'QATAR',
+ label: 'Qatar 🇶🇦',
+ position: 141,
+ color: 'turquoise',
+ },
+ {
+ id: '8dcd82ce-98b2-45cb-a76d-f1503509035f',
+ value: 'ROMANIA',
+ label: 'Romania 🇷🇴',
+ position: 142,
+ color: 'green',
+ },
+ {
+ id: '7e18e241-4fd6-4303-b390-0a9dea9c16bd',
+ value: 'RUSSIA',
+ label: 'Russia 🇷🇺',
+ position: 143,
+ color: 'sky',
+ },
+ {
+ id: '966e45fb-7ed8-478e-9c26-25b7d59ae4f4',
+ value: 'RWANDA',
+ label: 'Rwanda 🇷🇼',
+ position: 144,
+ color: 'purple',
+ },
+ {
+ id: '22ddf2d7-f1f8-46e9-8eb9-248c02652ad0',
+ value: 'SAINT_KITTS_AND_NEVIS',
+ label: 'Saint Kitts & Nevis 🇰🇳',
+ position: 145,
+ color: 'orange',
+ },
+ {
+ id: '3312359a-b9fd-4a95-9db2-ad3e1f67f2b2',
+ value: 'SAINT_LUCIA',
+ label: 'Saint Lucia 🇱🇨',
+ position: 146,
+ color: 'yellow',
+ },
+ {
+ id: '159c06c1-14a5-407f-af16-b84ba14f16be',
+ value: 'SAINT_VINCENT',
+ label: 'Saint Vincent 🇻🇨',
+ position: 147,
+ color: 'red',
+ },
+ {
+ id: '0dd1cf79-89e2-4442-bd83-c65b43a3a544',
+ value: 'SAMOA',
+ label: 'Samoa 🇼🇸',
+ position: 148,
+ color: 'pink',
+ },
+ {
+ id: 'e16851a7-97de-4e17-aeac-0cb828655406',
+ value: 'SAN_MARINO',
+ label: 'San Marino 🇸🇲',
+ position: 149,
+ color: 'gray',
+ },
+ {
+ id: '6415861d-5fa9-46b5-a2cd-d58587c9dd03',
+ value: 'SAO_TOME_AND_PRINCIPE',
+ label: 'São Tomé & Príncipe 🇸🇹',
+ position: 150,
+ color: 'blue',
+ },
+ {
+ id: '5831720a-3ce0-409c-9694-1b1d12394599',
+ value: 'SAUDI_ARABIA',
+ label: 'Saudi Arabia 🇸🇦',
+ position: 151,
+ color: 'turquoise',
+ },
+ {
+ id: '89155d75-e4d0-4115-916c-8b77b9ddc5f3',
+ value: 'SENEGAL',
+ label: 'Senegal 🇸🇳',
+ position: 152,
+ color: 'green',
+ },
+ {
+ id: 'f0c3e0e0-8106-4921-a02e-0497c1318efa',
+ value: 'SERBIA',
+ label: 'Serbia 🇷🇸',
+ position: 153,
+ color: 'sky',
+ },
+ {
+ id: 'd8633c5d-1c65-44c5-bc71-7eb65cb988c3',
+ value: 'SEYCHELLES',
+ label: 'Seychelles 🇸🇨',
+ position: 154,
+ color: 'purple',
+ },
+ {
+ id: '64b9fd47-a748-4add-bacf-a7dc1f1aa0c7',
+ value: 'SIERRA_LEONE',
+ label: 'Sierra Leone 🇸🇱',
+ position: 155,
+ color: 'orange',
+ },
+ {
+ id: '5bd24cd5-a233-4d8f-930d-27f15d493c92',
+ value: 'SINGAPORE',
+ label: 'Singapore 🇸🇬',
+ position: 156,
+ color: 'yellow',
+ },
+ {
+ id: '63c5df12-b203-4627-91b2-0526a56452d4',
+ value: 'SLOVAKIA',
+ label: 'Slovakia 🇸🇰',
+ position: 157,
+ color: 'red',
+ },
+ {
+ id: 'b0deeef1-767a-4730-8743-588bfeb856e6',
+ value: 'SLOVENIA',
+ label: 'Slovenia 🇸🇮',
+ position: 158,
+ color: 'pink',
+ },
+ {
+ id: '9274cd87-3400-4ccd-9192-3239b5126691',
+ value: 'SOLOMON_ISLANDS',
+ label: 'Solomon Islands 🇸🇧',
+ position: 159,
+ color: 'gray',
+ },
+ {
+ id: '67dc7930-eaa4-4ef0-9fc4-af996eaaae09',
+ value: 'SOMALIA',
+ label: 'Somalia 🇸🇴',
+ position: 160,
+ color: 'blue',
+ },
+ {
+ id: '19d96578-107c-4286-9504-5d59077b8290',
+ value: 'SOUTH_AFRICA',
+ label: 'South Africa 🇿🇦',
+ position: 161,
+ color: 'turquoise',
+ },
+ {
+ id: '11cb5cb6-d67d-47ae-adf1-ecba3635fe20',
+ value: 'SOUTH_KOREA',
+ label: 'South Korea 🇰🇷',
+ position: 162,
+ color: 'green',
+ },
+ {
+ id: '8293e893-0d7d-4002-9929-fea536a9a73c',
+ value: 'SOUTH_SUDAN',
+ label: 'South Sudan 🇸🇸',
+ position: 163,
+ color: 'sky',
+ },
+ {
+ id: 'e0b9ba99-d891-4f6c-95df-1f92a0a7e12e',
+ value: 'SPAIN',
+ label: 'Spain 🇪🇸',
+ position: 164,
+ color: 'purple',
+ },
+ {
+ id: '18378ce8-e480-4fd9-b90d-379d5daf7ecb',
+ value: 'SRI_LANKA',
+ label: 'Sri Lanka 🇱🇰',
+ position: 165,
+ color: 'orange',
+ },
+ {
+ id: '10943324-5ae5-47db-bb2f-5d4bdeafd0b0',
+ value: 'SUDAN',
+ label: 'Sudan 🇸🇩',
+ position: 166,
+ color: 'yellow',
+ },
+ {
+ id: 'bfd244e4-87c0-4dca-89b0-a1b581f1aa65',
+ value: 'SURINAME',
+ label: 'Suriname 🇸🇷',
+ position: 167,
+ color: 'red',
+ },
+ {
+ id: '6a8f9119-c413-4ece-b432-2ce2e80580a1',
+ value: 'SWEDEN',
+ label: 'Sweden 🇸🇪',
+ position: 168,
+ color: 'pink',
+ },
+ {
+ id: '866a8e2d-60a7-40a0-8541-35a9cfa20c09',
+ value: 'SWITZERLAND',
+ label: 'Switzerland 🇨🇭',
+ position: 169,
+ color: 'gray',
+ },
+ {
+ id: '93758334-0ebc-4884-bfac-c0dbeec23a35',
+ value: 'SYRIA',
+ label: 'Syria 🇸🇾',
+ position: 170,
+ color: 'blue',
+ },
+ {
+ id: 'c785e424-7a6f-4f27-91bc-aadb617525b0',
+ value: 'TAIWAN',
+ label: 'Taiwan 🇹🇼',
+ position: 171,
+ color: 'turquoise',
+ },
+ {
+ id: '15ab8a5b-5989-4e3b-92cb-00b88cf7b7f6',
+ value: 'TAJIKISTAN',
+ label: 'Tajikistan 🇹🇯',
+ position: 172,
+ color: 'green',
+ },
+ {
+ id: '476a55dd-8c69-4711-8e40-54cbe41d5c3a',
+ value: 'TANZANIA',
+ label: 'Tanzania 🇹🇿',
+ position: 173,
+ color: 'sky',
+ },
+ {
+ id: 'bfcbef16-36c4-4350-a614-7ad065276104',
+ value: 'THAILAND',
+ label: 'Thailand 🇹🇭',
+ position: 174,
+ color: 'purple',
+ },
+ {
+ id: '6872c804-9baa-498f-9dc6-b5894b64dece',
+ value: 'TIMOR_LESTE',
+ label: 'Timor-Leste 🇹🇱',
+ position: 175,
+ color: 'orange',
+ },
+ {
+ id: 'b6429782-b6e1-4404-a5c4-8a44f3818147',
+ value: 'TOGO',
+ label: 'Togo 🇹🇬',
+ position: 176,
+ color: 'yellow',
+ },
+ {
+ id: 'f4a7b7f9-aa58-4d23-adac-a96ed2c61ba1',
+ value: 'TONGA',
+ label: 'Tonga 🇹🇴',
+ position: 177,
+ color: 'red',
+ },
+ {
+ id: 'a1377467-7a21-40af-861f-4b362b30fcb4',
+ value: 'TRINIDAD_AND_TOBAGO',
+ label: 'Trinidad & Tobago 🇹🇹',
+ position: 178,
+ color: 'pink',
+ },
+ {
+ id: '7779c7d6-c7e1-4d6c-8282-31f659988c22',
+ value: 'TUNISIA',
+ label: 'Tunisia 🇹🇳',
+ position: 179,
+ color: 'gray',
+ },
+ {
+ id: '5858f81e-629a-4b04-98e8-6441f3984044',
+ value: 'TURKEY',
+ label: 'Turkey 🇹🇷',
+ position: 180,
+ color: 'blue',
+ },
+ {
+ id: 'cfdae353-6782-4dde-b229-d4e2c577fbed',
+ value: 'TURKMENISTAN',
+ label: 'Turkmenistan 🇹🇲',
+ position: 181,
+ color: 'turquoise',
+ },
+ {
+ id: '755d859a-a8d4-45e0-aa6e-77afcedb29d0',
+ value: 'TUVALU',
+ label: 'Tuvalu 🇹🇻',
+ position: 182,
+ color: 'green',
+ },
+ {
+ id: '3b325d46-b8e8-4cb9-9318-53f20baf50bd',
+ value: 'UGANDA',
+ label: 'Uganda 🇺🇬',
+ position: 183,
+ color: 'sky',
+ },
+ {
+ id: '10f32cd9-0a6b-4829-913d-50f519dcfc3a',
+ value: 'UKRAINE',
+ label: 'Ukraine 🇺🇦',
+ position: 184,
+ color: 'purple',
+ },
+ {
+ id: '0776427b-0dc1-49ef-b1c8-bb7dbba5a1e9',
+ value: 'UNITED_ARAB_EMIRATES',
+ label: 'UAE 🇦🇪',
+ position: 185,
+ color: 'orange',
+ },
+ {
+ id: 'edaf21dc-60d4-4550-8b58-2f7a19eedc92',
+ value: 'UNITED_KINGDOM',
+ label: 'UK 🇬🇧',
+ position: 186,
+ color: 'yellow',
+ },
+ {
+ id: '553004cd-aeed-4025-aa71-574efcade200',
+ value: 'UNITED_STATES',
+ label: 'USA 🇺🇸',
+ position: 187,
+ color: 'red',
+ },
+ {
+ id: 'f925d857-5cb7-467d-bc65-e5c04ae5a238',
+ value: 'URUGUAY',
+ label: 'Uruguay 🇺🇾',
+ position: 188,
+ color: 'pink',
+ },
+ {
+ id: '9b50ea41-2b8f-44d1-beeb-f4f4428289c4',
+ value: 'UZBEKISTAN',
+ label: 'Uzbekistan 🇺🇿',
+ position: 189,
+ color: 'gray',
+ },
+ {
+ id: 'a7a7cbfd-6999-42e8-874e-c2bfbe6ca567',
+ value: 'VANUATU',
+ label: 'Vanuatu 🇻🇺',
+ position: 190,
+ color: 'blue',
+ },
+ {
+ id: '7de0a670-8f04-444c-86dc-d7be00cc8b4e',
+ value: 'VATICAN',
+ label: 'Vatican 🇻🇦',
+ position: 191,
+ color: 'turquoise',
+ },
+ {
+ id: '9acc531c-7f17-4b67-804a-035c3c873cce',
+ value: 'VENEZUELA',
+ label: 'Venezuela 🇻🇪',
+ position: 192,
+ color: 'green',
+ },
+ {
+ id: '540b908e-f6b6-4f70-bb9c-c86dc5becbe7',
+ value: 'VIETNAM',
+ label: 'Vietnam 🇻🇳',
+ position: 193,
+ color: 'sky',
+ },
+ {
+ id: 'a70a3610-9a9b-4fe0-9e97-10d3e60a3d92',
+ value: 'YEMEN',
+ label: 'Yemen 🇾🇪',
+ position: 194,
+ color: 'purple',
+ },
+ {
+ id: 'fde30bd3-b2f1-4331-a255-9601259e807e',
+ value: 'ZAMBIA',
+ label: 'Zambia 🇿🇲',
+ position: 195,
+ color: 'orange',
+ },
+ {
+ id: 'a83060bf-f55b-4efe-9e0c-b856ad5446c4',
+ value: 'ZIMBABWE',
+ label: 'Zimbabwe 🇿🇼',
+ position: 196,
+ color: 'yellow',
+ },
+ ],
+ },
+ {
+ universalIdentifier: '560503de-6330-4c1d-af97-a8dee125f2ad',
+ type: FieldType.MULTI_SELECT,
+ name: 'region',
+ label: 'Region',
+ icon: 'IconWorld',
+ isNullable: true,
+ options: [
+ {
+ id: '735d7a75-c032-48b3-8480-c46e15b7e511',
+ value: 'EUROPE',
+ label: 'Europe',
+ position: 0,
+ color: 'blue',
+ },
+ {
+ id: '78eb8d0c-841e-48dd-8425-d8546cbcfe25',
+ value: 'US',
+ label: 'US',
+ position: 1,
+ color: 'red',
+ },
+ {
+ id: 'b0339081-52dd-4101-b7e7-83ed6ad6ca4f',
+ value: 'LATAM',
+ label: 'LATAM',
+ position: 2,
+ color: 'green',
+ },
+ {
+ id: 'f02bd583-87b8-48d1-97db-9395056c96e2',
+ value: 'MENA',
+ label: 'MENA',
+ position: 3,
+ color: 'orange',
+ },
+ {
+ id: '5205c25f-a300-4967-b5f3-033c0515a28a',
+ value: 'APAC',
+ label: 'APAC',
+ position: 4,
+ color: 'yellow',
+ },
+ {
+ id: '7f55cf70-8c81-4f68-83bc-270d215f0a4e',
+ value: 'AFRICA',
+ label: 'Africa',
+ position: 5,
+ color: 'pink',
+ },
],
},
{
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts
index dbb4e6eb688..7dbc5d84c64 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/mappers/save-my-partner-profile.mapper.test.ts
@@ -8,7 +8,10 @@ import {
describe('saveProfileSchema', () => {
it('accepts a valid partial payload', () => {
- const parsed = saveProfileSchema.safeParse({ name: 'Nine Dots Ventures', city: 'Paris' });
+ const parsed = saveProfileSchema.safeParse({
+ name: 'Nine Dots Ventures',
+ city: 'Paris',
+ });
expect(parsed.success).toBe(true);
});
@@ -22,7 +25,9 @@ describe('saveProfileSchema', () => {
});
it('rejects an unknown key (validationStage)', () => {
- const parsed = saveProfileSchema.safeParse({ validationStage: 'VALIDATED' });
+ const parsed = saveProfileSchema.safeParse({
+ validationStage: 'VALIDATED',
+ });
expect(parsed.success).toBe(false);
});
@@ -54,27 +59,35 @@ describe('saveProfileSchema', () => {
it('rejects a negative hourlyRate amount', () => {
expect(
- saveProfileSchema.safeParse({ hourlyRate: { amountMicros: -1, currencyCode: 'USD' } }).success,
+ saveProfileSchema.safeParse({
+ hourlyRate: { amountMicros: -1, currencyCode: 'USD' },
+ }).success,
).toBe(false);
});
it('rejects a non-ISO currency code', () => {
expect(
- saveProfileSchema.safeParse({ hourlyRate: { amountMicros: 100, currencyCode: 'DOLLARS' } })
- .success,
+ saveProfileSchema.safeParse({
+ hourlyRate: { amountMicros: 100, currencyCode: 'DOLLARS' },
+ }).success,
).toBe(false);
});
it('rejects a lowercase currency code (USD only)', () => {
expect(
- saveProfileSchema.safeParse({ hourlyRate: { amountMicros: 100, currencyCode: 'usd' } })
- .success,
+ saveProfileSchema.safeParse({
+ hourlyRate: { amountMicros: 100, currencyCode: 'usd' },
+ }).success,
).toBe(false);
});
it('accepts null for clearable country and enum fields', () => {
expect(
- saveProfileSchema.safeParse({ country: null, typeOfTeam: null, availability: null }).success,
+ saveProfileSchema.safeParse({
+ country: null,
+ typeOfTeam: null,
+ availability: null,
+ }).success,
).toBe(true);
});
});
@@ -90,12 +103,16 @@ describe('validateProfileOptionValues', () => {
});
it('rejects an unknown language', () => {
- const result = validateProfileOptionValues({ languagesSpoken: ['ENGLISH', 'KLINGON'] });
+ const result = validateProfileOptionValues({
+ languagesSpoken: ['ENGLISH', 'KLINGON'],
+ });
expect(result).toEqual({ error: 'Unknown language: KLINGON' });
});
it('rejects an unknown partner scope', () => {
- const result = validateProfileOptionValues({ partnerScope: ['NOT_A_SCOPE'] });
+ const result = validateProfileOptionValues({
+ partnerScope: ['NOT_A_SCOPE'],
+ });
expect(result?.error).toContain('NOT_A_SCOPE');
});
@@ -108,12 +125,16 @@ describe('validateProfileOptionValues', () => {
});
it('rejects an unknown region', () => {
- const result = validateProfileOptionValues({ region: ['EUROPE', 'ATLANTIS'] });
+ const result = validateProfileOptionValues({
+ region: ['EUROPE', 'ATLANTIS'],
+ });
expect(result).toEqual({ error: 'Unknown region: ATLANTIS' });
});
it('accepts known regions', () => {
- expect(validateProfileOptionValues({ region: ['EUROPE', 'MENA'] })).toBeNull();
+ expect(
+ validateProfileOptionValues({ region: ['EUROPE', 'MENA'] }),
+ ).toBeNull();
});
});
@@ -130,9 +151,15 @@ describe('buildPartnerUpdateData', () => {
calendarLink: 'https://cal.example.com/nine-dots',
});
- expect(data.website).toEqual({ primaryLinkUrl: 'https://ninedots.example.com' });
- expect(data.linkedin).toEqual({ primaryLinkUrl: 'https://linkedin.com/company/nine-dots' });
- expect(data.calendarLink).toEqual({ primaryLinkUrl: 'https://cal.example.com/nine-dots' });
+ expect(data.website).toEqual({
+ primaryLinkUrl: 'https://ninedots.example.com',
+ });
+ expect(data.linkedin).toEqual({
+ primaryLinkUrl: 'https://linkedin.com/company/nine-dots',
+ });
+ expect(data.calendarLink).toEqual({
+ primaryLinkUrl: 'https://cal.example.com/nine-dots',
+ });
});
it('maps a null LINKS field to null (clearing it)', () => {
@@ -146,8 +173,14 @@ describe('buildPartnerUpdateData', () => {
projectBudgetMin: { amountMicros: 1000000000, currencyCode: 'USD' },
});
- expect(data.hourlyRate).toEqual({ amountMicros: 150000000, currencyCode: 'USD' });
- expect(data.projectBudgetMin).toEqual({ amountMicros: 1000000000, currencyCode: 'USD' });
+ expect(data.hourlyRate).toEqual({
+ amountMicros: 150000000,
+ currencyCode: 'USD',
+ });
+ expect(data.projectBudgetMin).toEqual({
+ amountMicros: 1000000000,
+ currencyCode: 'USD',
+ });
});
it('maps a null CURRENCY field to null (clearing it)', () => {
@@ -182,13 +215,14 @@ describe('buildPartnerUpdateData', () => {
});
it('maps region values as provided', () => {
- expect(buildPartnerUpdateData({ region: ['EUROPE', 'MENA'] }).region).toEqual([
- 'EUROPE',
- 'MENA',
- ]);
+ expect(
+ buildPartnerUpdateData({ region: ['EUROPE', 'MENA'] }).region,
+ ).toEqual(['EUROPE', 'MENA']);
});
it('leaves region off the payload when absent', () => {
- expect('region' in buildPartnerUpdateData({ name: 'Nine Dots Ventures' })).toBe(false);
+ expect(
+ 'region' in buildPartnerUpdateData({ name: 'Nine Dots Ventures' }),
+ ).toBe(false);
});
});
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-case-studies.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-case-studies.navigation-menu-item.ts
index 0cdf085cc65..5aa1ba5bb61 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-case-studies.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-case-studies.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import { MY_CASE_STUDIES_NAV_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
diff --git a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-profile.navigation-menu-item.ts b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-profile.navigation-menu-item.ts
index 76480c80428..6d8c991dffc 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-profile.navigation-menu-item.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/modules/partner/self-service/navigation-menu-items/my-profile.navigation-menu-item.ts
@@ -1,4 +1,7 @@
-import { NavigationMenuItemType, defineNavigationMenuItem } from 'twenty-sdk/define';
+import {
+ NavigationMenuItemType,
+ defineNavigationMenuItem,
+} from 'twenty-sdk/define';
import {
MY_PROFILE_NAV_ITEM_ID,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts b/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts
index 90ade5cc1a5..75d0720930d 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/roles/partner.role.ts
@@ -272,7 +272,7 @@ export default defineRole({
fieldUniversalIdentifier: OPPORTUNITY_DESIGN_DOC_STATUS_FIELD_ID,
canUpdateFieldValue: false,
},
- // Marketplace brief fields — read-only for partners (listed briefs visible via RLS OR predicate).
+ // Marketplace brief fields — read-only for partners (listed briefs visible via RLS OR predicate).
{
objectUniversalIdentifier:
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.opportunity.universalIdentifier,
@@ -313,7 +313,8 @@ export default defineRole({
{
// Super partner — listed on the record page; partners can see it, cannot set it.
objectUniversalIdentifier: PARTNER_OBJECT_UNIVERSAL_IDENTIFIER,
- fieldUniversalIdentifier: PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,
+ fieldUniversalIdentifier:
+ PARTNER_SUPER_PARTNER_FIELD_UNIVERSAL_IDENTIFIER,
canUpdateFieldValue: false,
},
{
@@ -512,7 +513,8 @@ export default defineRole({
// owner/createdBy). An RLS predicate scopes this to the partner's own member record
// (see scripts/configure-partner-rls.ts) so the internal roster stays hidden.
objectUniversalIdentifier:
- STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember.universalIdentifier,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember
+ .universalIdentifier,
canReadObjectRecords: true,
canUpdateObjectRecords: false,
canSoftDeleteObjectRecords: false,
diff --git a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
index f13572e775b..d004c05d825 100644
--- a/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
+++ b/packages/twenty-apps/internal/twenty-partners/src/scripts/seed.ts
@@ -170,8 +170,7 @@ const PRIMARY_DEMO_PARTNER_CASE_STUDIES: DemoPartnerContent[] = [
headline: 'Standardizing regional handoffs across APAC and LATAM',
bodyMarkdown:
'In progress: rebuilding qualification and renewal workflows so cross-region teams share a single opportunity timeline.',
- caseStudyUrl:
- 'https://ninedots.example.com/case-studies/sunrise-expansion',
+ caseStudyUrl: 'https://ninedots.example.com/case-studies/sunrise-expansion',
position: 1,
},
{
@@ -408,8 +407,7 @@ const usd = (dollars: number) => ({
amountMicros: dollars * 1_000_000,
currencyCode: 'USD',
});
-const linkedin = (slug: string) =>
- `https://www.linkedin.com/company/${slug}`;
+const linkedin = (slug: string) => `https://www.linkedin.com/company/${slug}`;
type Partner = {
slug: string;
@@ -433,16 +431,238 @@ type Partner = {
};
const PARTNERS: Partner[] = [
- { slug: 'nine-dots-ventures', name: 'Nine Dots Ventures', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['EUROPE', 'MENA'], languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'], partnerTier: 'ADVANCED', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'FRANCE', city: 'Paris', hourlyRateUsd: 250, projectBudgetMinUsd: 15000, skills: ['Real estate', 'WhatsApp', 'Multi-language', 'Workflows', 'Integrations', 'AI'], superPartner: true },
- { slug: 'elevate-consulting', name: 'Elevate Consulting', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Revenue-operations partner for B2B SaaS teams scaling seed to Series C. Elevate moves teams off legacy CRMs onto Twenty with a four-week migration playbook, pipeline rebuilds, and analytics handoff.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['US', 'LATAM'], languagesSpoken: ['ENGLISH', 'SPANISH'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'Austin', hourlyRateUsd: 200, projectBudgetMinUsd: 20000, skills: ['RevOps', 'B2B SaaS', 'Data migration', 'Pipelines', 'Salesforce migration', 'HubSpot migration'] },
- { slug: 'w3villa-technologies', name: 'W3Villa Technologies', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'Engineering-heavy partner running large self-hosted Twenty deployments. Specializes in hardened Kubernetes hosting, custom integrations, and 24/7 support contracts for regulated industries across APAC and the Gulf.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'MENA'], languagesSpoken: ['ENGLISH', 'HINDI'], partnerTier: 'ADVANCED', partnerScope: ['HOSTING', 'DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'INDIA', city: 'Bangalore', hourlyRateUsd: 120, projectBudgetMinUsd: 10000, skills: ['Self-hosting', 'Kubernetes', 'DevOps', 'Integrations', 'Workflows', 'Enterprise support'] },
- { slug: 'act-education', name: 'Act Education', validationStage: 'VALIDATED', availability: 'UNAVAILABLE', introduction: 'CRM partner for European education providers; compliance-first self-hosting on EU infrastructure with full GDPR data residency and student-record workflows.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'NEW', partnerScope: ['HOSTING', 'SOLUTIONING'], typeOfTeam: 'SOLO', country: 'GERMANY', city: 'Berlin', hourlyRateUsd: 180, projectBudgetMinUsd: 8000, skills: ['Education', 'Compliance', 'Self-hosting', 'GDPR', 'Data privacy'] },
- { slug: 'netzero-systems', name: 'NetZero Systems', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'LATAM go-to-market partner for climate-tech and renewable-energy companies. Builds bilingual sales pipelines, ESG reporting, and grant-management workflows on top of Twenty.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['LATAM', 'US'], languagesSpoken: ['ENGLISH', 'SPANISH', 'PORTUGUESE'], partnerTier: 'INTERMEDIATE', partnerScope: ['SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'BRAZIL', city: 'São Paulo', hourlyRateUsd: 150, projectBudgetMinUsd: 12000, skills: ['Climate tech', 'Renewable energy', 'ESG reporting', 'Bilingual pipelines', 'LATAM go-to-market'] },
- { slug: 'meridian-craft', name: 'Meridian Craft', validationStage: 'VALIDATED', availability: 'AVAILABLE', introduction: 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['APAC', 'AFRICA'], languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'], partnerTier: 'ADVANCED', partnerScope: ['DEVELOPMENT', 'SOLUTIONING'], typeOfTeam: 'AGENCY', country: 'SINGAPORE', city: 'Singapore', hourlyRateUsd: 300, projectBudgetMinUsd: 25000, skills: ['Fintech', 'Logistics', 'APAC', 'High throughput', 'Custom apps', 'Performance tuning'], superPartner: true },
- { slug: 'applicant-studio', name: 'Applicant Studio', validationStage: 'APPLICATION', availability: 'UNAVAILABLE', introduction: 'New applicant; awaiting first review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'FRENCH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING'], typeOfTeam: 'SOLO', country: 'FRANCE', city: 'Lyon', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Boutique', 'Design'] },
- { slug: 'rising-crm', name: 'Rising CRM', validationStage: 'POTENTIAL', availability: 'AVAILABLE', introduction: 'Promising applicant in evaluation.', calendarLink: CAL, deploymentExpertise: ['CLOUD', 'SELF_HOST'], region: ['US'], languagesSpoken: ['ENGLISH'], partnerTier: 'NEW', partnerScope: ['SOLUTIONING', 'DEVELOPMENT'], typeOfTeam: 'AGENCY', country: 'UNITED_STATES', city: 'New York', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['SMB', 'Quick setup'] },
- { slug: 'legacy-partners', name: 'Legacy Partners', validationStage: 'FORMER', availability: 'UNAVAILABLE', introduction: 'Former partner; no longer active in the program.', calendarLink: CAL, deploymentExpertise: ['SELF_HOST'], region: ['EUROPE'], languagesSpoken: ['ENGLISH', 'GERMAN'], partnerTier: 'INTERMEDIATE', partnerScope: ['HOSTING'], typeOfTeam: 'AGENCY', country: 'UNITED_KINGDOM', city: 'London', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['Enterprise', 'Self-hosting'] },
- { slug: 'declined-co', name: 'Declined Co', validationStage: 'REJECTED', availability: 'UNAVAILABLE', introduction: 'Application rejected after review.', calendarLink: CAL, deploymentExpertise: ['CLOUD'], region: ['MENA'], languagesSpoken: ['ENGLISH', 'ARABIC'], partnerTier: 'NEW', partnerScope: ['DEVELOPMENT'], typeOfTeam: 'SOLO', country: 'UNITED_ARAB_EMIRATES', city: 'Dubai', hourlyRateUsd: null, projectBudgetMinUsd: null, skills: ['MENA', 'Arabic'] },
+ {
+ slug: 'nine-dots-ventures',
+ name: 'Nine Dots Ventures',
+ validationStage: 'VALIDATED',
+ availability: 'AVAILABLE',
+ introduction:
+ 'Boutique CRM implementer for real-estate workflows and WhatsApp automation. Nine Dots runs end-to-end Twenty rollouts for property managers and brokerages across Europe and MENA, with deep multi-language data models and AI-assisted lead intake.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD', 'SELF_HOST'],
+ region: ['EUROPE', 'MENA'],
+ languagesSpoken: ['ENGLISH', 'FRENCH', 'ARABIC'],
+ partnerTier: 'ADVANCED',
+ partnerScope: ['SOLUTIONING', 'DEVELOPMENT'],
+ typeOfTeam: 'AGENCY',
+ country: 'FRANCE',
+ city: 'Paris',
+ hourlyRateUsd: 250,
+ projectBudgetMinUsd: 15000,
+ skills: [
+ 'Real estate',
+ 'WhatsApp',
+ 'Multi-language',
+ 'Workflows',
+ 'Integrations',
+ 'AI',
+ ],
+ superPartner: true,
+ },
+ {
+ slug: 'elevate-consulting',
+ name: 'Elevate Consulting',
+ validationStage: 'VALIDATED',
+ availability: 'AVAILABLE',
+ introduction:
+ 'Revenue-operations partner for B2B SaaS teams scaling seed to Series C. Elevate moves teams off legacy CRMs onto Twenty with a four-week migration playbook, pipeline rebuilds, and analytics handoff.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD'],
+ region: ['US', 'LATAM'],
+ languagesSpoken: ['ENGLISH', 'SPANISH'],
+ partnerTier: 'INTERMEDIATE',
+ partnerScope: ['SOLUTIONING'],
+ typeOfTeam: 'AGENCY',
+ country: 'UNITED_STATES',
+ city: 'Austin',
+ hourlyRateUsd: 200,
+ projectBudgetMinUsd: 20000,
+ skills: [
+ 'RevOps',
+ 'B2B SaaS',
+ 'Data migration',
+ 'Pipelines',
+ 'Salesforce migration',
+ 'HubSpot migration',
+ ],
+ },
+ {
+ slug: 'w3villa-technologies',
+ name: 'W3Villa Technologies',
+ validationStage: 'VALIDATED',
+ availability: 'AVAILABLE',
+ introduction:
+ 'Engineering-heavy partner running large self-hosted Twenty deployments. Specializes in hardened Kubernetes hosting, custom integrations, and 24/7 support contracts for regulated industries across APAC and the Gulf.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD', 'SELF_HOST'],
+ region: ['APAC', 'MENA'],
+ languagesSpoken: ['ENGLISH', 'HINDI'],
+ partnerTier: 'ADVANCED',
+ partnerScope: ['HOSTING', 'DEVELOPMENT', 'SOLUTIONING'],
+ typeOfTeam: 'AGENCY',
+ country: 'INDIA',
+ city: 'Bangalore',
+ hourlyRateUsd: 120,
+ projectBudgetMinUsd: 10000,
+ skills: [
+ 'Self-hosting',
+ 'Kubernetes',
+ 'DevOps',
+ 'Integrations',
+ 'Workflows',
+ 'Enterprise support',
+ ],
+ },
+ {
+ slug: 'act-education',
+ name: 'Act Education',
+ validationStage: 'VALIDATED',
+ availability: 'UNAVAILABLE',
+ introduction:
+ 'CRM partner for European education providers; compliance-first self-hosting on EU infrastructure with full GDPR data residency and student-record workflows.',
+ calendarLink: CAL,
+ deploymentExpertise: ['SELF_HOST'],
+ region: ['EUROPE'],
+ languagesSpoken: ['ENGLISH', 'GERMAN'],
+ partnerTier: 'NEW',
+ partnerScope: ['HOSTING', 'SOLUTIONING'],
+ typeOfTeam: 'SOLO',
+ country: 'GERMANY',
+ city: 'Berlin',
+ hourlyRateUsd: 180,
+ projectBudgetMinUsd: 8000,
+ skills: ['Education', 'Compliance', 'Self-hosting', 'GDPR', 'Data privacy'],
+ },
+ {
+ slug: 'netzero-systems',
+ name: 'NetZero Systems',
+ validationStage: 'VALIDATED',
+ availability: 'AVAILABLE',
+ introduction:
+ 'LATAM go-to-market partner for climate-tech and renewable-energy companies. Builds bilingual sales pipelines, ESG reporting, and grant-management workflows on top of Twenty.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD'],
+ region: ['LATAM', 'US'],
+ languagesSpoken: ['ENGLISH', 'SPANISH', 'PORTUGUESE'],
+ partnerTier: 'INTERMEDIATE',
+ partnerScope: ['SOLUTIONING'],
+ typeOfTeam: 'AGENCY',
+ country: 'BRAZIL',
+ city: 'São Paulo',
+ hourlyRateUsd: 150,
+ projectBudgetMinUsd: 12000,
+ skills: [
+ 'Climate tech',
+ 'Renewable energy',
+ 'ESG reporting',
+ 'Bilingual pipelines',
+ 'LATAM go-to-market',
+ ],
+ },
+ {
+ slug: 'meridian-craft',
+ name: 'Meridian Craft',
+ validationStage: 'VALIDATED',
+ availability: 'AVAILABLE',
+ introduction:
+ 'APAC implementation studio for fintech and logistics. Senior team of ex-bank engineers building high-throughput Twenty deployments across Singapore, Hong Kong, and Kuala Lumpur.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD', 'SELF_HOST'],
+ region: ['APAC', 'AFRICA'],
+ languagesSpoken: ['ENGLISH', 'CHINESE', 'MALAY'],
+ partnerTier: 'ADVANCED',
+ partnerScope: ['DEVELOPMENT', 'SOLUTIONING'],
+ typeOfTeam: 'AGENCY',
+ country: 'SINGAPORE',
+ city: 'Singapore',
+ hourlyRateUsd: 300,
+ projectBudgetMinUsd: 25000,
+ skills: [
+ 'Fintech',
+ 'Logistics',
+ 'APAC',
+ 'High throughput',
+ 'Custom apps',
+ 'Performance tuning',
+ ],
+ superPartner: true,
+ },
+ {
+ slug: 'applicant-studio',
+ name: 'Applicant Studio',
+ validationStage: 'APPLICATION',
+ availability: 'UNAVAILABLE',
+ introduction: 'New applicant; awaiting first review.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD'],
+ region: ['EUROPE'],
+ languagesSpoken: ['ENGLISH', 'FRENCH'],
+ partnerTier: 'NEW',
+ partnerScope: ['SOLUTIONING'],
+ typeOfTeam: 'SOLO',
+ country: 'FRANCE',
+ city: 'Lyon',
+ hourlyRateUsd: null,
+ projectBudgetMinUsd: null,
+ skills: ['Boutique', 'Design'],
+ },
+ {
+ slug: 'rising-crm',
+ name: 'Rising CRM',
+ validationStage: 'POTENTIAL',
+ availability: 'AVAILABLE',
+ introduction: 'Promising applicant in evaluation.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD', 'SELF_HOST'],
+ region: ['US'],
+ languagesSpoken: ['ENGLISH'],
+ partnerTier: 'NEW',
+ partnerScope: ['SOLUTIONING', 'DEVELOPMENT'],
+ typeOfTeam: 'AGENCY',
+ country: 'UNITED_STATES',
+ city: 'New York',
+ hourlyRateUsd: null,
+ projectBudgetMinUsd: null,
+ skills: ['SMB', 'Quick setup'],
+ },
+ {
+ slug: 'legacy-partners',
+ name: 'Legacy Partners',
+ validationStage: 'FORMER',
+ availability: 'UNAVAILABLE',
+ introduction: 'Former partner; no longer active in the program.',
+ calendarLink: CAL,
+ deploymentExpertise: ['SELF_HOST'],
+ region: ['EUROPE'],
+ languagesSpoken: ['ENGLISH', 'GERMAN'],
+ partnerTier: 'INTERMEDIATE',
+ partnerScope: ['HOSTING'],
+ typeOfTeam: 'AGENCY',
+ country: 'UNITED_KINGDOM',
+ city: 'London',
+ hourlyRateUsd: null,
+ projectBudgetMinUsd: null,
+ skills: ['Enterprise', 'Self-hosting'],
+ },
+ {
+ slug: 'declined-co',
+ name: 'Declined Co',
+ validationStage: 'REJECTED',
+ availability: 'UNAVAILABLE',
+ introduction: 'Application rejected after review.',
+ calendarLink: CAL,
+ deploymentExpertise: ['CLOUD'],
+ region: ['MENA'],
+ languagesSpoken: ['ENGLISH', 'ARABIC'],
+ partnerTier: 'NEW',
+ partnerScope: ['DEVELOPMENT'],
+ typeOfTeam: 'SOLO',
+ country: 'UNITED_ARAB_EMIRATES',
+ city: 'Dubai',
+ hourlyRateUsd: null,
+ projectBudgetMinUsd: null,
+ skills: ['MENA', 'Arabic'],
+ },
];
// One contact per partner. The onboarding trigger matches a new member's email to a
@@ -450,16 +670,56 @@ const PARTNERS: Partner[] = [
// what auto-links a member to the partner. Each partner also gets its own Company.
type PartnerContact = { firstName: string; lastName: string; email: string };
const PARTNER_CONTACTS: Record<string, PartnerContact> = {
- 'nine-dots-ventures': { firstName: 'Yasmine', lastName: 'Haddad', email: '[email protected]' },
- 'elevate-consulting': { firstName: 'Diego', lastName: 'Ramirez', email: '[email protected]' },
- 'w3villa-technologies': { firstName: 'Arjun', lastName: 'Mehta', email: '[email protected]' },
- 'act-education': { firstName: 'Lena', lastName: 'Fischer', email: '[email protected]' },
- 'netzero-systems': { firstName: 'Beatriz', lastName: 'Costa', email: '[email protected]' },
- 'meridian-craft': { firstName: 'Mei', lastName: 'Lim', email: '[email protected]' },
- 'applicant-studio': { firstName: 'Hugo', lastName: 'Bernard', email: '[email protected]' },
- 'rising-crm': { firstName: 'Sarah', lastName: 'Johnson', email: '[email protected]' },
- 'legacy-partners': { firstName: 'Oliver', lastName: 'Smith', email: '[email protected]' },
- 'declined-co': { firstName: 'Omar', lastName: 'Farouk', email: '[email protected]' },
+ 'nine-dots-ventures': {
+ firstName: 'Yasmine',
+ lastName: 'Haddad',
+ email: '[email protected]',
+ },
+ 'elevate-consulting': {
+ firstName: 'Diego',
+ lastName: 'Ramirez',
+ email: '[email protected]',
+ },
+ 'w3villa-technologies': {
+ firstName: 'Arjun',
+ lastName: 'Mehta',
+ email: '[email protected]',
+ },
+ 'act-education': {
+ firstName: 'Lena',
+ lastName: 'Fischer',
+ email: '[email protected]',
+ },
+ 'netzero-systems': {
+ firstName: 'Beatriz',
+ lastName: 'Costa',
+ email: '[email protected]',
+ },
+ 'meridian-craft': {
+ firstName: 'Mei',
+ lastName: 'Lim',
+ email: '[email protected]',
+ },
+ 'applicant-studio': {
+ firstName: 'Hugo',
+ lastName: 'Bernard',
+ email: '[email protected]',
+ },
+ 'rising-crm': {
+ firstName: 'Sarah',
+ lastName: 'Johnson',
+ email: '[email protected]',
+ },
+ 'legacy-partners': {
+ firstName: 'Oliver',
+ lastName: 'Smith',
+ email: '[email protected]',
+ },
+ 'declined-co': {
+ firstName: 'Omar',
+ lastName: 'Farouk',
+ email: '[email protected]',
+ },
};
const partnerDomain = (slug: string): string => `https://${slug}.example`;
@@ -470,9 +730,24 @@ const COMPANIES = [
];
const PERSONS = [
- { firstName: 'Camille', lastName: 'Durand', companyName: 'Acme Real Estate', email: '[email protected]' },
- { firstName: 'Maya', lastName: 'Patel', companyName: 'Helix Bio', email: '[email protected]' },
- { firstName: 'Wei', lastName: 'Chen', companyName: 'Sunrise Logistics', email: '[email protected]' },
+ {
+ firstName: 'Camille',
+ lastName: 'Durand',
+ companyName: 'Acme Real Estate',
+ email: '[email protected]',
+ },
+ {
+ firstName: 'Maya',
+ lastName: 'Patel',
+ companyName: 'Helix Bio',
+ email: '[email protected]',
+ },
+ {
+ firstName: 'Wei',
+ lastName: 'Chen',
+ companyName: 'Sunrise Logistics',
+ email: '[email protected]',
+ },
];
type Opp = {
@@ -488,28 +763,139 @@ type Opp = {
// One+ opportunity for every stage value (all 5 covered).
const OPPORTUNITIES: Opp[] = [
- { name: 'Acme RE — Q3 renewal', companyName: 'Acme Real Estate', stage: 'NEW', numberOfSeats: 20, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'ANNUAL' },
- { name: 'Helix Bio — investor reporting', companyName: 'Helix Bio', stage: 'NEW', numberOfSeats: 12, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
- { name: 'Helix Bio — pipeline review', companyName: 'Helix Bio', stage: 'SCREENING', numberOfSeats: 8 },
- { name: 'Acme RE — CRM rollout', companyName: 'Acme Real Estate', stage: 'MEETING', partnerSlug: 'elevate-consulting', numberOfSeats: 30, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Sunrise — APAC fleet CRM', companyName: 'Sunrise Logistics', stage: 'MEETING', partnerSlug: 'nine-dots-ventures', numberOfSeats: 50, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Helix Bio — clinical trials CRM', companyName: 'Helix Bio', stage: 'PROPOSAL', partnerSlug: 'netzero-systems', numberOfSeats: 25, hostingType: 'CLOUD', subscriptionType: 'ORG', subscriptionFrequency: 'MONTHLY' },
- { name: 'Helix Bio — self-host evaluation', companyName: 'Helix Bio', stage: 'PROPOSAL', partnerSlug: 'meridian-craft', numberOfSeats: 40, hostingType: 'SELF_HOSTING', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Sunrise — LATAM expansion', companyName: 'Sunrise Logistics', stage: 'CUSTOMER', partnerSlug: 'nine-dots-ventures', numberOfSeats: 60, hostingType: 'CLOUD', subscriptionType: 'ENT', subscriptionFrequency: 'ANNUAL' },
- { name: 'Acme RE — annual review', companyName: 'Acme Real Estate', stage: 'CUSTOMER', partnerSlug: 'w3villa-technologies', numberOfSeats: 15 },
- { name: 'Sunrise — vendor onboarding', companyName: 'Sunrise Logistics', stage: 'SCREENING', numberOfSeats: 10, hostingType: 'CLOUD', subscriptionType: 'PRO', subscriptionFrequency: 'MONTHLY' },
+ {
+ name: 'Acme RE — Q3 renewal',
+ companyName: 'Acme Real Estate',
+ stage: 'NEW',
+ numberOfSeats: 20,
+ hostingType: 'CLOUD',
+ subscriptionType: 'PRO',
+ subscriptionFrequency: 'ANNUAL',
+ },
+ {
+ name: 'Helix Bio — investor reporting',
+ companyName: 'Helix Bio',
+ stage: 'NEW',
+ numberOfSeats: 12,
+ hostingType: 'CLOUD',
+ subscriptionType: 'ORG',
+ subscriptionFrequency: 'MONTHLY',
+ },
+ {
+ name: 'Helix Bio — pipeline review',
+ companyName: 'Helix Bio',
+ stage: 'SCREENING',
+ numberOfSeats: 8,
+ },
+ {
+ name: 'Acme RE — CRM rollout',
+ companyName: 'Acme Real Estate',
+ stage: 'MEETING',
+ partnerSlug: 'elevate-consulting',
+ numberOfSeats: 30,
+ hostingType: 'CLOUD',
+ subscriptionType: 'ENT',
+ subscriptionFrequency: 'ANNUAL',
+ },
+ {
+ name: 'Sunrise — APAC fleet CRM',
+ companyName: 'Sunrise Logistics',
+ stage: 'MEETING',
+ partnerSlug: 'nine-dots-ventures',
+ numberOfSeats: 50,
+ hostingType: 'SELF_HOSTING',
+ subscriptionType: 'ENT',
+ subscriptionFrequency: 'ANNUAL',
+ },
+ {
+ name: 'Helix Bio — clinical trials CRM',
+ companyName: 'Helix Bio',
+ stage: 'PROPOSAL',
+ partnerSlug: 'netzero-systems',
+ numberOfSeats: 25,
+ hostingType: 'CLOUD',
+ subscriptionType: 'ORG',
+ subscriptionFrequency: 'MONTHLY',
+ },
+ {
+ name: 'Helix Bio — self-host evaluation',
+ companyName: 'Helix Bio',
+ stage: 'PROPOSAL',
+ partnerSlug: 'meridian-craft',
+ numberOfSeats: 40,
+ hostingType: 'SELF_HOSTING',
+ subscriptionType: 'ENT',
+ subscriptionFrequency: 'ANNUAL',
+ },
+ {
+ name: 'Sunrise — LATAM expansion',
+ companyName: 'Sunrise Logistics',
+ stage: 'CUSTOMER',
+ partnerSlug: 'nine-dots-ventures',
+ numberOfSeats: 60,
+ hostingType: 'CLOUD',
+ subscriptionType: 'ENT',
+ subscriptionFrequency: 'ANNUAL',
+ },
+ {
+ name: 'Acme RE — annual review',
+ companyName: 'Acme Real Estate',
+ stage: 'CUSTOMER',
+ partnerSlug: 'w3villa-technologies',
+ numberOfSeats: 15,
+ },
+ {
+ name: 'Sunrise — vendor onboarding',
+ companyName: 'Sunrise Logistics',
+ stage: 'SCREENING',
+ numberOfSeats: 10,
+ hostingType: 'CLOUD',
+ subscriptionType: 'PRO',
+ subscriptionFrequency: 'MONTHLY',
+ },
];
-type Quote = { name: string; status: string; partnerSlug: string; contentType: string[] };
+type Quote = {
+ name: string;
+ status: string;
+ partnerSlug: string;
+ contentType: string[];
+};
const QUOTES: Quote[] = [
- { name: 'Sunrise APAC fleet — Nine Dots quote', status: 'WIP', partnerSlug: 'nine-dots-ventures', contentType: ['PARTNER_QUOTE'] },
- { name: 'Helix clinical — NetZero quote', status: 'INTERVIEW_SCHEDULED', partnerSlug: 'netzero-systems', contentType: ['PARTNER_QUOTE'] },
- { name: 'Acme rollout — Elevate quote', status: 'UNDER_CUSTOMER_PARTNER_REVIEW', partnerSlug: 'elevate-consulting', contentType: ['PARTNER_QUOTE'] },
- { name: 'Sunrise LATAM — Nine Dots quote', status: 'APPROVED', partnerSlug: 'nine-dots-ventures', contentType: ['PARTNER_QUOTE'] },
- { name: 'Helix self-host — Meridian quote', status: 'REJECTED', partnerSlug: 'meridian-craft', contentType: ['CASE_STUDY'] },
+ {
+ name: 'Sunrise APAC fleet — Nine Dots quote',
+ status: 'WIP',
+ partnerSlug: 'nine-dots-ventures',
+ contentType: ['PARTNER_QUOTE'],
+ },
+ {
+ name: 'Helix clinical — NetZero quote',
+ status: 'INTERVIEW_SCHEDULED',
+ partnerSlug: 'netzero-systems',
+ contentType: ['PARTNER_QUOTE'],
+ },
+ {
+ name: 'Acme rollout — Elevate quote',
+ status: 'UNDER_CUSTOMER_PARTNER_REVIEW',
+ partnerSlug: 'elevate-consulting',
+ contentType: ['PARTNER_QUOTE'],
+ },
+ {
+ name: 'Sunrise LATAM — Nine Dots quote',
+ status: 'APPROVED',
+ partnerSlug: 'nine-dots-ventures',
+ contentType: ['PARTNER_QUOTE'],
+ },
+ {
+ name: 'Helix self-host — Meridian quote',
+ status: 'REJECTED',
+ partnerSlug: 'meridian-craft',
+ contentType: ['CASE_STUDY'],
+ },
];
-const nodes = (r: any, key: string): any[] => (r?.[key]?.edges ?? []).map((e: any) => e.node);
+const nodes = (r: any, key: string): any[] =>
+ (r?.[key]?.edges ?? []).map((e: any) => e.node);
const withPartnerUserId = (
data: Record<string, unknown>,
@@ -522,9 +908,22 @@ async function upsertCompanyByName(
name: string,
domain: string,
): Promise<string> {
- const existing = nodes(await client.query({ companies: { __args: { filter: { name: { eq: name } }, first: 1 }, edges: { node: { id: true } } } } as any), 'companies');
+ const existing = nodes(
+ await client.query({
+ companies: {
+ __args: { filter: { name: { eq: name } }, first: 1 },
+ edges: { node: { id: true } },
+ },
+ } as any),
+ 'companies',
+ );
if (existing[0]?.id) return existing[0].id;
- const r: any = await client.mutation({ createCompany: { __args: { data: { name, domainName: { primaryLinkUrl: domain } } }, id: true } } as any);
+ const r: any = await client.mutation({
+ createCompany: {
+ __args: { data: { name, domainName: { primaryLinkUrl: domain } } },
+ id: true,
+ },
+ } as any);
return r.createCompany.id;
}
@@ -687,27 +1086,53 @@ async function upsertMarketplaceProfile(
async function main() {
const client = new CoreApiClient({
url: `${requireEnv('TWENTY_PARTNERS_API_URL').replace(/\/$/, '')}/graphql`,
- headers: { Authorization: `Bearer ${requireEnv('TWENTY_PARTNERS_API_KEY')}` },
+ headers: {
+ Authorization: `Bearer ${requireEnv('TWENTY_PARTNERS_API_KEY')}`,
+ },
});
// -- Partners (upsert by slug) --
const existingPartners = nodes(
- await client.query({ partners: { __args: { filter: { slug: { in: PARTNERS.map((p) => p.slug) } }, first: 100 }, edges: { node: { id: true, slug: true } } } } as any),
+ await client.query({
+ partners: {
+ __args: {
+ filter: { slug: { in: PARTNERS.map((p) => p.slug) } },
+ first: 100,
+ },
+ edges: { node: { id: true, slug: true } },
+ },
+ } as any),
'partners',
);
- const partnerIdBySlug = new Map<string, string>(existingPartners.map((n: any) => [n.slug, n.id]));
+ const partnerIdBySlug = new Map<string, string>(
+ existingPartners.map((n: any) => [n.slug, n.id]),
+ );
const companyIdByName = new Map<string, string>();
for (const p of PARTNERS) {
// Partner's own company — linked so the profile isn't bare and the contact has an employer.
- const companyId = await upsertCompanyByName(client, p.name, partnerDomain(p.slug));
+ const companyId = await upsertCompanyByName(
+ client,
+ p.name,
+ partnerDomain(p.slug),
+ );
companyIdByName.set(p.name, companyId);
const data = {
- name: p.name, slug: p.slug, validationStage: p.validationStage, availability: p.availability,
- introduction: p.introduction, calendarLink: { primaryLinkUrl: p.calendarLink },
- deploymentExpertise: p.deploymentExpertise, region: p.region, languagesSpoken: p.languagesSpoken,
- partnerTier: p.partnerTier, partnerScope: p.partnerScope, typeOfTeam: p.typeOfTeam,
- country: p.country, city: p.city,
- skills: p.skills, companyId,
+ name: p.name,
+ slug: p.slug,
+ validationStage: p.validationStage,
+ availability: p.availability,
+ introduction: p.introduction,
+ calendarLink: { primaryLinkUrl: p.calendarLink },
+ deploymentExpertise: p.deploymentExpertise,
+ region: p.region,
+ languagesSpoken: p.languagesSpoken,
+ partnerTier: p.partnerTier,
+ partnerScope: p.partnerScope,
+ typeOfTeam: p.typeOfTeam,
+ country: p.country,
+ city: p.city,
+ skills: p.skills,
+ companyId,
linkedin: { primaryLinkUrl: linkedin(p.slug) },
website: { primaryLinkUrl: partnerDomain(p.slug) },
profilePicture: {
@@ -715,13 +1140,19 @@ async function main() {
},
superPartner: p.superPartner === true,
...(p.hourlyRateUsd != null ? { hourlyRate: usd(p.hourlyRateUsd) } : {}),
- ...(p.projectBudgetMinUsd != null ? { projectBudgetMin: usd(p.projectBudgetMinUsd) } : {}),
+ ...(p.projectBudgetMinUsd != null
+ ? { projectBudgetMin: usd(p.projectBudgetMinUsd) }
+ : {}),
};
const id = partnerIdBySlug.get(p.slug);
if (id) {
- await client.mutation({ updatePartner: { __args: { id, data }, id: true } } as any);
+ await client.mutation({
+ updatePartner: { __args: { id, data }, id: true },
+ } as any);
} else {
- const r: any = await client.mutation({ createPartner: { __args: { data }, id: true } } as any);
+ const r: any = await client.mutation({
+ createPartner: { __args: { data }, id: true },
+ } as any);
partnerIdBySlug.set(p.slug, r.createPartner.id);
}
}
@@ -729,15 +1160,46 @@ async function main() {
// -- Companies (customer accounts, upsert by name) --
for (const c of COMPANIES) {
- companyIdByName.set(c.name, await upsertCompanyByName(client, c.name, c.domain));
+ companyIdByName.set(
+ c.name,
+ await upsertCompanyByName(client, c.name, c.domain),
+ );
}
// -- People (customer contacts, upsert by firstName+lastName) --
for (const person of PERSONS) {
- const existing = nodes(await client.query({ people: { __args: { filter: { name: { firstName: { eq: person.firstName } } }, first: 10 }, edges: { node: { id: true, name: { firstName: true, lastName: true } } } } } as any), 'people');
- const match = existing.find((n: any) => n.name?.firstName === person.firstName && n.name?.lastName === person.lastName);
+ const existing = nodes(
+ await client.query({
+ people: {
+ __args: {
+ filter: { name: { firstName: { eq: person.firstName } } },
+ first: 10,
+ },
+ edges: {
+ node: { id: true, name: { firstName: true, lastName: true } },
+ },
+ },
+ } as any),
+ 'people',
+ );
+ const match = existing.find(
+ (n: any) =>
+ n.name?.firstName === person.firstName &&
+ n.name?.lastName === person.lastName,
+ );
if (!match) {
- await client.mutation({ createPerson: { __args: { data: { name: { firstName: person.firstName, lastName: person.lastName }, emails: { primaryEmail: person.email }, companyId: companyIdByName.get(person.companyName) } }, id: true } } as any);
+ await client.mutation({
+ createPerson: {
+ __args: {
+ data: {
+ name: { firstName: person.firstName, lastName: person.lastName },
+ emails: { primaryEmail: person.email },
+ companyId: companyIdByName.get(person.companyName),
+ },
+ },
+ id: true,
+ },
+ } as any);
}
}
@@ -749,7 +1211,18 @@ async function main() {
partnerContactCount++;
const companyId = companyIdByName.get(p.name);
const partnerId = partnerIdBySlug.get(p.slug);
- const existing = nodes(await client.query({ people: { __args: { filter: { emails: { primaryEmail: { eq: contact.email } } }, first: 1 }, edges: { node: { id: true, partnerId: true, companyId: true } } } } as any), 'people');
+ const existing = nodes(
+ await client.query({
+ people: {
+ __args: {
+ filter: { emails: { primaryEmail: { eq: contact.email } } },
+ first: 1,
+ },
+ edges: { node: { id: true, partnerId: true, companyId: true } },
+ },
+ } as any),
+ 'people',
+ );
const found = existing[0];
if (found?.id) {
// Rerun against a workspace where the Person exists but lost its relations would leave
@@ -758,11 +1231,25 @@ async function main() {
if (!found.partnerId && partnerId) patch.partnerId = partnerId;
if (!found.companyId && companyId) patch.companyId = companyId;
if (Object.keys(patch).length > 0) {
- await client.mutation({ updatePerson: { __args: { id: found.id, data: patch }, id: true } } as any);
+ await client.mutation({
+ updatePerson: { __args: { id: found.id, data: patch }, id: true },
+ } as any);
}
continue;
}
- await client.mutation({ createPerson: { __args: { data: { name: { firstName: contact.firstName, lastName: contact.lastName }, emails: { primaryEmail: contact.email }, companyId, partnerId } }, id: true } } as any);
+ await client.mutation({
+ createPerson: {
+ __args: {
+ data: {
+ name: { firstName: contact.firstName, lastName: contact.lastName },
+ emails: { primaryEmail: contact.email },
+ companyId,
+ partnerId,
+ },
+ },
+ id: true,
+ },
+ } as any);
}
console.log(`[seed] partner contacts: ${partnerContactCount}`);
@@ -770,19 +1257,37 @@ async function main() {
const oppIdByName = new Map<string, string>();
for (const o of OPPORTUNITIES) {
const data: Record<string, unknown> = {
- name: o.name, stage: o.stage, companyId: companyIdByName.get(o.companyName),
- ...(o.partnerSlug ? { partnerId: partnerIdBySlug.get(o.partnerSlug) } : {}),
+ name: o.name,
+ stage: o.stage,
+ companyId: companyIdByName.get(o.companyName),
+ ...(o.partnerSlug
+ ? { partnerId: partnerIdBySlug.get(o.partnerSlug) }
+ : {}),
...(o.numberOfSeats != null ? { numberOfSeats: o.numberOfSeats } : {}),
...(o.hostingType ? { hostingType: o.hostingType } : {}),
...(o.subscriptionType ? { subscriptionType: o.subscriptionType } : {}),
- ...(o.subscriptionFrequency ? { subscriptionFrequency: o.subscriptionFrequency } : {}),
+ ...(o.subscriptionFrequency
+ ? { subscriptionFrequency: o.subscriptionFrequency }
+ : {}),
};
- const existing = nodes(await client.query({ opportunities: { __args: { filter: { name: { eq: o.name } }, first: 1 }, edges: { node: { id: true } } } } as any), 'opportunities');
+ const existing = nodes(
+ await client.query({
+ opportunities: {
+ __args: { filter: { name: { eq: o.name } }, first: 1 },
+ edges: { node: { id: true } },
+ },
+ } as any),
+ 'opportunities',
+ );
let id = existing[0]?.id;
if (id) {
- await client.mutation({ updateOpportunity: { __args: { id, data }, id: true } } as any);
+ await client.mutation({
+ updateOpportunity: { __args: { id, data }, id: true },
+ } as any);
} else {
- const r: any = await client.mutation({ createOpportunity: { __args: { data }, id: true } } as any);
+ const r: any = await client.mutation({
+ createOpportunity: { __args: { data }, id: true },
+ } as any);
id = r.createOpportunity.id;
}
oppIdByName.set(o.name, id);
@@ -843,9 +1348,7 @@ async function main() {
profile,
);
}
- console.log(
- `[seed] marketplace profiles: ${marketplacePartnerRows.length}`,
- );
+ console.log(`[seed] marketplace profiles: ${marketplacePartnerRows.length}`);
// -- Partner quotes (upsert by name) --
const partnerUserIdBySlug = new Map<string, string>(
@@ -883,18 +1386,35 @@ async function main() {
},
partnerUserId,
);
- const existing = nodes(await client.query({ partnerContents: { __args: { filter: { name: { eq: q.name } }, first: 1 }, edges: { node: { id: true } } } } as any), 'partnerContents');
+ const existing = nodes(
+ await client.query({
+ partnerContents: {
+ __args: { filter: { name: { eq: q.name } }, first: 1 },
+ edges: { node: { id: true } },
+ },
+ } as any),
+ 'partnerContents',
+ );
if (existing[0]?.id) {
- await client.mutation({ updatePartnerContent: { __args: { id: existing[0].id, data }, id: true } } as any);
+ await client.mutation({
+ updatePartnerContent: {
+ __args: { id: existing[0].id, data },
+ id: true,
+ },
+ } as any);
} else {
- await client.mutation({ createPartnerContent: { __args: { data }, id: true } } as any);
+ await client.mutation({
+ createPartnerContent: { __args: { data }, id: true },
+ } as any);
}
quoteCount++;
}
console.log(`[seed] partner quotes: ${quoteCount}`);
const backfillCount = await backfillPartnerUserOnChildren(client);
- console.log(`[seed] backfilled partnerUserId on ${backfillCount} child record(s)`);
+ console.log(
+ `[seed] backfilled partnerUserId on ${backfillCount} child record(s)`,
+ );
}
main().catch((err) => {
diff --git a/packages/twenty-docs/developers/extend/apps/data/objects.mdx b/packages/twenty-docs/developers/extend/apps/data/objects.mdx
index 5c8bfc5d5d2..eb3aa2f7de9 100644
--- a/packages/twenty-docs/developers/extend/apps/data/objects.mdx
+++ b/packages/twenty-docs/developers/extend/apps/data/objects.mdx
@@ -98,7 +98,7 @@ The full set of `FieldType` values, exported from `twenty-sdk/define`:
| Numeric | `NUMBER` (`universalSettings.dataType`: `'float'` / `'int'` / `'bigint'`), `NUMERIC` (arbitrary precision), `RATING`, `POSITION` |
| Dates | `DATE`, `DATE_TIME` |
| Choice | `BOOLEAN`, `SELECT`, `MULTI_SELECT` |
-| Composite | `FULL_NAME`, `ADDRESS`, `EMAILS`, `PHONES`, `LINKS`, `CURRENCY`, `ACTOR`, `FILES` |
+| Composite | `FULL_NAME`, `ADDRESS`, `EMAILS`, `PHONES`, `LINKS` (`universalSettings.type`: `'url'` (default) / `'domain'` — a domain field stores the bare host, so `https://www.acme.com/careers` is written as `acme.com`, and a value that is not a host is rejected), `CURRENCY`, `ACTOR`, `FILES` |
| Identifiers & relations | `UUID`, `RELATION`, `MORPH_RELATION` (see [Relations](/developers/extend/apps/data/relations)) |
| System | `TS_VECTOR` (full-text search vector, managed by the server) |
diff --git a/packages/twenty-e2e-testing/tests/create-record.spec.ts b/packages/twenty-e2e-testing/tests/create-record.spec.ts
index 562771aada8..f202c75c61c 100644
--- a/packages/twenty-e2e-testing/tests/create-record.spec.ts
+++ b/packages/twenty-e2e-testing/tests/create-record.spec.ts
@@ -45,98 +45,113 @@ const query = `query FindOnePerson($objectRecordId: UUID!) {
workPreference
updatedAt
}
-}`
+}`;
test('Create and update record', async ({ page }) => {
- await page.goto('/objects/people');
- await page.getByRole('button', { name: 'Create new Person' }).click();
-
- // Generate a random email for testing
- const randomEmail = `testuser_${Math.random().toString(36).substring(2, 10)}@example.com`;
- // Fill first name and last name
- const firstNameInput = page.getByRole('textbox', { name: 'F‌‌irst name' })
- await expect(firstNameInput).toBeFocused();
- await firstNameInput.fill('John');
- const lastNameInput = page.getByPlaceholder('L‌‌ast name');
- await expect(lastNameInput).toBeVisible();
- await lastNameInput.fill('Doe');
- await lastNameInput.press('Enter');
-
- // Focus on recordFieldList
- const recordFieldList = page.getByTestId('record-fields-widget');
- await expect(recordFieldList).toBeVisible();
- await recordFieldList.getByText('Emails').first().click();
-
- // Fill email
- const emailInput = recordFieldList.getByText('Emails').nth(1);
- await expect(emailInput).toBeVisible();
- await emailInput.click({ force: true });
- await page.getByPlaceholder('Email').fill(randomEmail);
- await page.keyboard.press('Enter');
- await recordFieldList.getByText('Emails').first().click();
-
-
- // Fill intro
- const introInput = recordFieldList.getByText('Intro').nth(1);
- await expect(introInput).toBeVisible();
- await introInput.click({ force: true });
- await introInput.click({ force: true });
- await page.getByPlaceholder('Intro').fill('This is an intro');
- await page.getByPlaceholder('Intro').press('Enter');
-
- // Fill URL
- await recordFieldList.getByText('Linkedin').first().click();
- const urlInput = recordFieldList.getByText('Linkedin').nth(1);
- await expect(urlInput).toBeVisible();
- await urlInput.click({ force: true });
- await page.getByPlaceholder('URL').fill('linkedin.com/johndoe');
- await page.getByPlaceholder('URL').press('Enter');
-
- // Click on 4th star to rate
- await recordFieldList.getByText('Performance Rating').first().click({ force: true });
- const ratingContainer = recordFieldList.locator('div[aria-label="Rating"]');
- await ratingContainer.locator('svg').nth(3).click({force: true});
-
- // Fill phone field
- await recordFieldList.getByText('Phones').first().click();
- const phoneInput = recordFieldList.getByText('Phones').nth(1);
- await expect(phoneInput).toBeVisible();
- await phoneInput.click({ force: true });
- await page.getByPlaceholder('Phone').fill('+336 1 122 3344');
- await page.getByPlaceholder('Phone').press('Enter');
-
- // Fill work preference
- await recordFieldList.getByText('Work Preference').first().click({force: true});
- await recordFieldList.getByText('Work Preference').nth(1).click({force: true});
- const options = page.getByRole('listbox');
- await options.getByText('Hybrid').first().click({force: true});
- recordFieldList.getByText('Work Preference').first().click({force: true});
-
- // Open full record page to get person ID
- await page.getByRole('button', { name: 'Expand record' }).click();
- await page.waitForURL(/\/object\/person\//);
- const newPersonId = page.url().match(/\/object\/person\/([a-f0-9-]+)/)?.[1];
-
- // Check data was saved
- const findOnePersonResponse = await postBackendGraphQL({
- page,
- data: {
- operationName: 'FindOnePerson',
- query,
- variables: {
- objectRecordId: newPersonId,
- }
+ await page.goto('/objects/people');
+ await page.getByRole('button', { name: 'Create new Person' }).click();
+
+ // Generate a random email for testing
+ const randomEmail = `testuser_${Math.random().toString(36).substring(2, 10)}@example.com`;
+ // Fill first name and last name
+ const firstNameInput = page.getByRole('textbox', { name: 'F‌‌irst name' });
+ await expect(firstNameInput).toBeFocused();
+ await firstNameInput.fill('John');
+ const lastNameInput = page.getByPlaceholder('L‌‌ast name');
+ await expect(lastNameInput).toBeVisible();
+ await lastNameInput.fill('Doe');
+ await lastNameInput.press('Enter');
+
+ // Focus on recordFieldList
+ const recordFieldList = page.getByTestId('record-fields-widget');
+ await expect(recordFieldList).toBeVisible();
+ await recordFieldList.getByText('Emails').first().click();
+
+ // Fill email
+ const emailInput = recordFieldList.getByText('Emails').nth(1);
+ await expect(emailInput).toBeVisible();
+ await emailInput.click({ force: true });
+ await page.getByPlaceholder('Email').fill(randomEmail);
+ await page.keyboard.press('Enter');
+ await recordFieldList.getByText('Emails').first().click();
+
+ // Fill intro
+ const introInput = recordFieldList.getByText('Intro').nth(1);
+ await expect(introInput).toBeVisible();
+ await introInput.click({ force: true });
+ await introInput.click({ force: true });
+ await page.getByPlaceholder('Intro').fill('This is an intro');
+ await page.getByPlaceholder('Intro').press('Enter');
+
+ // Fill URL
+ await recordFieldList.getByText('Linkedin').first().click();
+ const urlInput = recordFieldList.getByText('Linkedin').nth(1);
+ await expect(urlInput).toBeVisible();
+ await urlInput.click({ force: true });
+ await page.getByPlaceholder('URL').fill('linkedin.com/johndoe');
+ await page.getByPlaceholder('URL').press('Enter');
+
+ // Click on 4th star to rate
+ await recordFieldList
+ .getByText('Performance Rating')
+ .first()
+ .click({ force: true });
+ const ratingContainer = recordFieldList.locator('div[aria-label="Rating"]');
+ await ratingContainer.locator('svg').nth(3).click({ force: true });
+
+ // Fill phone field
+ await recordFieldList.getByText('Phones').first().click();
+ const phoneInput = recordFieldList.getByText('Phones').nth(1);
+ await expect(phoneInput).toBeVisible();
+ await phoneInput.click({ force: true });
+ await page.getByPlaceholder('Phone').fill('+336 1 122 3344');
+ await page.getByPlaceholder('Phone').press('Enter');
+
+ // Fill work preference
+ await recordFieldList
+ .getByText('Work Preference')
+ .first()
+ .click({ force: true });
+ await recordFieldList
+ .getByText('Work Preference')
+ .nth(1)
+ .click({ force: true });
+ const options = page.getByRole('listbox');
+ await options.getByText('Hybrid').first().click({ force: true });
+ recordFieldList.getByText('Work Preference').first().click({ force: true });
+
+ // Open full record page to get person ID
+ await page.getByRole('button', { name: 'Expand record' }).click();
+ await page.waitForURL(/\/object\/person\//);
+ const newPersonId = page.url().match(/\/object\/person\/([a-f0-9-]+)/)?.[1];
+
+ // Check data was saved
+ const findOnePersonResponse = await postBackendGraphQL({
+ page,
+ data: {
+ operationName: 'FindOnePerson',
+ query,
+ variables: {
+ objectRecordId: newPersonId,
},
- });
-
- const findOnePersonReponseBody = await findOnePersonResponse.json();
-
- expect(findOnePersonReponseBody.data.person.name.firstName).toBe('John');
- expect(findOnePersonReponseBody.data.person.name.lastName).toBe('Doe');
- expect(findOnePersonReponseBody.data.person.emails.primaryEmail).toBe(randomEmail);
- expect(findOnePersonReponseBody.data.person.intro).toBe('This is an intro');
- expect(findOnePersonReponseBody.data.person.linkedinLink.primaryLinkUrl).toBe('linkedin.com/johndoe');
- expect(findOnePersonReponseBody.data.person.phones.primaryPhoneNumber).toBe('611223344');
- expect(findOnePersonReponseBody.data.person.workPreference).toEqual(['HYBRID']);
-
+ },
+ });
+
+ const findOnePersonReponseBody = await findOnePersonResponse.json();
+
+ expect(findOnePersonReponseBody.data.person.name.firstName).toBe('John');
+ expect(findOnePersonReponseBody.data.person.name.lastName).toBe('Doe');
+ expect(findOnePersonReponseBody.data.person.emails.primaryEmail).toBe(
+ randomEmail,
+ );
+ expect(findOnePersonReponseBody.data.person.intro).toBe('This is an intro');
+ expect(findOnePersonReponseBody.data.person.linkedinLink.primaryLinkUrl).toBe(
+ 'linkedin.com/johndoe',
+ );
+ expect(findOnePersonReponseBody.data.person.phones.primaryPhoneNumber).toBe(
+ '611223344',
+ );
+ expect(findOnePersonReponseBody.data.person.workPreference).toEqual([
+ 'HYBRID',
+ ]);
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx
index 0efb584c0e5..08215608d47 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx
@@ -1,3 +1,4 @@
+import { getLinksVariant } from '@/object-record/spreadsheet-import/utils/getLinksVariant';
import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext';
import { useLinksField } from '@/object-record/record-field/ui/meta-types/hooks/useLinksField';
import { LinksFieldMenuItem } from '@/object-record/record-field/ui/meta-types/input/components/LinksFieldMenuItem';
@@ -9,7 +10,11 @@ import { linksFieldValueSchema } from '@/object-record/record-field/ui/validatio
import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';
import { useContext, useMemo } from 'react';
import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants';
-import { absoluteUrlSchema, isDefined } from 'twenty-shared/utils';
+import {
+ absoluteUrlSchema,
+ isDefined,
+ isValidDomain,
+} from 'twenty-shared/utils';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { MultiItemFieldInput } from './MultiItemFieldInput';
@@ -91,6 +96,17 @@ export const LinksFieldInput = () => {
fieldDefinition.metadata.settings?.maxNumberOfValues ??
MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES;
+ const isDomainField =
+ getLinksVariant({
+ type: FieldMetadataType.LINKS,
+ settings: fieldDefinition.metadata.settings,
+ }) === 'domain';
+
+ const validateInput = (input: string) =>
+ isDomainField
+ ? isValidDomain(input)
+ : absoluteUrlSchema.safeParse(input).success;
+
return (
<MultiItemFieldInput
items={links}
@@ -99,10 +115,10 @@ export const LinksFieldInput = () => {
onEnter={handleEnter}
onSubmit={handleSubmit}
onClickOutside={handleClickOutside}
- placeholder="URL"
+ placeholder={isDomainField ? 'Domain' : 'URL'}
fieldMetadataType={FieldMetadataType.LINKS}
validateInput={(input) => ({
- isValid: absoluteUrlSchema.safeParse(input).success,
+ isValid: validateInput(input),
errorMessage: '',
})}
onError={handleError}
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts
index 3b8a923a4a1..e80ffd089f6 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts
@@ -1,3 +1,4 @@
+import { getLinksVariant } from '@/object-record/spreadsheet-import/utils/getLinksVariant';
import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
@@ -112,6 +113,8 @@ export const useBuildSpreadsheetImportFields = () => {
fieldValidationDefinitions: getSpreadSheetFieldValidationDefinitions(
fieldMetadataItem.type,
fieldMetadataItem.label,
+ undefined,
+ getLinksVariant(fieldMetadataItem),
),
isNestedField: false,
...overrides,
@@ -144,6 +147,7 @@ export const useBuildSpreadsheetImportFields = () => {
fieldMetadataItem.type,
label,
subFieldName,
+ getLinksVariant(fieldMetadataItem),
),
isNestedField: true,
isCompositeSubField: true,
@@ -190,6 +194,7 @@ export const useBuildSpreadsheetImportFields = () => {
uniqueConstraintField.type,
uniqueConstraintField.name,
subFieldName,
+ getLinksVariant(uniqueConstraintField),
),
isNestedField: true,
isCompositeSubField: true,
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts
index a881d70e2e9..59498a64d5a 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/buildRecordFromImportedStructuredRow.ts
@@ -8,10 +8,12 @@ import {
} from '@/spreadsheet-import/types';
import { isNonEmptyString } from '@sniptt/guards';
import { parsePhoneNumberWithError, type CountryCode } from 'libphonenumber-js';
+import { type FieldMetadataSettings } from 'twenty-shared/types';
import {
assertUnreachable,
isDefined,
isEmptyObject,
+ getLinkUrlNormalizer,
normalizeUrlOrigin,
} from 'twenty-shared/utils';
import { z } from 'zod';
@@ -221,7 +223,6 @@ export const buildRecordFromImportedStructuredRow = ({
switch (field.type) {
case FieldMetadataType.CURRENCY:
case FieldMetadataType.ADDRESS:
- case FieldMetadataType.LINKS:
case FieldMetadataType.RICH_TEXT:
case FieldMetadataType.EMAILS:
case FieldMetadataType.FULL_NAME: {
@@ -235,6 +236,24 @@ export const buildRecordFromImportedStructuredRow = ({
}
break;
}
+ case FieldMetadataType.LINKS: {
+ const linksVariant = (
+ field.settings as FieldMetadataSettings<FieldMetadataType.LINKS>
+ )?.type;
+
+ const compositeData = buildCompositeFieldRecord(
+ field,
+ importedStructuredRow,
+ {
+ ...COMPOSITE_FIELD_TRANSFORM_CONFIGS[FieldMetadataType.LINKS],
+ primaryLinkUrl: getLinkUrlNormalizer(linksVariant),
+ },
+ );
+ if (isDefined(compositeData)) {
+ recordToBuild[field.name] = compositeData;
+ }
+ break;
+ }
case FieldMetadataType.PHONES: {
const compositeData = buildCompositeFieldRecord(
field,
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getLinksVariant.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getLinksVariant.ts
new file mode 100644
index 00000000000..dc3d4752bb5
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getLinksVariant.ts
@@ -0,0 +1,13 @@
+import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
+import {
+ type FieldLinksVariant,
+ type FieldMetadataSettings,
+ FieldMetadataType,
+} from 'twenty-shared/types';
+
+export const getLinksVariant = (
+ field: Pick<FieldMetadataItem, 'type' | 'settings'>,
+): FieldLinksVariant | undefined =>
+ field.type === FieldMetadataType.LINKS
+ ? (field.settings as FieldMetadataSettings<FieldMetadataType.LINKS>)?.type
+ : undefined;
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getSpreadSheetFieldValidationDefinitions.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getSpreadSheetFieldValidationDefinitions.ts
index 48d3304a165..c390510635f 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getSpreadSheetFieldValidationDefinitions.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/getSpreadSheetFieldValidationDefinitions.ts
@@ -6,12 +6,14 @@ import { parsePhoneNumberWithError } from 'libphonenumber-js';
import { RATING_VALUES } from 'twenty-shared/constants';
import {
absoluteUrlSchema,
+ isValidDomain,
emailSchema,
getCountryCodesForCallingCode,
isDefined,
isValidCountryCode,
isValidUuid,
} from 'twenty-shared/utils';
+import { type FieldLinksVariant } from 'twenty-shared/types';
import { FieldMetadataType } from '~/generated-metadata/graphql';
const getNumberValidationDefinition = (
@@ -41,7 +43,13 @@ export const getSpreadSheetFieldValidationDefinitions = (
type: FieldMetadataType,
fieldName: string,
subFieldKey?: string,
+ linksVariant?: FieldLinksVariant,
): SpreadsheetImportFieldValidationDefinition[] => {
+ const isValidLinkUrl = (url: string) =>
+ linksVariant === 'domain'
+ ? isValidDomain(url)
+ : absoluteUrlSchema.safeParse(url).success;
+
switch (type) {
case FieldMetadataType.NUMBER:
return [getNumberValidationDefinition(fieldName)];
@@ -105,7 +113,7 @@ export const getSpreadSheetFieldValidationDefinitions = (
rule: 'function',
isValid: (primaryLinkUrl: string) => {
if (!isDefined(primaryLinkUrl)) return true;
- return absoluteUrlSchema.safeParse(primaryLinkUrl).success;
+ return isValidLinkUrl(primaryLinkUrl);
},
errorMessage: `${fieldName} ${t`is not a valid URL`}`,
level: 'error',
@@ -121,7 +129,7 @@ export const getSpreadSheetFieldValidationDefinitions = (
const secondaryLinks = JSON.parse(stringifiedSecondaryLinks);
return secondaryLinks.every((link: { url: string }) => {
if (!isDefined(link.url)) return true;
- return absoluteUrlSchema.safeParse(link.url).success;
+ return isValidLinkUrl(link.url);
});
} catch {
return false;
diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetUnicityTableHook.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetUnicityTableHook.ts
index 84e9ff5fe66..263d219030a 100644
--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetUnicityTableHook.ts
+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetUnicityTableHook.ts
@@ -1,3 +1,4 @@
+import { getLinksVariant } from '@/object-record/spreadsheet-import/utils/getLinksVariant';
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType';
@@ -9,16 +10,17 @@ import {
type SpreadsheetImportTableHook,
} from '@/spreadsheet-import/types';
import { isNonEmptyString } from '@sniptt/guards';
-import { FieldMetadataType } from 'twenty-shared/types';
+import { type FieldLinksVariant, FieldMetadataType } from 'twenty-shared/types';
import {
getUniqueConstraintsFields,
isDefined,
- normalizeUrlOrigin,
+ getLinkUrlNormalizer,
} from 'twenty-shared/utils';
type Column = {
columnName: string;
fieldType: FieldMetadataType;
+ linksVariant?: FieldLinksVariant;
};
export const spreadsheetImportGetUnicityTableHook = (
@@ -43,10 +45,17 @@ export const spreadsheetImportGetUnicityTableHook = (
return uniqueSubFields.map((subField) => ({
columnName: getCompositeSubFieldKey(field, subField.subFieldName),
fieldType: field.type,
+ linksVariant: getLinksVariant(field),
}));
}
- return [{ columnName: field.name, fieldType: field.type }];
+ return [
+ {
+ columnName: field.name,
+ fieldType: field.type,
+ linksVariant: undefined,
+ },
+ ];
}),
);
const tableHook: SpreadsheetImportTableHook = (table, addError) => {
@@ -95,7 +104,7 @@ const getUniqueValues = (
uniqueConstraint: Column[],
) => {
return uniqueConstraint
- .map(({ columnName, fieldType }) => {
+ .map(({ columnName, fieldType, linksVariant }) => {
// need to ensure the primary link url is processed before import as on server side
if (
fieldType === FieldMetadataType.LINKS &&
@@ -104,7 +113,9 @@ const getUniqueValues = (
.primaryLinkUrl,
)
) {
- return normalizeUrlOrigin(row?.[columnName]?.toString().trim() || '');
+ const rawPrimaryLinkUrl = row?.[columnName]?.toString().trim() || '';
+
+ return getLinkUrlNormalizer(linksVariant)(rawPrimaryLinkUrl);
}
return row?.[columnName]?.toString().trim().toLowerCase();
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldLinksVariantForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldLinksVariantForm.tsx
new file mode 100644
index 00000000000..43ccd9cf983
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldLinksVariantForm.tsx
@@ -0,0 +1,81 @@
+import { Controller, useFormContext } from 'react-hook-form';
+
+import { useFieldMetadataItemById } from '@/object-metadata/hooks/useFieldMetadataItemById';
+import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
+import { type SettingsDataModelFieldLinksVariantFormValues } from '@/settings/data-model/fields/forms/utils/settingsDataModelFieldLinksVariantSchema';
+import { Select } from '@/ui/input/components/Select';
+import { useLingui } from '@lingui/react/macro';
+import {
+ type FieldLinksVariant,
+ type FieldMetadataSettings,
+ type FieldMetadataType,
+} from 'twenty-shared/types';
+import { IconWorld } from 'twenty-ui/icon';
+
+type SettingsDataModelFieldLinksVariantFormProps = {
+ disabled?: boolean;
+ existingFieldMetadataId: string;
+};
+
+const DEFAULT_LINKS_VARIANT: FieldLinksVariant = 'url';
+
+export const SettingsDataModelFieldLinksVariantForm = ({
+ disabled,
+ existingFieldMetadataId,
+}: SettingsDataModelFieldLinksVariantFormProps) => {
+ const { t } = useLingui();
+ const { control } =
+ useFormContext<SettingsDataModelFieldLinksVariantFormValues>();
+
+ const { fieldMetadataItem } = useFieldMetadataItemById(
+ existingFieldMetadataId,
+ );
+
+ const options = [
+ { label: t`URL`, value: 'url' as const },
+ { label: t`Domain`, value: 'domain' as const },
+ ];
+
+ const existingSettings =
+ (fieldMetadataItem?.settings as FieldMetadataSettings<FieldMetadataType.LINKS>) ??
+ {};
+
+ return (
+ <Controller
+ name="settings"
+ control={control}
+ defaultValue={{
+ ...existingSettings,
+ type: existingSettings?.type ?? DEFAULT_LINKS_VARIANT,
+ }}
+ render={({ field: { value, onChange } }) => {
+ const currentSettings = value ?? {};
+
+ return (
+ <SettingsOptionCardContentSelect
+ Icon={IconWorld}
+ title={t`Link content`}
+ description={t`Domain links are stored as a bare domain name, so twenty.com and https://www.twenty.com are the same value`}
+ disabled={disabled}
+ >
+ <Select<FieldLinksVariant>
+ dropdownWidth={180}
+ value={currentSettings.type ?? DEFAULT_LINKS_VARIANT}
+ onChange={(newValue) =>
+ onChange({
+ ...currentSettings,
+ type: newValue,
+ })
+ }
+ disabled={disabled}
+ dropdownId="field-links-variant-select"
+ options={options}
+ selectSizeVariant="small"
+ withSearchInput={false}
+ />
+ </SettingsOptionCardContentSelect>
+ );
+ }}
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard.tsx
index 432d3eef909..b36b0b5d54c 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldSettingsFormCard.tsx
@@ -28,9 +28,11 @@ import { SettingsDataModelFieldSelectSettingsFormCard } from '@/settings/data-mo
import { SettingsDataModelFieldPreviewWidget } from '@/settings/data-model/fields/preview/components/SettingsDataModelFieldPreviewWidget';
import { Separator } from '@/settings/components/Separator';
+import { SettingsDataModelFieldLinksVariantForm } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldLinksVariantForm';
import { SettingsDataModelFieldOnClickActionForm } from '@/settings/data-model/fields/forms/components/SettingsDataModelFieldOnClickActionForm';
import { SettingsDataModelFieldRelationFormCard } from '@/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard';
import { mergeSettingsSchemas } from '@/settings/data-model/fields/forms/utils/mergeSettingsSchema';
+import { settingsDataModelFieldLinksVariantSchema } from '@/settings/data-model/fields/forms/utils/settingsDataModelFieldLinksVariantSchema';
import { settingsDataModelFieldMaxValuesSchema } from '@/settings/data-model/fields/forms/utils/settingsDataModelFieldMaxValuesSchema';
import { settingsDataModelFieldOnClickActionSchema } from '@/settings/data-model/fields/forms/utils/settingsDataModelFieldOnClickActionSchema';
import { useFormContext } from 'react-hook-form';
@@ -114,6 +116,7 @@ const linksFieldFormSchema = z
mergeSettingsSchemas(
settingsDataModelFieldMaxValuesSchema,
settingsDataModelFieldOnClickActionSchema,
+ settingsDataModelFieldLinksVariantSchema,
),
)
.extend(isUniqueFieldFormSchema.shape);
@@ -352,6 +355,15 @@ export const SettingsDataModelFieldSettingsFormCard = ({
<Separator />
</>
)}
+ {fieldType === FieldMetadataType.LINKS && (
+ <>
+ <SettingsDataModelFieldLinksVariantForm
+ existingFieldMetadataId={existingFieldMetadataId}
+ disabled={disabled}
+ />
+ <Separator />
+ </>
+ )}
{[FieldMetadataType.EMAILS, FieldMetadataType.LINKS].includes(
fieldType,
) && (
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/utils/settingsDataModelFieldLinksVariantSchema.ts b/packages/twenty-front/src/modules/settings/data-model/fields/forms/utils/settingsDataModelFieldLinksVariantSchema.ts
new file mode 100644
index 00000000000..b81aee34262
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/utils/settingsDataModelFieldLinksVariantSchema.ts
@@ -0,0 +1,12 @@
+import { FIELD_LINKS_VARIANTS } from 'twenty-shared/types';
+import { z } from 'zod';
+
+export const settingsDataModelFieldLinksVariantSchema = z.object({
+ settings: z.object({
+ type: z.enum(FIELD_LINKS_VARIANTS).optional(),
+ }),
+});
+
+export type SettingsDataModelFieldLinksVariantFormValues = z.infer<
+ typeof settingsDataModelFieldLinksVariantSchema
+>;
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-upgrade-version-command.module.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-upgrade-version-command.module.ts
index 0cc4c3aacbf..bcc6b8b1e89 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-upgrade-version-command.module.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-upgrade-version-command.module.ts
@@ -1,6 +1,7 @@
import { Module } from '@nestjs/common';
import { WorkspaceIteratorModule } from 'src/database/commands/command-runners/workspace-iterator.module';
+import { NormalizeCompanyDomainNamesCommand } from 'src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787935130000-normalize-company-domain-names.command';
import { AddBlocklistScopeFieldCommand } from 'src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787933689056-add-blocklist-scope-field.command';
import { EnableEditLayoutAcrossAppCommand } from 'src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787906715270-enable-edit-layout-across-app.command';
import { BackfillLinkedTimelineActivityHappensAtCommand } from 'src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787914663665-backfill-linked-timeline-activity-happens-at.command';
@@ -21,6 +22,7 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace
WorkspaceSchemaManagerModule,
],
providers: [
+ NormalizeCompanyDomainNamesCommand,
AddBlocklistScopeFieldCommand,
EnableEditLayoutAcrossAppCommand,
BackfillLinkedTimelineActivityHappensAtCommand,
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787935130000-normalize-company-domain-names.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787935130000-normalize-company-domain-names.command.ts
new file mode 100644
index 00000000000..19043484902
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/2-38-workspace-command-1787935130000-normalize-company-domain-names.command.ts
@@ -0,0 +1,226 @@
+import { Command } from 'nest-commander';
+import { isDefined } from 'twenty-shared/utils';
+
+import { ProvisionedWorkspaceCommandRunner } from 'src/database/commands/command-runners/provisioned-workspace.command-runner';
+import { WorkspaceIteratorService } from 'src/database/commands/command-runners/workspace-iterator.service';
+import { type RunOnWorkspaceArgs } from 'src/database/commands/command-runners/workspace.command-runner';
+import { buildCompanyDomainNameCandidatesQuery } from 'src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-candidates-query.util';
+import { buildCompanyDomainNameUpdateQuery } from 'src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-update-query.util';
+import { buildDomainNameSettingsPatchQuery } from 'src/database/commands/upgrade-version-command/2-38/utils/build-domain-name-settings-patch-query.util';
+import {
+ type CompanyDomainNameRewrite,
+ computeCompanyDomainNameRewrites,
+} from 'src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util';
+import { type DomainNameLinks } from 'src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util';
+import { partitionCompanyDomainNameRewrites } from 'src/database/commands/upgrade-version-command/2-38/utils/partition-company-domain-name-rewrites.util';
+import { RegisteredWorkspaceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-workspace-command.decorator';
+import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';
+import { getWorkspaceSchemaName } from 'src/engine/workspace-datasource/utils/get-workspace-schema-name.util';
+
+const BACKFILL_BATCH_SIZE = 20000;
+const FIRST_COMPANY_ID = '00000000-0000-0000-0000-000000000000';
+
+type WorkspaceDataSource = NonNullable<RunOnWorkspaceArgs['dataSource']>;
+
+@RegisteredWorkspaceCommand('2.38.0', 1787935130000)
+@Command({
+ name: 'upgrade:2-38:normalize-company-domain-names',
+ description:
+ 'Rewrite company domain names to the bare canonical domain now written by the domain-typed LINKS field, so contact auto-creation matches them exactly',
+})
+export class NormalizeCompanyDomainNamesCommand extends ProvisionedWorkspaceCommandRunner {
+ constructor(
+ protected readonly workspaceIteratorService: WorkspaceIteratorService,
+ private readonly workspaceCacheService: WorkspaceCacheService,
+ ) {
+ super(workspaceIteratorService);
+ }
+
+ override async runOnWorkspace({
+ workspaceId,
+ options,
+ dataSource,
+ }: RunOnWorkspaceArgs): Promise<void> {
+ if (!isDefined(dataSource)) {
+ return;
+ }
+
+ const isDryRun = options.dryRun ?? false;
+ const schemaName = getWorkspaceSchemaName(workspaceId);
+
+ const hasCompanyTable = await this.hasCompanyTable({
+ dataSource,
+ schemaName,
+ });
+
+ if (!hasCompanyTable) {
+ return;
+ }
+
+ await this.markDomainNameFieldAsDomainTyped({
+ dataSource,
+ workspaceId,
+ isDryRun,
+ });
+
+ let afterCompanyId = FIRST_COMPANY_ID;
+ let updatedCount = 0;
+ const skippedCompanyIds: string[] = [];
+
+ for (;;) {
+ const candidates = await this.findNextCandidates({
+ dataSource,
+ schemaName,
+ afterCompanyId,
+ });
+
+ if (candidates.length === 0) {
+ break;
+ }
+
+ afterCompanyId = candidates[candidates.length - 1].id;
+
+ const rewrites = computeCompanyDomainNameRewrites(candidates);
+
+ const { updates, skippedCompanyIds: skippedInBatch } =
+ partitionCompanyDomainNameRewrites({
+ rewrites,
+ claimedPrimaryLinkUrls: await this.findClaimedPrimaryLinkUrls({
+ dataSource,
+ schemaName,
+ rewrites,
+ }),
+ });
+
+ skippedCompanyIds.push(...skippedInBatch);
+ updatedCount += updates.length;
+
+ if (updates.length > 0 && !isDryRun) {
+ const updateQuery = buildCompanyDomainNameUpdateQuery({
+ schemaName,
+ updates,
+ });
+
+ await dataSource.query(updateQuery.sql, updateQuery.parameters);
+ }
+
+ if (candidates.length < BACKFILL_BATCH_SIZE) {
+ break;
+ }
+ }
+
+ if (updatedCount === 0 && skippedCompanyIds.length === 0) {
+ return;
+ }
+
+ this.logger.log(
+ `${isDryRun ? '[DRY RUN] ' : ''}Normalized ${updatedCount} company domain name(s) for workspace ${workspaceId}`,
+ );
+
+ if (skippedCompanyIds.length > 0) {
+ this.logger.warn(
+ `Left ${skippedCompanyIds.length} company domain name(s) unnormalized in workspace ${workspaceId} because another company already holds the normalized domain, these need a merge: ${skippedCompanyIds.join(', ')}`,
+ );
+ }
+ }
+
+ private async markDomainNameFieldAsDomainTyped({
+ dataSource,
+ workspaceId,
+ isDryRun,
+ }: {
+ dataSource: WorkspaceDataSource;
+ workspaceId: string;
+ isDryRun: boolean;
+ }): Promise<void> {
+ if (isDryRun) {
+ return;
+ }
+
+ const { sql, parameters } = buildDomainNameSettingsPatchQuery(workspaceId);
+ const [, patchedFieldCount] = await dataSource.query<[unknown[], number]>(
+ sql,
+ parameters,
+ );
+
+ if (patchedFieldCount === 0) {
+ return;
+ }
+
+ await this.workspaceCacheService.invalidateAndRecompute(workspaceId, [
+ 'flatFieldMetadataMaps',
+ ]);
+ }
+
+ private async hasCompanyTable({
+ dataSource,
+ schemaName,
+ }: {
+ dataSource: WorkspaceDataSource;
+ schemaName: string;
+ }): Promise<boolean> {
+ const [row] = await dataSource.query<{ exists: boolean }[]>(
+ `SELECT to_regclass($1) IS NOT NULL AS "exists"`,
+ [`"${schemaName}"."company"`],
+ );
+
+ return row?.exists === true;
+ }
+
+ private async findNextCandidates({
+ dataSource,
+ schemaName,
+ afterCompanyId,
+ }: {
+ dataSource: WorkspaceDataSource;
+ schemaName: string;
+ afterCompanyId: string;
+ }): Promise<{ id: string; domainName: DomainNameLinks }[]> {
+ const { sql, parameters } = buildCompanyDomainNameCandidatesQuery({
+ schemaName,
+ batchSize: BACKFILL_BATCH_SIZE,
+ afterCompanyId,
+ });
+
+ const rows = await dataSource.query<({ id: string } & DomainNameLinks)[]>(
+ sql,
+ parameters,
+ );
+
+ return rows.map(({ id, ...domainName }) => ({ id, domainName }));
+ }
+
+ private async findClaimedPrimaryLinkUrls({
+ dataSource,
+ schemaName,
+ rewrites,
+ }: {
+ dataSource: WorkspaceDataSource;
+ schemaName: string;
+ rewrites: CompanyDomainNameRewrite[];
+ }): Promise<Set<string>> {
+ const desiredPrimaryLinkUrls = rewrites.map(
+ ({ domainName }) => domainName.primaryLinkUrl,
+ );
+
+ if (desiredPrimaryLinkUrls.length === 0) {
+ return new Set();
+ }
+
+ const rows = await dataSource.query<
+ { domainNamePrimaryLinkUrl: string }[]
+ >(
+ `
+SELECT company."domainNamePrimaryLinkUrl"
+FROM "${schemaName}"."company" company
+WHERE company."domainNamePrimaryLinkUrl" = ANY($1::text[])
+ AND company."id" <> ALL($2::uuid[])
+`,
+ [desiredPrimaryLinkUrls, rewrites.map(({ id }) => id)],
+ );
+
+ return new Set(
+ rows.map(({ domainNamePrimaryLinkUrl }) => domainNamePrimaryLinkUrl),
+ );
+ }
+}
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/build-company-domain-name-update-query.util.spec.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/build-company-domain-name-update-query.util.spec.ts
new file mode 100644
index 00000000000..00c12df1f54
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/build-company-domain-name-update-query.util.spec.ts
@@ -0,0 +1,50 @@
+import { buildCompanyDomainNameUpdateQuery } from 'src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-update-query.util';
+
+describe('buildCompanyDomainNameUpdateQuery', () => {
+ it('should send one statement carrying every row', () => {
+ const { sql, parameters } = buildCompanyDomainNameUpdateQuery({
+ schemaName: 'workspace_test',
+ updates: [
+ {
+ id: 'acme-id',
+ domainName: {
+ primaryLinkUrl: 'acme.com',
+ secondaryLinks: [{ url: 'beta.com', label: '' }],
+ },
+ },
+ {
+ id: 'crm-id',
+ domainName: {
+ primaryLinkUrl: 'crm.dev',
+ secondaryLinks: null,
+ },
+ },
+ ],
+ });
+
+ expect(sql).toContain('"workspace_test"."company"');
+ expect(sql).toContain('unnest($1::uuid[], $2::text[], $3::jsonb[])');
+ expect(parameters).toEqual([
+ ['acme-id', 'crm-id'],
+ ['acme.com', 'crm.dev'],
+ ['[{"url":"beta.com","label":""}]', null],
+ ]);
+ });
+
+ it('should pass a null rather than a json null when a company has no secondary link', () => {
+ const { parameters } = buildCompanyDomainNameUpdateQuery({
+ schemaName: 'workspace_test',
+ updates: [
+ {
+ id: 'crm-id',
+ domainName: {
+ primaryLinkUrl: 'crm.dev',
+ secondaryLinks: null,
+ },
+ },
+ ],
+ });
+
+ expect(parameters[2]).toEqual([null]);
+ });
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/normalize-domain-name-links.util.spec.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/normalize-domain-name-links.util.spec.ts
new file mode 100644
index 00000000000..4962abfb9bd
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/normalize-domain-name-links.util.spec.ts
@@ -0,0 +1,66 @@
+import { normalizeDomainNameLinks } from 'src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util';
+
+describe('normalizeDomainNameLinks', () => {
+ it('should rewrite a url-shaped primary link to its bare domain', () => {
+ expect(
+ normalizeDomainNameLinks({
+ primaryLinkUrl: 'https://www.twenty.com/careers',
+ secondaryLinks: null,
+ }),
+ ).toEqual({
+ changed: true,
+ value: {
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: null,
+ },
+ });
+ });
+
+ it('should rewrite secondary links too', () => {
+ expect(
+ normalizeDomainNameLinks({
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: 'HTTPS://Twenty-CRM.com/', label: 'Old' }],
+ }),
+ ).toEqual({
+ changed: true,
+ value: {
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: 'twenty-crm.com', label: 'Old' }],
+ },
+ });
+ });
+
+ it('should report no change when every link is already a bare domain', () => {
+ expect(
+ normalizeDomainNameLinks({
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: 'crm.dev', label: '' }],
+ }).changed,
+ ).toBe(false);
+ });
+
+ it('should leave a secondary link without a url untouched', () => {
+ expect(
+ normalizeDomainNameLinks({
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: '', label: 'Old' }],
+ }),
+ ).toEqual({
+ changed: false,
+ value: {
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: '', label: 'Old' }],
+ },
+ });
+ });
+
+ it('should report no change for a company without a domain', () => {
+ expect(
+ normalizeDomainNameLinks({
+ primaryLinkUrl: '',
+ secondaryLinks: null,
+ }).changed,
+ ).toBe(false);
+ });
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/partition-company-domain-name-rewrites.util.spec.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/partition-company-domain-name-rewrites.util.spec.ts
new file mode 100644
index 00000000000..52965db0d96
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/__tests__/partition-company-domain-name-rewrites.util.spec.ts
@@ -0,0 +1,69 @@
+import { computeCompanyDomainNameRewrites } from 'src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util';
+import { partitionCompanyDomainNameRewrites } from 'src/database/commands/upgrade-version-command/2-38/utils/partition-company-domain-name-rewrites.util';
+
+const candidate = (
+ id: string,
+ primaryLinkUrl: string,
+ secondaryLinks: { url: string; label: string }[] | null = null,
+) => ({
+ id,
+ domainName: { primaryLinkUrl, secondaryLinks },
+});
+
+const partition = (
+ candidates: ReturnType<typeof candidate>[],
+ claimedPrimaryLinkUrls: string[] = [],
+) =>
+ partitionCompanyDomainNameRewrites({
+ rewrites: computeCompanyDomainNameRewrites(candidates),
+ claimedPrimaryLinkUrls: new Set(claimedPrimaryLinkUrls),
+ });
+
+describe('partitionCompanyDomainNameRewrites', () => {
+ it('should rewrite a company whose only stale link is a secondary one', () => {
+ const { updates, skippedCompanyIds } = partition([
+ candidate('acme', 'acme.com', [
+ { url: 'https://www.beta.com', label: 'Merged away' },
+ ]),
+ ]);
+
+ expect(skippedCompanyIds).toEqual([]);
+ expect(updates).toEqual([
+ {
+ id: 'acme',
+ domainName: {
+ primaryLinkUrl: 'acme.com',
+ secondaryLinks: [{ url: 'beta.com', label: 'Merged away' }],
+ },
+ },
+ ]);
+ });
+
+ it('should skip a company whose normalized domain another company already holds', () => {
+ const { updates, skippedCompanyIds } = partition(
+ [candidate('prefixed', 'https://www.acme.com')],
+ ['acme.com'],
+ );
+
+ expect(updates).toEqual([]);
+ expect(skippedCompanyIds).toEqual(['prefixed']);
+ });
+
+ it('should skip the second of two candidates that collapse onto the same domain', () => {
+ const { updates, skippedCompanyIds } = partition([
+ candidate('first', 'https://acme.com'),
+ candidate('second', 'https://www.acme.com/careers'),
+ ]);
+
+ expect(updates.map(({ id }) => id)).toEqual(['first']);
+ expect(skippedCompanyIds).toEqual(['second']);
+ });
+
+ it('should leave companies that are already canonical alone', () => {
+ expect(
+ partition([
+ candidate('acme', 'acme.com', [{ url: 'beta.com', label: '' }]),
+ ]),
+ ).toEqual({ updates: [], skippedCompanyIds: [] });
+ });
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-candidates-query.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-candidates-query.util.ts
new file mode 100644
index 00000000000..4ff7af7229a
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-candidates-query.util.ts
@@ -0,0 +1,25 @@
+import { buildNonCanonicalDomainNameCondition } from 'src/database/commands/upgrade-version-command/2-38/utils/build-non-canonical-domain-name-condition.util';
+import { COMPANY_DOMAIN_NAME_COLUMNS } from 'src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant';
+
+export const buildCompanyDomainNameCandidatesQuery = ({
+ schemaName,
+ batchSize,
+ afterCompanyId,
+}: {
+ schemaName: string;
+ batchSize: number;
+ afterCompanyId: string;
+}): { sql: string; parameters: unknown[] } => ({
+ sql: `
+SELECT
+ company."id" AS "id",
+ company."${COMPANY_DOMAIN_NAME_COLUMNS.primaryLinkUrl}" AS "primaryLinkUrl",
+ company."${COMPANY_DOMAIN_NAME_COLUMNS.secondaryLinks}" AS "secondaryLinks"
+FROM "${schemaName}"."company" company
+WHERE company."id" > $1
+ AND ${buildNonCanonicalDomainNameCondition('company')}
+ORDER BY company."id"
+LIMIT $2
+`,
+ parameters: [afterCompanyId, batchSize],
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-update-query.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-update-query.util.ts
new file mode 100644
index 00000000000..9e442906efe
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-company-domain-name-update-query.util.ts
@@ -0,0 +1,31 @@
+import { isDefined } from 'twenty-shared/utils';
+
+import { COMPANY_DOMAIN_NAME_COLUMNS } from 'src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant';
+import { type DomainNameLinks } from 'src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util';
+
+export const buildCompanyDomainNameUpdateQuery = ({
+ schemaName,
+ updates,
+}: {
+ schemaName: string;
+ updates: { id: string; domainName: DomainNameLinks }[];
+}): { sql: string; parameters: unknown[] } => ({
+ sql: `
+UPDATE "${schemaName}"."company" company
+SET
+ "${COMPANY_DOMAIN_NAME_COLUMNS.primaryLinkUrl}" = source."primaryLinkUrl",
+ "${COMPANY_DOMAIN_NAME_COLUMNS.secondaryLinks}" = source."secondaryLinks"
+FROM unnest($1::uuid[], $2::text[], $3::jsonb[])
+ AS source("id", "primaryLinkUrl", "secondaryLinks")
+WHERE company."id" = source."id"
+`,
+ parameters: [
+ updates.map(({ id }) => id),
+ updates.map(({ domainName }) => domainName.primaryLinkUrl),
+ updates.map(({ domainName }) =>
+ isDefined(domainName.secondaryLinks)
+ ? JSON.stringify(domainName.secondaryLinks)
+ : null,
+ ),
+ ],
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-domain-name-settings-patch-query.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-domain-name-settings-patch-query.util.ts
new file mode 100644
index 00000000000..9bcfa973e73
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-domain-name-settings-patch-query.util.ts
@@ -0,0 +1,17 @@
+import { STANDARD_OBJECT_FIELDS } from 'twenty-shared/metadata';
+
+export const buildDomainNameSettingsPatchQuery = (
+ workspaceId: string,
+): { sql: string; parameters: unknown[] } => ({
+ sql: `
+UPDATE "core"."fieldMetadata"
+SET "settings" = COALESCE("settings", '{}'::jsonb) || jsonb_build_object('type', 'domain')
+WHERE "workspaceId" = $1
+ AND "universalIdentifier" = $2::uuid
+ AND COALESCE("settings" ->> 'type', '') <> 'domain'
+`,
+ parameters: [
+ workspaceId,
+ STANDARD_OBJECT_FIELDS.company.domainName.universalIdentifier,
+ ],
+});
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-non-canonical-domain-name-condition.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-non-canonical-domain-name-condition.util.ts
new file mode 100644
index 00000000000..50a393b75fb
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/build-non-canonical-domain-name-condition.util.ts
@@ -0,0 +1,25 @@
+import { COMPANY_DOMAIN_NAME_COLUMNS } from 'src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant';
+
+const nonCanonicalDomain = (expression: string) => `(
+ ${expression} <> lower(${expression})
+ OR ${expression} ~ '[:/?#@]|\\s|[^[:ascii:]]'
+ OR ${expression} LIKE 'www.%'
+ OR ${expression} LIKE '%.'
+ )`;
+
+export const buildNonCanonicalDomainNameCondition = (alias: string): string => {
+ const primaryLinkUrl = `"${alias}"."${COMPANY_DOMAIN_NAME_COLUMNS.primaryLinkUrl}"`;
+ const secondaryLinks = `"${alias}"."${COMPANY_DOMAIN_NAME_COLUMNS.secondaryLinks}"`;
+
+ return `(
+ ${nonCanonicalDomain(primaryLinkUrl)}
+ OR (
+ jsonb_typeof(${secondaryLinks}) = 'array'
+ AND EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(${secondaryLinks}) AS link
+ WHERE link->>'url' IS NOT NULL AND ${nonCanonicalDomain(`link->>'url'`)}
+ )
+ )
+)`;
+};
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant.ts
new file mode 100644
index 00000000000..2fdf90cf1ea
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/company-domain-name-columns.constant.ts
@@ -0,0 +1,28 @@
+import { linksCompositeType } from 'twenty-shared/types';
+
+import { computeCompositeColumnName } from 'src/engine/metadata-modules/field-metadata/utils/compute-column-name.util';
+
+const DOMAIN_NAME_FIELD_NAME = 'domainName';
+
+const compositeProperty = (name: string) => {
+ const property = linksCompositeType.properties.find(
+ (candidate) => candidate.name === name,
+ );
+
+ if (!property) {
+ throw new Error(`Links composite type has no ${name} property`);
+ }
+
+ return property;
+};
+
+export const COMPANY_DOMAIN_NAME_COLUMNS = {
+ primaryLinkUrl: computeCompositeColumnName(
+ DOMAIN_NAME_FIELD_NAME,
+ compositeProperty('primaryLinkUrl'),
+ ),
+ secondaryLinks: computeCompositeColumnName(
+ DOMAIN_NAME_FIELD_NAME,
+ compositeProperty('secondaryLinks'),
+ ),
+};
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util.ts
new file mode 100644
index 00000000000..c9fe9064a73
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util.ts
@@ -0,0 +1,30 @@
+import {
+ type DomainNameLinks,
+ normalizeDomainNameLinks,
+} from 'src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util';
+
+export type CompanyDomainNameRewrite = {
+ id: string;
+ currentPrimaryLinkUrl: string;
+ domainName: DomainNameLinks;
+};
+
+export const computeCompanyDomainNameRewrites = (
+ candidates: { id: string; domainName: DomainNameLinks }[],
+): CompanyDomainNameRewrite[] => {
+ const rewrites: CompanyDomainNameRewrite[] = [];
+
+ for (const { id, domainName } of candidates) {
+ const { changed, value } = normalizeDomainNameLinks(domainName);
+
+ if (changed) {
+ rewrites.push({
+ id,
+ currentPrimaryLinkUrl: domainName.primaryLinkUrl,
+ domainName: value,
+ });
+ }
+ }
+
+ return rewrites;
+};
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util.ts
new file mode 100644
index 00000000000..1133106b101
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util.ts
@@ -0,0 +1,48 @@
+import { isNonEmptyString } from '@sniptt/guards';
+import { type LinkMetadata, type LinksMetadata } from 'twenty-shared/types';
+import { normalizeDomain } from 'twenty-shared/utils';
+
+import { parseArrayOrJsonStringToArray } from 'src/engine/api/graphql/graphql-query-runner/utils/parse-additional-items.util';
+
+const normalizeStoredDomain = (url: string): string =>
+ isNonEmptyString(url) ? normalizeDomain(url) : url;
+
+export type DomainNameLinks = Pick<
+ LinksMetadata,
+ 'primaryLinkUrl' | 'secondaryLinks'
+>;
+
+export const normalizeDomainNameLinks = (
+ domainName: DomainNameLinks,
+): { changed: boolean; value: DomainNameLinks } => {
+ const secondaryLinks = parseArrayOrJsonStringToArray<LinkMetadata>(
+ domainName.secondaryLinks,
+ );
+
+ const normalizedPrimaryLinkUrl = normalizeStoredDomain(
+ domainName.primaryLinkUrl,
+ );
+
+ const normalizedSecondaryLinks = secondaryLinks.map((link) => ({
+ ...link,
+ url: normalizeStoredDomain(link.url),
+ }));
+
+ const changed =
+ normalizedPrimaryLinkUrl !== domainName.primaryLinkUrl ||
+ normalizedSecondaryLinks.some(
+ (link, index) => link.url !== secondaryLinks[index].url,
+ );
+
+ return {
+ changed,
+ value: {
+ ...domainName,
+ primaryLinkUrl: normalizedPrimaryLinkUrl,
+ secondaryLinks:
+ normalizedSecondaryLinks.length > 0
+ ? normalizedSecondaryLinks
+ : domainName.secondaryLinks,
+ },
+ };
+};
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/partition-company-domain-name-rewrites.util.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/partition-company-domain-name-rewrites.util.ts
new file mode 100644
index 00000000000..644d3fdd91a
--- /dev/null
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-38/utils/partition-company-domain-name-rewrites.util.ts
@@ -0,0 +1,34 @@
+import { type CompanyDomainNameRewrite } from 'src/database/commands/upgrade-version-command/2-38/utils/compute-company-domain-name-rewrites.util';
+import { type DomainNameLinks } from 'src/database/commands/upgrade-version-command/2-38/utils/normalize-domain-name-links.util';
+
+export const partitionCompanyDomainNameRewrites = ({
+ rewrites,
+ claimedPrimaryLinkUrls,
+}: {
+ rewrites: CompanyDomainNameRewrite[];
+ claimedPrimaryLinkUrls: Set<string>;
+}): {
+ updates: { id: string; domainName: DomainNameLinks }[];
+ skippedCompanyIds: string[];
+} => {
+ const updates: { id: string; domainName: DomainNameLinks }[] = [];
+ const skippedCompanyIds: string[] = [];
+
+ for (const { id, currentPrimaryLinkUrl, domainName } of rewrites) {
+ const isPrimaryLinkUrlRewritten =
+ domainName.primaryLinkUrl !== currentPrimaryLinkUrl;
+
+ if (isPrimaryLinkUrlRewritten) {
+ if (claimedPrimaryLinkUrls.has(domainName.primaryLinkUrl)) {
+ skippedCompanyIds.push(id);
+ continue;
+ }
+
+ claimedPrimaryLinkUrls.add(domainName.primaryLinkUrl);
+ }
+
+ updates.push({ id, domainName });
+ }
+
+ return { updates, skippedCompanyIds };
+};
diff --git a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/data-arg-processor.service.ts b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/data-arg-processor.service.ts
index c0474d12d0f..1a376773d9b 100644
--- a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/data-arg-processor.service.ts
+++ b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/data-arg-processor.service.ts
@@ -15,6 +15,7 @@ import {
} from 'twenty-shared/utils';
import { computeMorphOrRelationFieldJoinColumnName } from 'src/engine/metadata-modules/field-metadata/utils/compute-morph-or-relation-field-join-column-name.util';
+import { isFieldMetadataSettingsOfType } from 'src/engine/metadata-modules/field-metadata/utils/is-field-metadata-settings-of-type.util';
import { belongsToTwentyStandardApp } from 'src/engine/metadata-modules/utils/belongs-to-twenty-standard-app.util';
import { transformActorField } from 'src/engine/api/common/common-args-processors/data-arg-processor/transformer-utils/transform-actor-field.util';
import { transformAddressField } from 'src/engine/api/common/common-args-processors/data-arg-processor/transformer-utils/transform-address-field.util';
@@ -332,9 +333,20 @@ export class DataArgProcessorService {
return await transformRichTextValue(validatedValue);
}
case FieldMetadataType.LINKS: {
- const validatedValue = validateLinksFieldOrThrow(value, key);
+ const settings = isFieldMetadataSettingsOfType(
+ fieldMetadata.settings,
+ FieldMetadataType.LINKS,
+ )
+ ? fieldMetadata.settings
+ : null;
+
+ const validatedValue = validateLinksFieldOrThrow({
+ value,
+ fieldName: key,
+ linksVariant: settings?.type,
+ });
- return transformLinksValue(validatedValue);
+ return transformLinksValue({ input: validatedValue, settings });
}
case FieldMetadataType.TS_VECTOR:
throw new CommonQueryRunnerException(
diff --git a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/__tests__/validate-links-field-or-throw.util.spec.ts b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/__tests__/validate-links-field-or-throw.util.spec.ts
index 6e1b6a202d6..fff65fdc674 100644
--- a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/__tests__/validate-links-field-or-throw.util.spec.ts
+++ b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/__tests__/validate-links-field-or-throw.util.spec.ts
@@ -4,7 +4,10 @@ import { CommonQueryRunnerException } from 'src/engine/api/common/common-query-r
describe('validateLinksFieldOrThrow', () => {
describe('valid inputs', () => {
it('should return null when value is null', () => {
- const result = validateLinksFieldOrThrow(null, 'testField');
+ const result = validateLinksFieldOrThrow({
+ value: null,
+ fieldName: 'testField',
+ });
expect(result).toBeNull();
});
@@ -15,7 +18,10 @@ describe('validateLinksFieldOrThrow', () => {
primaryLinkLabel: 'Example Website',
secondaryLinks: [{ url: 'https://secondary.com', label: 'Secondary' }],
};
- const result = validateLinksFieldOrThrow(linksValue, 'testField');
+ const result = validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ });
expect(result).toEqual(linksValue);
});
@@ -24,7 +30,10 @@ describe('validateLinksFieldOrThrow', () => {
const linksValue = {
primaryLinkUrl: 'https://example.com',
};
- const result = validateLinksFieldOrThrow(linksValue, 'testField');
+ const result = validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ });
expect(result).toEqual(linksValue);
});
@@ -33,14 +42,17 @@ describe('validateLinksFieldOrThrow', () => {
describe('invalid inputs', () => {
it('should throw when value is not an object', () => {
expect(() =>
- validateLinksFieldOrThrow('not an object', 'testField'),
+ validateLinksFieldOrThrow({
+ value: 'not an object',
+ fieldName: 'testField',
+ }),
).toThrow(CommonQueryRunnerException);
});
it('should throw when value is undefined', () => {
- expect(() => validateLinksFieldOrThrow(undefined, 'testField')).toThrow(
- CommonQueryRunnerException,
- );
+ expect(() =>
+ validateLinksFieldOrThrow({ value: undefined, fieldName: 'testField' }),
+ ).toThrow(CommonQueryRunnerException);
});
it('should throw when primaryLinkUrl is not a string', () => {
@@ -48,9 +60,12 @@ describe('validateLinksFieldOrThrow', () => {
primaryLinkUrl: 12345,
};
- expect(() => validateLinksFieldOrThrow(linksValue, 'testField')).toThrow(
- CommonQueryRunnerException,
- );
+ expect(() =>
+ validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ }),
+ ).toThrow(CommonQueryRunnerException);
});
it('should throw when primaryLinkLabel is not a string', () => {
@@ -58,9 +73,12 @@ describe('validateLinksFieldOrThrow', () => {
primaryLinkLabel: ['not', 'a', 'string'],
};
- expect(() => validateLinksFieldOrThrow(linksValue, 'testField')).toThrow(
- CommonQueryRunnerException,
- );
+ expect(() =>
+ validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ }),
+ ).toThrow(CommonQueryRunnerException);
});
it('should throw when secondaryLinks is not an object or null', () => {
@@ -68,9 +86,12 @@ describe('validateLinksFieldOrThrow', () => {
secondaryLinks: 'not an object',
};
- expect(() => validateLinksFieldOrThrow(linksValue, 'testField')).toThrow(
- CommonQueryRunnerException,
- );
+ expect(() =>
+ validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ }),
+ ).toThrow(CommonQueryRunnerException);
});
it('should throw when invalid subfields are present', () => {
@@ -80,9 +101,66 @@ describe('validateLinksFieldOrThrow', () => {
invalidField2: 'invalid',
};
- expect(() => validateLinksFieldOrThrow(linksValue, 'testField')).toThrow(
+ expect(() =>
+ validateLinksFieldOrThrow({
+ value: linksValue,
+ fieldName: 'testField',
+ }),
+ ).toThrow(CommonQueryRunnerException);
+ });
+ });
+
+ describe('domain-typed field', () => {
+ const validateDomain = (value: unknown) =>
+ validateLinksFieldOrThrow({
+ value,
+ fieldName: 'domainName',
+ linksVariant: 'domain',
+ });
+
+ it.each([
+ 'twenty.com',
+ 'https://www.twenty.com/careers?x=1',
+ 'münchen.de',
+ 'blog.twenty.com',
+ ])('should accept %s, which names a real host', (primaryLinkUrl) => {
+ expect(() => validateDomain({ primaryLinkUrl })).not.toThrow();
+ });
+
+ it.each([
+ 'not a domain',
+ 'javascript:alert(1)',
+ 'twenty',
+ '<script>',
+ 'localhost',
+ '192.168.1.1',
+ ])('should reject %s, which is not a domain', (primaryLinkUrl) => {
+ expect(() => validateDomain({ primaryLinkUrl })).toThrow(
CommonQueryRunnerException,
);
});
+
+ it('should reject a secondary link that is not a domain', () => {
+ expect(() =>
+ validateDomain({
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [{ url: 'not a domain', label: '' }],
+ }),
+ ).toThrow(CommonQueryRunnerException);
+ });
+
+ it('should let an empty domain through, so clearing the field still works', () => {
+ expect(() => validateDomain({ primaryLinkUrl: '' })).not.toThrow();
+ });
+
+ it('should leave a url-typed field free to hold any url', () => {
+ expect(() =>
+ validateLinksFieldOrThrow({
+ value: { primaryLinkUrl: 'https://twenty.com/a/b?c=d' },
+ fieldName: 'website',
+ linksVariant: 'url',
+ }),
+ ).not.toThrow();
+ });
});
});
diff --git a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-links-field-or-throw.util.ts b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-links-field-or-throw.util.ts
index 8862f07248a..c8f41591e9a 100644
--- a/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-links-field-or-throw.util.ts
+++ b/packages/twenty-server/src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-links-field-or-throw.util.ts
@@ -1,6 +1,12 @@
import { msg } from '@lingui/core/macro';
-import { isNull } from '@sniptt/guards';
+import { isNonEmptyString, isNull } from '@sniptt/guards';
+import {
+ type FieldLinksVariant,
+ type LinkMetadataNullable,
+} from 'twenty-shared/types';
+import { isValidDomain } from 'twenty-shared/utils';
+import { parseArrayOrJsonStringToArray } from 'src/engine/api/graphql/graphql-query-runner/utils/parse-additional-items.util';
import { validateRawJsonFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-raw-json-field-or-throw.util';
import { validateTextFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-text-field-or-throw.util';
import {
@@ -9,24 +15,57 @@ import {
} from 'src/engine/api/common/common-query-runners/errors/common-query-runner.exception';
import { type LinksFieldGraphQLInput } from 'src/engine/core-modules/record-transformer/utils/transform-links-value.util';
-export const validateLinksFieldOrThrow = (
- value: unknown,
- fieldName: string,
-): LinksFieldGraphQLInput | null => {
+const assertDomainOrThrow = (value: unknown, fieldName: string) => {
+ if (!isNonEmptyString(value)) {
+ return;
+ }
+
+ if (!isValidDomain(value)) {
+ throw new CommonQueryRunnerException(
+ `"${value}" is not a domain name, for domain-typed links field "${fieldName}"`,
+ CommonQueryRunnerExceptionCode.INVALID_ARGS_DATA,
+ { userFriendlyMessage: msg`Please enter a domain name, like twenty.com` },
+ );
+ }
+};
+
+export const validateLinksFieldOrThrow = ({
+ value,
+ fieldName,
+ linksVariant,
+}: {
+ value: unknown;
+ fieldName: string;
+ linksVariant?: FieldLinksVariant;
+}): LinksFieldGraphQLInput | null => {
const preValidatedValue = validateRawJsonFieldOrThrow(value, fieldName);
if (isNull(preValidatedValue)) return null;
+ const isDomainField = linksVariant === 'domain';
+
for (const [subField, subFieldValue] of Object.entries(preValidatedValue)) {
switch (subField) {
case 'primaryLinkUrl':
validateTextFieldOrThrow(subFieldValue, `${fieldName}.${subField}`);
+
+ if (isDomainField) {
+ assertDomainOrThrow(subFieldValue, `${fieldName}.${subField}`);
+ }
break;
case 'primaryLinkLabel':
validateTextFieldOrThrow(subFieldValue, `${fieldName}.${subField}`);
break;
case 'secondaryLinks':
validateRawJsonFieldOrThrow(subFieldValue, `${fieldName}.${subField}`);
+
+ if (isDomainField) {
+ for (const link of parseArrayOrJsonStringToArray<LinkMetadataNullable>(
+ subFieldValue as LinkMetadataNullable[] | string | null,
+ )) {
+ assertDomainOrThrow(link.url, `${fieldName}.${subField}`);
+ }
+ }
break;
default:
throw new CommonQueryRunnerException(
diff --git a/packages/twenty-server/src/engine/core-modules/record-transformer/services/record-input-transformer.service.ts b/packages/twenty-server/src/engine/core-modules/record-transformer/services/record-input-transformer.service.ts
index 0aeb1d49fb5..64976b1b687 100644
--- a/packages/twenty-server/src/engine/core-modules/record-transformer/services/record-input-transformer.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/record-transformer/services/record-input-transformer.service.ts
@@ -11,6 +11,7 @@ import { transformEmailsValue } from 'src/engine/core-modules/record-transformer
import { transformLinksValue } from 'src/engine/core-modules/record-transformer/utils/transform-links-value.util';
import { transformPhonesValue } from 'src/engine/core-modules/record-transformer/utils/transform-phones-value.util';
import { transformRichTextValue } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text.util';
+import { isFieldMetadataSettingsOfType } from 'src/engine/metadata-modules/field-metadata/utils/is-field-metadata-settings-of-type.util';
import { FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
import { type OrmFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/orm-flat-field-metadata.type';
@@ -52,7 +53,7 @@ export class RecordInputTransformerService {
const transformedValue = this.parseSubFields(
fieldMetadata.type,
await this.transformFieldValue(
- fieldMetadata.type,
+ fieldMetadata,
this.stringifySubFields(fieldMetadata.type, value),
),
);
@@ -64,7 +65,7 @@ export class RecordInputTransformerService {
}
private async transformFieldValue(
- fieldType: FieldMetadataType,
+ fieldMetadata: OrmFlatFieldMetadata,
// oxlint-disable-next-line typescript/no-explicit-any
value: any,
// oxlint-disable-next-line typescript/no-explicit-any
@@ -73,7 +74,7 @@ export class RecordInputTransformerService {
return value;
}
- switch (fieldType) {
+ switch (fieldMetadata.type) {
case FieldMetadataType.UUID:
return value || null;
case FieldMetadataType.NUMBER:
@@ -81,7 +82,15 @@ export class RecordInputTransformerService {
case FieldMetadataType.RICH_TEXT:
return await transformRichTextValue(value);
case FieldMetadataType.LINKS:
- return transformLinksValue(value);
+ return transformLinksValue({
+ input: value,
+ settings: isFieldMetadataSettingsOfType(
+ fieldMetadata.settings,
+ FieldMetadataType.LINKS,
+ )
+ ? fieldMetadata.settings
+ : null,
+ });
case FieldMetadataType.EMAILS:
return transformEmailsValue(value);
case FieldMetadataType.PHONES:
diff --git a/packages/twenty-server/src/engine/core-modules/record-transformer/utils/__tests__/transform-links-value.util.spec.ts b/packages/twenty-server/src/engine/core-modules/record-transformer/utils/__tests__/transform-links-value.util.spec.ts
index e3e1aa45abe..dfd6ca64e30 100644
--- a/packages/twenty-server/src/engine/core-modules/record-transformer/utils/__tests__/transform-links-value.util.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/record-transformer/utils/__tests__/transform-links-value.util.spec.ts
@@ -2,9 +2,9 @@ import { transformLinksValue } from 'src/engine/core-modules/record-transformer/
describe('transformLinksValue', () => {
it('should handle null/undefined/empty object values', () => {
- expect(transformLinksValue(null)).toBeNull();
- expect(transformLinksValue(undefined)).toBeUndefined();
- expect(transformLinksValue({})).toEqual({
+ expect(transformLinksValue({ input: null })).toBeNull();
+ expect(transformLinksValue({ input: undefined })).toBeUndefined();
+ expect(transformLinksValue({ input: {} })).toEqual({
primaryLinkLabel: null,
primaryLinkUrl: null,
secondaryLinks: null,
@@ -25,7 +25,7 @@ describe('transformLinksValue', () => {
secondaryLinks: null,
};
- expect(transformLinksValue(input)).toEqual(expected);
+ expect(transformLinksValue({ input })).toEqual(expected);
});
it('should remove trailing slash', () => {
@@ -41,7 +41,7 @@ describe('transformLinksValue', () => {
secondaryLinks: null,
};
- expect(transformLinksValue(input)).toEqual(expected);
+ expect(transformLinksValue({ input })).toEqual(expected);
});
it('should work fine without protocol', () => {
@@ -57,7 +57,7 @@ describe('transformLinksValue', () => {
secondaryLinks: null,
};
- expect(transformLinksValue(input)).toEqual(expected);
+ expect(transformLinksValue({ input })).toEqual(expected);
});
it('should work fine with www', () => {
@@ -73,7 +73,7 @@ describe('transformLinksValue', () => {
secondaryLinks: null,
};
- expect(transformLinksValue(input)).toEqual(expected);
+ expect(transformLinksValue({ input })).toEqual(expected);
});
it('should preserve percent-encoded payloads when normalizing imported URLs', () => {
@@ -101,7 +101,71 @@ describe('transformLinksValue', () => {
]),
};
- expect(transformLinksValue(input)).toEqual(expected);
+ expect(transformLinksValue({ input })).toEqual(expected);
+ });
+ });
+
+ describe('url-typed field', () => {
+ it('should keep the whole url, exactly like a field with no variant set', () => {
+ const input = {
+ primaryLinkUrl: 'HTTPS://WWW.EXAMPLE.COM/careers?utm=1',
+ primaryLinkLabel: 'Example',
+ secondaryLinks: null,
+ };
+
+ expect(transformLinksValue({ input, settings: { type: 'url' } })).toEqual(
+ transformLinksValue({ input }),
+ );
+ expect(
+ transformLinksValue({ input, settings: { type: 'url' } })
+ ?.primaryLinkUrl,
+ ).toBe('https://www.example.com/careers?utm=1');
+ });
+ });
+
+ describe('domain-typed field', () => {
+ const settings = { type: 'domain' } as const;
+
+ it('should reduce every spelling of a domain to the same value', () => {
+ const spellings = [
+ 'example.com',
+ 'www.example.com',
+ 'HTTPS://WWW.EXAMPLE.COM/',
+ 'http://example.com/careers?utm=1',
+ ];
+
+ const normalized = spellings.map(
+ (primaryLinkUrl) =>
+ transformLinksValue({
+ input: { primaryLinkUrl, primaryLinkLabel: 'Example' },
+ settings,
+ })?.primaryLinkUrl,
+ );
+
+ expect(normalized).toEqual([
+ 'example.com',
+ 'example.com',
+ 'example.com',
+ 'example.com',
+ ]);
+ });
+
+ it('should reduce secondary links to bare domains', () => {
+ const input = {
+ primaryLinkUrl: 'https://example.com',
+ primaryLinkLabel: 'Example',
+ secondaryLinks: JSON.stringify([
+ { url: 'https://www.example-old.com/about', label: 'Old domain' },
+ ]),
+ };
+
+ expect(transformLinksValue({ input, settings })).toEqual({
+ primaryLinkUrl: 'example.com',
+ primaryLinkLabel: 'Example',
+ secondaryLinks: JSON.stringify([
+ { url: 'example-old.com', label: 'Old domain' },
+ ]),
+ });
});
});
});
diff --git a/packages/twenty-server/src/engine/core-modules/record-transformer/utils/transform-links-value.util.ts b/packages/twenty-server/src/engine/core-modules/record-transformer/utils/transform-links-value.util.ts
index 03a7c8c3d0d..b9aa7e1ee30 100644
--- a/packages/twenty-server/src/engine/core-modules/record-transformer/utils/transform-links-value.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/record-transformer/utils/transform-links-value.util.ts
@@ -1,7 +1,15 @@
import { isNonEmptyString } from '@sniptt/guards';
import isEmpty from 'lodash.isempty';
-import { type LinkMetadataNullable } from 'twenty-shared/types';
-import { isDefined, normalizeUrlOrigin, parseJson } from 'twenty-shared/utils';
+import {
+ type FieldMetadataSettings,
+ type FieldMetadataType,
+ type LinkMetadataNullable,
+} from 'twenty-shared/types';
+import {
+ isDefined,
+ getLinkUrlNormalizer,
+ parseJson,
+} from 'twenty-shared/utils';
import { removeEmptyLinks } from 'src/engine/core-modules/record-transformer/utils/remove-empty-links';
@@ -15,16 +23,22 @@ export type LinksFieldGraphQLInput =
| undefined;
// TODO refactor this function handle partial composite field update
-export const transformLinksValue = (
- value: LinksFieldGraphQLInput,
-): LinksFieldGraphQLInput => {
- if (!isDefined(value)) {
- return value;
+export const transformLinksValue = ({
+ input,
+ settings,
+}: {
+ input: LinksFieldGraphQLInput;
+ settings?: FieldMetadataSettings<FieldMetadataType.LINKS>;
+}): LinksFieldGraphQLInput => {
+ if (!isDefined(input)) {
+ return input;
}
- const primaryLinkUrlRaw = value.primaryLinkUrl as string | null;
- const primaryLinkLabelRaw = value.primaryLinkLabel as string | null;
- const secondaryLinksRaw = value.secondaryLinks as string | null;
+ const normalizeLinkUrl = getLinkUrlNormalizer(settings?.type);
+
+ const primaryLinkUrlRaw = input.primaryLinkUrl as string | null;
+ const primaryLinkLabelRaw = input.primaryLinkLabel as string | null;
+ const secondaryLinksRaw = input.secondaryLinks as string | null;
const secondaryLinksArray = isNonEmptyString(secondaryLinksRaw)
? parseJson<LinkMetadataNullable[]>(secondaryLinksRaw)
@@ -40,13 +54,13 @@ export const transformLinksValue = (
const processedSecondaryLinks = secondaryLinks?.map((link) => ({
...link,
- url: isDefined(link.url) ? normalizeUrlOrigin(link.url) : link.url,
+ url: isDefined(link.url) ? normalizeLinkUrl(link.url) : link.url,
}));
return {
- ...value,
+ ...input,
primaryLinkUrl: isDefined(primaryLinkUrl)
- ? normalizeUrlOrigin(primaryLinkUrl)
+ ? normalizeLinkUrl(primaryLinkUrl)
: primaryLinkUrl,
primaryLinkLabel,
secondaryLinks: isEmpty(processedSecondaryLinks)
diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts
index 0aa6f5cde66..d4fe7a5146f 100644
--- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts
@@ -12,6 +12,7 @@ import {
import { FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type';
import { validateEnumSelectFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-enum-flat-field-metadata.util';
import { validateFilesFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-files-flat-field-metadata.util';
+import { validateLinksFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-links-flat-field-metadata.util';
import { validateMorphOrRelationFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-morph-or-relation-flat-field-metadata.util';
import { validateMorphRelationFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-morph-relation-flat-field-metadata.util';
import { validatePositionFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util';
@@ -64,7 +65,7 @@ export class FlatFieldMetadataTypeValidatorService {
EMAILS: DEFAULT_NO_VALIDATION,
FILES: validateFilesFlatFieldMetadata,
FULL_NAME: DEFAULT_NO_VALIDATION,
- LINKS: DEFAULT_NO_VALIDATION,
+ LINKS: validateLinksFlatFieldMetadata,
NUMBER: DEFAULT_NO_VALIDATION,
NUMERIC: rejectUserCreation(
FieldMetadataType.NUMERIC,
diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/__tests__/validate-links-flat-field-metadata.util.spec.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/__tests__/validate-links-flat-field-metadata.util.spec.ts
new file mode 100644
index 00000000000..5e1677ccd89
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/__tests__/validate-links-flat-field-metadata.util.spec.ts
@@ -0,0 +1,63 @@
+import { FieldMetadataType } from 'twenty-shared/types';
+
+import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type';
+import { validateLinksFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-links-flat-field-metadata.util';
+import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type';
+
+type LinksFlatFieldMetadataOverrides = Partial<
+ Omit<UniversalFlatFieldMetadata<FieldMetadataType.LINKS>, 'universalSettings'>
+> & { universalSettings?: Record<string, unknown> };
+
+const createFlatEntityToValidate = (
+ overrides: LinksFlatFieldMetadataOverrides = {},
+): UniversalFlatFieldMetadata<FieldMetadataType.LINKS> =>
+ ({
+ type: FieldMetadataType.LINKS,
+ name: 'testLinksField',
+ label: 'Test Links Field',
+ universalSettings: { maxNumberOfValues: 1 },
+ ...overrides,
+ }) as UniversalFlatFieldMetadata<FieldMetadataType.LINKS>;
+
+const callValidator = (
+ flatEntityToValidate: UniversalFlatFieldMetadata<FieldMetadataType.LINKS>,
+) =>
+ validateLinksFlatFieldMetadata({
+ flatEntityToValidate,
+ } as Parameters<typeof validateLinksFlatFieldMetadata>[0]);
+
+const stripUserFriendlyMessage = (errors: FlatFieldMetadataValidationError[]) =>
+ errors.map(({ userFriendlyMessage: _, ...rest }) => rest);
+
+describe('validateLinksFlatFieldMetadata', () => {
+ it('should return no errors for a links field with no variant set', () => {
+ const errors = callValidator(createFlatEntityToValidate());
+
+ expect(errors).toMatchInlineSnapshot('[]');
+ });
+
+ it('should return no errors for a domain-typed links field', () => {
+ const errors = callValidator(
+ createFlatEntityToValidate({
+ universalSettings: { maxNumberOfValues: 1, type: 'domain' },
+ }),
+ );
+
+ expect(errors).toMatchInlineSnapshot('[]');
+ });
+
+ it('should return an error for a variant it does not know', () => {
+ const errors = callValidator(
+ createFlatEntityToValidate({ universalSettings: { type: 'Domain' } }),
+ );
+
+ expect(stripUserFriendlyMessage(errors)).toMatchInlineSnapshot(`
+[
+ {
+ "code": "INVALID_FIELD_INPUT",
+ "message": "Links field type must be one of url, domain",
+ },
+]
+`);
+ });
+});
diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-links-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-links-flat-field-metadata.util.ts
new file mode 100644
index 00000000000..7d29c85b7a8
--- /dev/null
+++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-links-flat-field-metadata.util.ts
@@ -0,0 +1,28 @@
+import { msg } from '@lingui/core/macro';
+import {
+ FIELD_LINKS_VARIANTS,
+ type FieldMetadataType,
+} from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
+
+import { FieldMetadataExceptionCode } from 'src/engine/metadata-modules/field-metadata/field-metadata.exception';
+import { type FlatFieldMetadataTypeValidationArgs } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-type-validator.type';
+import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type';
+
+export const validateLinksFlatFieldMetadata = ({
+ flatEntityToValidate,
+}: FlatFieldMetadataTypeValidationArgs<FieldMetadataType.LINKS>): FlatFieldMetadataValidationError[] => {
+ const variant = flatEntityToValidate?.universalSettings?.type;
+
+ if (isDefined(variant) && !FIELD_LINKS_VARIANTS.includes(variant)) {
+ return [
+ {
+ code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT,
+ message: `Links field type must be one of ${FIELD_LINKS_VARIANTS.join(', ')}`,
+ userFriendlyMessage: msg`Links field type must be either a url or a domain`,
+ },
+ ];
+ }
+
+ return [];
+};
diff --git a/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts b/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
index 98ab50ef758..4d0d176457b 100644
--- a/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
+++ b/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
@@ -6,6 +6,7 @@ import {
import { isDefined } from 'twenty-shared/utils';
import { computeMorphOrRelationFieldJoinColumnName } from 'src/engine/metadata-modules/field-metadata/utils/compute-morph-or-relation-field-join-column-name.util';
+import { isFieldMetadataSettingsOfType } from 'src/engine/metadata-modules/field-metadata/utils/is-field-metadata-settings-of-type.util';
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
import { type FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
@@ -167,7 +168,19 @@ export const convertObjectMetadataToSchemaProperties = ({
),
};
break;
- case FieldMetadataType.LINKS:
+ case FieldMetadataType.LINKS: {
+ const linksSettings = isFieldMetadataSettingsOfType(
+ field.settings,
+ FieldMetadataType.LINKS,
+ )
+ ? field.settings
+ : null;
+
+ const secondaryLinkUrlProperty: SchemaObject =
+ linksSettings?.type === 'domain'
+ ? { type: 'string' }
+ : { type: 'string', format: 'uri' };
+
itemProperty = {
type: 'object',
properties: {
@@ -183,10 +196,7 @@ export const convertObjectMetadataToSchemaProperties = ({
type: 'object',
description: 'A secondary link',
properties: {
- url: {
- type: 'string',
- format: 'uri',
- },
+ url: secondaryLinkUrlProperty,
label: {
type: 'string',
},
@@ -196,6 +206,7 @@ export const convertObjectMetadataToSchemaProperties = ({
},
};
break;
+ }
case FieldMetadataType.CURRENCY:
itemProperty = {
type: 'object',
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/__tests__/prefill-companies.util.spec.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/__tests__/prefill-companies.util.spec.ts
new file mode 100644
index 00000000000..a7bce40aa8d
--- /dev/null
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/__tests__/prefill-companies.util.spec.ts
@@ -0,0 +1,13 @@
+import { normalizeDomain } from 'twenty-shared/utils';
+
+import { PREFILL_COMPANY_ROWS } from 'src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-companies.util';
+
+describe('prefillCompanies', () => {
+ it('should seed domain names in the shape a domain-typed links field stores', () => {
+ const notCanonical = PREFILL_COMPANY_ROWS.map(
+ ({ domainNamePrimaryLinkUrl }) => domainNamePrimaryLinkUrl,
+ ).filter((domainName) => normalizeDomain(domainName) !== domainName);
+
+ expect(notCanonical).toEqual([]);
+ });
+});
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-companies.util.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-companies.util.ts
index 207b461228e..2fcc93af44d 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-companies.util.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/utils/prefill-companies.util.ts
@@ -7,6 +7,99 @@ export const STRIPE_ID = '1f70157c-4ea5-4d81-bc49-e1401abfbb94';
export const FIGMA_ID = '9d5bcf43-7d38-4e88-82cb-d6d4ce638bf0';
export const NOTION_ID = '06290608-8bf0-4806-99ae-a715a6a93fad';
+export const PREFILL_COMPANY_ROWS = [
+ {
+ id: AIRBNB_ID,
+ name: 'Airbnb',
+ domainNamePrimaryLinkUrl: 'airbnb.com',
+ addressAddressStreet1: '888 Brannan St',
+ addressAddressStreet2: null,
+ addressAddressCity: 'San Francisco',
+ addressAddressState: 'CA',
+ addressAddressPostcode: '94103',
+ addressAddressCountry: 'United States',
+ position: 1,
+ createdBySource: FieldActorSource.SYSTEM,
+ createdByWorkspaceMemberId: null,
+ createdByName: 'System',
+ updatedBySource: FieldActorSource.SYSTEM,
+ updatedByWorkspaceMemberId: null,
+ updatedByName: 'System',
+ },
+ {
+ id: ANTHROPIC_ID,
+ name: 'Anthropic',
+ domainNamePrimaryLinkUrl: 'anthropic.com',
+ addressAddressStreet1: '548 Market Street',
+ addressAddressStreet2: null,
+ addressAddressCity: 'San Francisco',
+ addressAddressState: 'CA',
+ addressAddressPostcode: '94104',
+ addressAddressCountry: 'United States',
+ position: 2,
+ createdBySource: FieldActorSource.SYSTEM,
+ createdByWorkspaceMemberId: null,
+ createdByName: 'System',
+ updatedBySource: FieldActorSource.SYSTEM,
+ updatedByWorkspaceMemberId: null,
+ updatedByName: 'System',
+ },
+ {
+ id: STRIPE_ID,
+ name: 'Stripe',
+ domainNamePrimaryLinkUrl: 'stripe.com',
+ addressAddressStreet1: 'Eutaw Street',
+ addressAddressStreet2: null,
+ addressAddressCity: 'Dublin',
+ addressAddressState: null,
+ addressAddressPostcode: null,
+ addressAddressCountry: 'Ireland',
+ position: 3,
+ createdBySource: FieldActorSource.SYSTEM,
+ createdByWorkspaceMemberId: null,
+ createdByName: 'System',
+ updatedBySource: FieldActorSource.SYSTEM,
+ updatedByWorkspaceMemberId: null,
+ updatedByName: 'System',
+ },
+ {
+ id: FIGMA_ID,
+ name: 'Figma',
+ domainNamePrimaryLinkUrl: 'figma.com',
+ addressAddressStreet1: '760 Market St',
+ addressAddressStreet2: 'Floor 10',
+ addressAddressCity: 'San Francisco',
+ addressAddressState: null,
+ addressAddressPostcode: '94102',
+ addressAddressCountry: 'United States',
+ position: 4,
+ createdBySource: FieldActorSource.SYSTEM,
+ createdByWorkspaceMemberId: null,
+ createdByName: 'System',
+ updatedBySource: FieldActorSource.SYSTEM,
+ updatedByWorkspaceMemberId: null,
+ updatedByName: 'System',
+ },
+ {
+ id: NOTION_ID,
+ name: 'Notion',
+ domainNamePrimaryLinkUrl: 'notion.com',
+ addressAddressStreet1: '2300 Harrison St',
+ addressAddressStreet2: null,
+ addressAddressCity: 'San Francisco',
+ addressAddressState: 'CA',
+ addressAddressPostcode: '94110',
+ addressAddressCountry: 'United States',
+ position: 5,
+ createdBySource: FieldActorSource.SYSTEM,
+ createdByWorkspaceMemberId: null,
+ createdByName: 'System',
+ updatedBySource: FieldActorSource.SYSTEM,
+ updatedByWorkspaceMemberId: null,
+ updatedByName: 'System',
+ },
+];
+
export const prefillCompanies = async (
entityManager: EntityManager,
schemaName: string,
@@ -33,98 +126,7 @@ export const prefillCompanies = async (
'updatedByName',
])
.orIgnore()
- .values([
- {
- id: AIRBNB_ID,
- name: 'Airbnb',
- domainNamePrimaryLinkUrl: 'https://airbnb.com',
- addressAddressStreet1: '888 Brannan St',
- addressAddressStreet2: null,
- addressAddressCity: 'San Francisco',
- addressAddressState: 'CA',
- addressAddressPostcode: '94103',
- addressAddressCountry: 'United States',
- position: 1,
- createdBySource: FieldActorSource.SYSTEM,
- createdByWorkspaceMemberId: null,
- createdByName: 'System',
- updatedBySource: FieldActorSource.SYSTEM,
- updatedByWorkspaceMemberId: null,
- updatedByName: 'System',
- },
- {
- id: ANTHROPIC_ID,
- name: 'Anthropic',
- domainNamePrimaryLinkUrl: 'https://anthropic.com',
- addressAddressStreet1: '548 Market Street',
- addressAddressStreet2: null,
- addressAddressCity: 'San Francisco',
- addressAddressState: 'CA',
- addressAddressPostcode: '94104',
- addressAddressCountry: 'United States',
- position: 2,
- createdBySource: FieldActorSource.SYSTEM,
- createdByWorkspaceMemberId: null,
- createdByName: 'System',
- updatedBySource: FieldActorSource.SYSTEM,
- updatedByWorkspaceMemberId: null,
- updatedByName: 'System',
- },
- {
- id: STRIPE_ID,
- name: 'Stripe',
- domainNamePrimaryLinkUrl: 'https://stripe.com',
- addressAddressStreet1: 'Eutaw Street',
- addressAddressStreet2: null,
- addressAddressCity: 'Dublin',
- addressAddressState: null,
- addressAddressPostcode: null,
- addressAddressCountry: 'Ireland',
- position: 3,
- createdBySource: FieldActorSource.SYSTEM,
- createdByWorkspaceMemberId: null,
- createdByName: 'System',
- updatedBySource: FieldActorSource.SYSTEM,
- updatedByWorkspaceMemberId: null,
- updatedByName: 'System',
- },
- {
- id: FIGMA_ID,
- name: 'Figma',
- domainNamePrimaryLinkUrl: 'https://figma.com',
- addressAddressStreet1: '760 Market St',
- addressAddressStreet2: 'Floor 10',
- addressAddressCity: 'San Francisco',
- addressAddressState: null,
- addressAddressPostcode: '94102',
- addressAddressCountry: 'United States',
- position: 4,
- createdBySource: FieldActorSource.SYSTEM,
- createdByWorkspaceMemberId: null,
- createdByName: 'System',
- updatedBySource: FieldActorSource.SYSTEM,
- updatedByWorkspaceMemberId: null,
- updatedByName: 'System',
- },
- {
- id: NOTION_ID,
- name: 'Notion',
- domainNamePrimaryLinkUrl: 'https://notion.com',
- addressAddressStreet1: '2300 Harrison St',
- addressAddressStreet2: null,
- addressAddressCity: 'San Francisco',
- addressAddressState: 'CA',
- addressAddressPostcode: '94110',
- addressAddressCountry: 'United States',
- position: 5,
- createdBySource: FieldActorSource.SYSTEM,
- createdByWorkspaceMemberId: null,
- createdByName: 'System',
- updatedBySource: FieldActorSource.SYSTEM,
- updatedByWorkspaceMemberId: null,
- updatedByName: 'System',
- },
- ])
+ .values(PREFILL_COMPANY_ROWS)
.returning('*')
.execute();
};
diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts
index 4b905d89150..52f1ffd69cf 100644
--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts
@@ -174,6 +174,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({
isUnique: true,
settings: {
maxNumberOfValues: 1,
+ type: 'domain',
},
},
standardObjectMetadataRelatedEntityIds,
diff --git a/packages/twenty-server/src/modules/contact-creation-manager/services/create-company.service.ts b/packages/twenty-server/src/modules/contact-creation-manager/services/create-company.service.ts
index 67a72a14d7c..bbcfe70e2fa 100644
--- a/packages/twenty-server/src/modules/contact-creation-manager/services/create-company.service.ts
+++ b/packages/twenty-server/src/modules/contact-creation-manager/services/create-company.service.ts
@@ -1,5 +1,6 @@
import { Injectable } from '@nestjs/common';
+import { isNonEmptyString } from '@sniptt/guards';
import { type AxiosInstance } from 'axios';
import uniqBy from 'lodash.uniqby';
import { TWENTY_COMPANIES_BASE_URL } from 'twenty-shared/constants';
@@ -7,16 +8,16 @@ import {
type ConnectedAccountProvider,
type FieldActorSource,
} from 'twenty-shared/types';
-import { isDefined, normalizeUrlOrigin } from 'twenty-shared/utils';
-import { type DeepPartial, ILike } from 'typeorm';
+import { isDefined, normalizeDomain } from 'twenty-shared/utils';
+import { type DeepPartial, In } from 'typeorm';
import { SecureHttpClientService } from 'src/engine/core-modules/secure-http-client/secure-http-client.service';
import { WorkspaceOrmManager } from 'src/engine/twenty-orm/workspace-orm.manager';
import { type WorkspaceRepository } from 'src/engine/twenty-orm/repository/workspace-repository';
import { buildSystemAuthContext } from 'src/engine/twenty-orm/utils/build-system-auth-context.util';
import { CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity';
-import { extractDomainFromLink } from 'src/modules/contact-creation-manager/utils/extract-domain-from-link.util';
import { getCompanyNameFromDomainName } from 'src/modules/contact-creation-manager/utils/get-company-name-from-domain-name.util';
+import { getDomainNamesFromLinks } from 'src/modules/contact-creation-manager/utils/get-domain-names-from-links.util';
import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity';
import { computeDisplayName } from 'src/utils/compute-display-name';
@@ -62,37 +63,74 @@ export class CreateCompanyService {
},
);
- const companiesWithoutTrailingSlash = companies.map((company) => ({
+ const normalizedCompanies = companies.map((company) => ({
...company,
domainName: company.domainName
- ? normalizeUrlOrigin(company.domainName)
+ ? normalizeDomain(company.domainName)
: undefined,
}));
- const uniqueCompanies = uniqBy(
- companiesWithoutTrailingSlash,
- 'domainName',
- );
- const conditions = uniqueCompanies.map((companyToCreate) => ({
- domainName: {
- primaryLinkUrl: ILike(`%${companyToCreate.domainName}%`),
- },
- }));
+ const uniqueCompanies = uniqBy(normalizedCompanies, 'domainName');
- const existingCompanies = await companyRepository.find({
- where: conditions,
+ const domainNames = uniqueCompanies
+ .map((companyToCreate) => companyToCreate.domainName)
+ .filter(isNonEmptyString);
+
+ if (domainNames.length === 0) {
+ return {};
+ }
+
+ const companiesMatchedOnPrimaryLink = await companyRepository.find({
+ where: {
+ domainName: {
+ primaryLinkUrl: In(domainNames),
+ },
+ },
withDeleted: true,
});
+
+ const domainNamesWithoutLiveCompany = domainNames.filter(
+ (domainName) =>
+ !isDefined(
+ this.findExistingCompanyByDomainName({
+ existingCompanies: companiesMatchedOnPrimaryLink.filter(
+ (company) => !isDefined(company.deletedAt),
+ ),
+ domainName,
+ }),
+ ),
+ );
+
+ const companiesMatchedOnSecondaryLinks =
+ await this.findCompaniesBySecondaryDomainNames({
+ domainNames: domainNamesWithoutLiveCompany,
+ });
+
+ const companyIdsMatchedOnPrimaryLink = new Set(
+ companiesMatchedOnPrimaryLink.map((company) => company.id),
+ );
+
+ const matchedCompanies = [
+ ...companiesMatchedOnPrimaryLink,
+ ...companiesMatchedOnSecondaryLinks.filter(
+ (company) => !companyIdsMatchedOnPrimaryLink.has(company.id),
+ ),
+ ];
+
+ const existingCompanies = [
+ ...matchedCompanies.filter((company) => !isDefined(company.deletedAt)),
+ ...matchedCompanies.filter((company) => isDefined(company.deletedAt)),
+ ];
+
const existingCompanyIdsMap = this.createCompanyMap(existingCompanies);
const newCompaniesToCreate = uniqueCompanies.filter(
(company) =>
- !existingCompanies.some(
- (existingCompany) =>
- existingCompany.domainName &&
- extractDomainFromLink(
- existingCompany.domainName.primaryLinkUrl,
- ) === company.domainName,
+ !isDefined(
+ this.findExistingCompanyByDomainName({
+ existingCompanies,
+ domainName: company.domainName,
+ }),
),
);
@@ -152,18 +190,69 @@ export class CreateCompanyService {
}, authContext);
}
+ private async findCompaniesBySecondaryDomainNames({
+ domainNames,
+ }: {
+ domainNames: string[];
+ }): Promise<CompanyWorkspaceEntity[]> {
+ if (domainNames.length === 0) {
+ return [];
+ }
+
+ const companyRepository = this.workspaceOrmManager.getRepository(
+ CompanyWorkspaceEntity,
+ {
+ shouldBypassPermissionChecks: true,
+ },
+ );
+
+ const containmentConditions = domainNames
+ .map(
+ (_, index) =>
+ `"company"."domainNameSecondaryLinks" @> CAST(:secondaryLink${index} AS jsonb)`,
+ )
+ .join(' OR ');
+
+ const containmentParameters = Object.fromEntries(
+ domainNames.map((domainName, index) => [
+ `secondaryLink${index}`,
+ JSON.stringify([{ url: domainName }]),
+ ]),
+ );
+
+ return companyRepository
+ .createQueryBuilder('company')
+ .where(containmentConditions, containmentParameters)
+ .withDeleted()
+ .getMany();
+ }
+
+ private findExistingCompanyByDomainName({
+ existingCompanies,
+ domainName,
+ }: {
+ existingCompanies: CompanyWorkspaceEntity[];
+ domainName: string | undefined;
+ }): CompanyWorkspaceEntity | undefined {
+ if (!isNonEmptyString(domainName)) {
+ return undefined;
+ }
+
+ return existingCompanies.find((existingCompany) =>
+ getDomainNamesFromLinks(existingCompany.domainName).includes(domainName),
+ );
+ }
+
private filterCompaniesToRestore(
uniqueCompanies: CompanyToCreate[],
existingCompanies: CompanyWorkspaceEntity[],
) {
return uniqueCompanies
.map((company) => {
- const existingCompany = existingCompanies.find(
- (existingCompany) =>
- existingCompany.domainName &&
- extractDomainFromLink(existingCompany.domainName.primaryLinkUrl) ===
- company.domainName,
- );
+ const existingCompany = this.findExistingCompanyByDomainName({
+ existingCompanies,
+ domainName: company.domainName,
+ });
return isDefined(existingCompany)
? {
@@ -189,7 +278,7 @@ export class CreateCompanyService {
return {
domainName: {
- primaryLinkUrl: 'https://' + company.domainName,
+ primaryLinkUrl: company.domainName ?? '',
},
name,
createdBy: {
@@ -212,12 +301,15 @@ export class CreateCompanyService {
) {
return companies.reduce(
(acc, company) => {
- if (!company.domainName?.primaryLinkUrl || !company.id) {
+ if (!company.id) {
return acc;
}
- const key = extractDomainFromLink(company.domainName.primaryLinkUrl);
- acc[key] = company.id;
+ for (const domainName of getDomainNamesFromLinks(company.domainName)) {
+ if (!isDefined(acc[domainName])) {
+ acc[domainName] = company.id;
+ }
+ }
return acc;
},
diff --git a/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/extract-domain-from-link.spec.ts b/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/extract-domain-from-link.spec.ts
deleted file mode 100644
index b07fe4bd3be..00000000000
--- a/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/extract-domain-from-link.spec.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { extractDomainFromLink } from 'src/modules/contact-creation-manager/utils/extract-domain-from-link.util';
-
-describe('extractDomainFromLink', () => {
- it('should extract domain from link', () => {
- const link = 'https://www.twenty.com';
- const result = extractDomainFromLink(link);
-
- expect(result).toBe('twenty.com');
- });
-
- it('should extract domain from link without www', () => {
- const link = 'https://twenty.com';
- const result = extractDomainFromLink(link);
-
- expect(result).toBe('twenty.com');
- });
-
- it('should extract domain from link without protocol', () => {
- const link = 'twenty.com';
- const result = extractDomainFromLink(link);
-
- expect(result).toBe('twenty.com');
- });
-
- it('should extract domain from link with path', () => {
- const link = 'https://twenty.com/about';
- const result = extractDomainFromLink(link);
-
- expect(result).toBe('twenty.com');
- });
-});
diff --git a/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/get-domain-names-from-links.util.spec.ts b/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/get-domain-names-from-links.util.spec.ts
new file mode 100644
index 00000000000..14d866429d8
--- /dev/null
+++ b/packages/twenty-server/src/modules/contact-creation-manager/utils/__tests__/get-domain-names-from-links.util.spec.ts
@@ -0,0 +1,30 @@
+import { getDomainNamesFromLinks } from 'src/modules/contact-creation-manager/utils/get-domain-names-from-links.util';
+
+describe('getDomainNamesFromLinks', () => {
+ it('should return the primary domain and every secondary domain', () => {
+ expect(
+ getDomainNamesFromLinks({
+ primaryLinkLabel: '',
+ primaryLinkUrl: 'twenty.com',
+ secondaryLinks: [
+ { url: 'twenty-crm.com', label: '' },
+ { url: 'crm.dev', label: '' },
+ ],
+ }),
+ ).toEqual(['twenty.com', 'twenty-crm.com', 'crm.dev']);
+ });
+
+ it('should ignore links without url', () => {
+ expect(
+ getDomainNamesFromLinks({
+ primaryLinkLabel: '',
+ primaryLinkUrl: '',
+ secondaryLinks: [{ url: '', label: 'Old domain' }],
+ }),
+ ).toEqual([]);
+ });
+
+ it('should return an empty list when the company has no domain name', () => {
+ expect(getDomainNamesFromLinks(null)).toEqual([]);
+ });
+});
diff --git a/packages/twenty-server/src/modules/contact-creation-manager/utils/extract-domain-from-link.util.ts b/packages/twenty-server/src/modules/contact-creation-manager/utils/extract-domain-from-link.util.ts
deleted file mode 100644
index 90e5ace27fd..00000000000
--- a/packages/twenty-server/src/modules/contact-creation-manager/utils/extract-domain-from-link.util.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const extractDomainFromLink = (link: string) => {
- const domain = link.replace(/^(https?:\/\/)?(www\.)?/i, '').split('/')[0];
-
- return domain;
-};
diff --git a/packages/twenty-server/src/modules/contact-creation-manager/utils/get-domain-names-from-links.util.ts b/packages/twenty-server/src/modules/contact-creation-manager/utils/get-domain-names-from-links.util.ts
new file mode 100644
index 00000000000..446b58f1e47
--- /dev/null
+++ b/packages/twenty-server/src/modules/contact-creation-manager/utils/get-domain-names-from-links.util.ts
@@ -0,0 +1,20 @@
+import { isNonEmptyString } from '@sniptt/guards';
+import { type LinkMetadata, type LinksMetadata } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
+
+import { parseArrayOrJsonStringToArray } from 'src/engine/api/graphql/graphql-query-runner/utils/parse-additional-items.util';
+
+export const getDomainNamesFromLinks = (
+ domainName: LinksMetadata | null | undefined,
+): string[] => {
+ if (!isDefined(domainName)) {
+ return [];
+ }
+
+ return [
+ domainName.primaryLinkUrl,
+ ...parseArrayOrJsonStringToArray<LinkMetadata>(
+ domainName.secondaryLinks,
+ ).map((link) => link.url),
+ ].filter(isNonEmptyString);
+};
diff --git a/packages/twenty-server/test/integration/constants/test-primary-link-url.constant.ts b/packages/twenty-server/test/integration/constants/test-primary-link-url.constant.ts
index a63cf9e9b26..bb4de613790 100644
--- a/packages/twenty-server/test/integration/constants/test-primary-link-url.constant.ts
+++ b/packages/twenty-server/test/integration/constants/test-primary-link-url.constant.ts
@@ -1,2 +1,2 @@
export const TEST_PRIMARY_LINK_URL = 'https://test.com/';
-export const TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH = 'https://test.com';
+export const TEST_PRIMARY_LINK_URL_AS_DOMAIN = 'test.com';
diff --git a/packages/twenty-server/test/integration/google/messaging/company-domain-matching.integration-spec.ts b/packages/twenty-server/test/integration/google/messaging/company-domain-matching.integration-spec.ts
new file mode 100644
index 00000000000..21b36924896
--- /dev/null
+++ b/packages/twenty-server/test/integration/google/messaging/company-domain-matching.integration-spec.ts
@@ -0,0 +1,211 @@
+import { randomUUID } from 'node:crypto';
+
+import { type gmail_v1 } from 'googleapis';
+
+import {
+ ConnectedAccountProvider,
+ MessageChannelContactAutoCreationPolicy,
+} from 'twenty-shared/types';
+
+import { MessageChannelEntity } from 'src/engine/metadata-modules/message-channel/entities/message-channel.entity';
+
+import { gmailMessage } from 'test/integration/google/mocks/gmail-message.util';
+import { setupGoogleMock } from 'test/integration/google/mocks/setup-google-mock.util';
+import { createManyOperationFactory } from 'test/integration/graphql/utils/create-many-operation-factory.util';
+import { deleteOneOperationFactory } from 'test/integration/graphql/utils/delete-one-operation-factory.util';
+import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
+import { mergeManyOperationFactory } from 'test/integration/graphql/utils/merge-many-operation-factory.util';
+import { updateOneOperationFactory } from 'test/integration/graphql/utils/update-one-operation-factory.util';
+import { connectMessagingAccount } from 'test/integration/utils/connect-messaging-account.util';
+import { deleteRecordsByIds } from 'test/integration/utils/delete-records-by-ids';
+import { findRecordNodesByFilter } from 'test/integration/utils/find-records-by-filter.util';
+import { getCoreRepository } from 'test/integration/utils/get-core-repository.util';
+import { resetMessageChannelSyncState } from 'test/integration/utils/reset-channel-sync-state.util';
+import { runMessageChannelSync } from 'test/integration/utils/run-message-channel-sync.util';
+import { waitForTimelineActivities } from 'test/integration/utils/wait-for-timeline-activities.util';
+
+const HANDLE = '[email protected]';
+
+describe('Gmail contact auto-creation company domain matching (integration)', () => {
+ const inbox: gmail_v1.Schema$Message[] = [];
+
+ const gmail = setupGoogleMock({ handle: HANDLE, inbox });
+
+ let channel: Awaited<ReturnType<typeof connectMessagingAccount>>;
+ const createdCompanyIds: string[] = [];
+
+ const createCompany = async (primaryLinkUrl: string) => {
+ const createResponse = await makeGraphqlAPIRequest(
+ createManyOperationFactory({
+ objectMetadataSingularName: 'company',
+ objectMetadataPluralName: 'companies',
+ gqlFields: 'id domainName { primaryLinkUrl }',
+ data: [
+ {
+ name: `Company ${randomUUID()}`,
+ domainName: { primaryLinkUrl },
+ },
+ ],
+ }),
+ );
+
+ const [company] = createResponse.body.data.createCompanies;
+
+ createdCompanyIds.push(company.id);
+
+ return company;
+ };
+
+ const mergeTwoCompanies = async ({
+ survivingDomainName,
+ mergedAwayDomainName,
+ }: {
+ survivingDomainName: string;
+ mergedAwayDomainName: string;
+ }) => {
+ const survivingCompany = await createCompany(
+ `https://${survivingDomainName}`,
+ );
+ const mergedAwayCompany = await createCompany(
+ `https://www.${mergedAwayDomainName}`,
+ );
+
+ await waitForTimelineActivities('targetCompanyId', [
+ survivingCompany.id,
+ mergedAwayCompany.id,
+ ]);
+
+ const mergeResponse = await makeGraphqlAPIRequest(
+ mergeManyOperationFactory({
+ objectMetadataPluralName: 'companies',
+ gqlFields: 'id domainName { primaryLinkUrl secondaryLinks }',
+ ids: [survivingCompany.id, mergedAwayCompany.id],
+ conflictPriorityIndex: 0,
+ }),
+ );
+
+ expect(mergeResponse.body.errors).toBeUndefined();
+
+ return mergeResponse.body.data.mergeCompanies;
+ };
+
+ const syncMessageFrom = async (sender: string) => {
+ const messages = [gmailMessage({ from: sender, to: HANDLE })];
+
+ inbox.push(...messages);
+ gmail.serveMessageList(messages);
+
+ await resetMessageChannelSyncState(channel.channelId, '');
+
+ await runMessageChannelSync(channel.channelId);
+
+ const [person] = await findRecordNodesByFilter<{
+ company: { id: string } | null;
+ }>('person', 'people', 'company { id }', {
+ emails: { primaryEmail: { eq: sender } },
+ });
+
+ return person?.company?.id;
+ };
+
+ beforeAll(async () => {
+ channel = await connectMessagingAccount({
+ provider: ConnectedAccountProvider.GOOGLE,
+ handle: HANDLE,
+ });
+
+ await getCoreRepository<MessageChannelEntity>(MessageChannelEntity).update(
+ { id: channel.channelId },
+ {
+ isContactAutoCreationEnabled: true,
+ contactAutoCreationPolicy:
+ MessageChannelContactAutoCreationPolicy.SENT_AND_RECEIVED,
+ excludeGroupEmails: false,
+ excludeNonProfessionalEmails: false,
+ },
+ );
+ }, 60000);
+
+ afterAll(async () => {
+ await deleteRecordsByIds('company', createdCompanyIds);
+ await channel?.cleanup().catch(() => undefined);
+ });
+
+ it('stores a domain name as its bare domain whatever spelling it was written with', async () => {
+ const domainName = `written-as-url-${randomUUID()}.com`;
+
+ const company = await createCompany(
+ `HTTPS://WWW.${domainName.toUpperCase()}/careers?utm=1`,
+ );
+
+ expect(company.domainName.primaryLinkUrl).toBe(domainName);
+ }, 120000);
+
+ it('attaches a contact to a company whose domain was written as a full url', async () => {
+ const domainName = `full-url-${randomUUID()}.com`;
+
+ const company = await createCompany(`https://www.${domainName}/careers`);
+
+ expect(await syncMessageFrom(`sender@${domainName}`)).toBe(company.id);
+ }, 120000);
+
+ it('attaches a contact to the surviving company when its domain was merged into secondary links', async () => {
+ const mergedAwayDomainName = `merged-away-${randomUUID()}.com`;
+ const mergedCompany = await mergeTwoCompanies({
+ survivingDomainName: `surviving-${randomUUID()}.com`,
+ mergedAwayDomainName,
+ });
+
+ expect(mergedCompany.domainName.secondaryLinks).toEqual([
+ expect.objectContaining({ url: mergedAwayDomainName }),
+ ]);
+
+ expect(await syncMessageFrom(`sender@${mergedAwayDomainName}`)).toBe(
+ mergedCompany.id,
+ );
+ }, 120000);
+
+ it('prefers the live company holding the domain as a secondary link over a deleted one holding it as its primary', async () => {
+ const domainName = `contested-${randomUUID()}.com`;
+
+ const deletedCompany = await createCompany(domainName);
+
+ await makeGraphqlAPIRequest(
+ deleteOneOperationFactory({
+ objectMetadataSingularName: 'company',
+ gqlFields: 'id',
+ recordId: deletedCompany.id,
+ }),
+ );
+
+ const liveCompany = await createCompany(`live-${randomUUID()}.com`);
+
+ await makeGraphqlAPIRequest(
+ updateOneOperationFactory({
+ objectMetadataSingularName: 'company',
+ gqlFields: 'id domainName { secondaryLinks }',
+ recordId: liveCompany.id,
+ data: {
+ domainName: {
+ primaryLinkUrl: liveCompany.domainName.primaryLinkUrl,
+ secondaryLinks: [{ url: domainName, label: '' }],
+ },
+ },
+ }),
+ );
+
+ expect(await syncMessageFrom(`sender@${domainName}`)).toBe(liveCompany.id);
+ }, 120000);
+
+ it('attaches a contact to the surviving company on its primary domain', async () => {
+ const survivingDomainName = `surviving-${randomUUID()}.com`;
+ const mergedCompany = await mergeTwoCompanies({
+ survivingDomainName,
+ mergedAwayDomainName: `merged-away-${randomUUID()}.com`,
+ });
+
+ expect(await syncMessageFrom(`sender@${survivingDomainName}`)).toBe(
+ mergedCompany.id,
+ );
+ }, 120000);
+});
diff --git a/packages/twenty-server/test/integration/rest/suites/rest-api-core-create-one.integration-spec.ts b/packages/twenty-server/test/integration/rest/suites/rest-api-core-create-one.integration-spec.ts
index ccf334a3aa9..d78f6342216 100644
--- a/packages/twenty-server/test/integration/rest/suites/rest-api-core-create-one.integration-spec.ts
+++ b/packages/twenty-server/test/integration/rest/suites/rest-api-core-create-one.integration-spec.ts
@@ -2,7 +2,7 @@ import { TEST_COMPANY_1_ID } from 'test/integration/constants/test-company-ids.c
import { TEST_PERSON_1_ID } from 'test/integration/constants/test-person-ids.constants';
import {
TEST_PRIMARY_LINK_URL,
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
} from 'test/integration/constants/test-primary-link-url.constant';
import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
import { deleteAllRecords } from 'test/integration/utils/delete-all-records';
@@ -147,7 +147,7 @@ describe('Core REST API Create One endpoint', () => {
expect(createdPerson.company).toBeDefined();
expect(createdPerson.company.domainName.primaryLinkUrl).toBe(
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
);
expect(createdPerson.company.people).not.toBeDefined();
});
diff --git a/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-many.integration-spec.ts b/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-many.integration-spec.ts
index 1687144b6ea..df20388732f 100644
--- a/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-many.integration-spec.ts
+++ b/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-many.integration-spec.ts
@@ -7,7 +7,7 @@ import {
} from 'test/integration/constants/test-person-ids.constants';
import {
TEST_PRIMARY_LINK_URL,
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
} from 'test/integration/constants/test-primary-link-url.constant';
import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
import { deleteAllRecords } from 'test/integration/utils/delete-all-records';
@@ -364,7 +364,7 @@ describe('Core REST API Find Many endpoint', () => {
expect(person.company).toBeDefined();
expect(person.company.domainName.primaryLinkUrl).toBe(
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
);
expect(person.company.people).not.toBeDefined();
diff --git a/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-one.integration-spec.ts b/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-one.integration-spec.ts
index 33fd84804dc..7b1ae556f77 100644
--- a/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-one.integration-spec.ts
+++ b/packages/twenty-server/test/integration/rest/suites/rest-api-core-find-one.integration-spec.ts
@@ -5,7 +5,7 @@ import {
} from 'test/integration/constants/test-person-ids.constants';
import {
TEST_PRIMARY_LINK_URL,
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
} from 'test/integration/constants/test-primary-link-url.constant';
import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';
import { deleteAllRecords } from 'test/integration/utils/delete-all-records';
@@ -108,7 +108,7 @@ describe('Core REST API Find One endpoint', () => {
expect(person.company).toBeDefined();
expect(person.company.domainName.primaryLinkUrl).toBe(
- TEST_PRIMARY_LINK_URL_WIITHOUT_TRAILING_SLASH,
+ TEST_PRIMARY_LINK_URL_AS_DOMAIN,
);
expect(person.company.people).not.toBeDefined();
});
diff --git a/packages/twenty-shared/src/types/FieldMetadataSettings.ts b/packages/twenty-shared/src/types/FieldMetadataSettings.ts
index cf19be800fa..35e264a6917 100644
--- a/packages/twenty-shared/src/types/FieldMetadataSettings.ts
+++ b/packages/twenty-shared/src/types/FieldMetadataSettings.ts
@@ -22,6 +22,10 @@ export type FieldNumberVariant = 'number' | 'percentage';
export type FieldCurrencyFormat = 'short' | 'full';
+export const FIELD_LINKS_VARIANTS = ['url', 'domain'] as const;
+
+export type FieldLinksVariant = (typeof FIELD_LINKS_VARIANTS)[number];
+
type FieldMetadataNumberSettings = {
dataType?: NumberDataType;
decimals?: number;
@@ -58,6 +62,10 @@ type FieldMetadataAddressSettings = {
subFields?: AllowedAddressSubField[];
};
+type FieldMetadataLinksSettings = FieldMetadataMultiItemSettings & {
+ type?: FieldLinksVariant;
+};
+
type FieldMetadataFilesSettings = {
maxNumberOfValues: number;
};
@@ -74,7 +82,7 @@ export type FieldMetadataSettingsMapping = {
[FieldMetadataType.TS_VECTOR]: null;
[FieldMetadataType.PHONES]: FieldMetadataMultiItemSettings | null;
[FieldMetadataType.EMAILS]: FieldMetadataMultiItemSettings | null;
- [FieldMetadataType.LINKS]: FieldMetadataMultiItemSettings | null;
+ [FieldMetadataType.LINKS]: FieldMetadataLinksSettings | null;
[FieldMetadataType.ARRAY]: FieldMetadataMultiItemSettings | null;
[FieldMetadataType.FILES]: FieldMetadataFilesSettings;
};
diff --git a/packages/twenty-shared/src/types/index.ts b/packages/twenty-shared/src/types/index.ts
index 1bbf23b7942..5ba8bb3119e 100644
--- a/packages/twenty-shared/src/types/index.ts
+++ b/packages/twenty-shared/src/types/index.ts
@@ -122,11 +122,16 @@ export {
export type {
FieldNumberVariant,
FieldCurrencyFormat,
+ FieldLinksVariant,
FieldMetadataSettingsMapping,
AllFieldMetadataSettings,
FieldMetadataSettings,
} from './FieldMetadataSettings';
-export { NumberDataType, DateDisplayFormat } from './FieldMetadataSettings';
+export {
+ NumberDataType,
+ DateDisplayFormat,
+ FIELD_LINKS_VARIANTS,
+} from './FieldMetadataSettings';
export { FieldMetadataType } from './FieldMetadataType';
export type { FieldMetadataUniversalSettings } from './FieldMetadataUniversalSettings';
export type { FieldRatingValue } from './FieldRatingValue';
diff --git a/packages/twenty-shared/src/utils/index.ts b/packages/twenty-shared/src/utils/index.ts
index 764e7b87c37..5c03152b66d 100644
--- a/packages/twenty-shared/src/utils/index.ts
+++ b/packages/twenty-shared/src/utils/index.ts
@@ -283,12 +283,15 @@ export { absoluteUrlSchema } from './url/absoluteUrlSchema';
export { buildSignedPath } from './url/buildSignedPath';
export { ensureAbsoluteUrl } from './url/ensureAbsoluteUrl';
export { getAbsoluteUrlOrThrow } from './url/getAbsoluteUrlOrThrow';
+export { getLinkUrlNormalizer } from './url/getLinkUrlNormalizer';
export { getSafeUrl } from './url/getSafeUrl';
export { getUrlHostnameOrThrow } from './url/getUrlHostnameOrThrow';
export { isAbsoluteUrl } from './url/isAbsoluteUrl';
export { isSafeUrl } from './url/isSafeUrl';
+export { isValidDomain } from './url/isValidDomain';
export { isValidHostname } from './url/isValidHostname';
export { isValidUrl } from './url/isValidUrl';
+export { normalizeDomain } from './url/normalizeDomain';
export { normalizeUrl } from './url/normalizeUrl';
export { normalizeUrlOrigin } from './url/normalizeUrlOrigin';
export { safeDecodeURIComponent } from './url/safeDecodeURIComponent';
diff --git a/packages/twenty-shared/src/utils/url/__tests__/isValidDomain.test.ts b/packages/twenty-shared/src/utils/url/__tests__/isValidDomain.test.ts
new file mode 100644
index 00000000000..1b82d99448d
--- /dev/null
+++ b/packages/twenty-shared/src/utils/url/__tests__/isValidDomain.test.ts
@@ -0,0 +1,32 @@
+import { isValidDomain } from '@/utils/url/isValidDomain';
+
+describe('isValidDomain', () => {
+ it.each([
+ 'twenty.com',
+ 'https://www.twenty.com/careers?x=1',
+ 'blog.twenty.com',
+ 'twenty.co.uk',
+ 'münchen.de',
+ 'twenty.com.',
+ 'twenty.com:8080',
+ ])('should accept %s', (rawDomain) => {
+ expect(isValidDomain(rawDomain)).toBe(true);
+ });
+
+ it.each([
+ 'not a domain',
+ 'twenty',
+ 'javascript:alert(1)',
+ '<script>',
+ 'localhost',
+ '192.168.1.1',
+ '',
+ ])('should reject %s', (rawDomain) => {
+ expect(isValidDomain(rawDomain)).toBe(false);
+ });
+
+ it('should judge a backslash host the way a browser reads it', () => {
+ expect(isValidDomain('twenty.com\\@evil.com')).toBe(true);
+ expect(isValidDomain('twenty.com\\@not a domain')).toBe(true);
+ });
+});
diff --git a/packages/twenty-shared/src/utils/url/__tests__/normalizeDomain.test.ts b/packages/twenty-shared/src/utils/url/__tests__/normalizeDomain.test.ts
new file mode 100644
index 00000000000..94407de02e9
--- /dev/null
+++ b/packages/twenty-shared/src/utils/url/__tests__/normalizeDomain.test.ts
@@ -0,0 +1,67 @@
+import { normalizeDomain } from '@/utils/url/normalizeDomain';
+
+describe('normalizeDomain', () => {
+ it.each([
+ 'twenty.com',
+ 'TWENTY.com',
+ 'www.twenty.com',
+ 'https://twenty.com',
+ 'https://www.twenty.com/',
+ 'http://www.Twenty.com/careers?utm=1#team',
+ ' https://twenty.com ',
+ 'twenty.com.',
+ 'twenty.com:8080',
+ 'https://user:[email protected]',
+ 'ftp://twenty.com',
+ ])('should reduce %s to the bare domain', (rawDomain) => {
+ expect(normalizeDomain(rawDomain)).toBe('twenty.com');
+ });
+
+ it('should keep subdomains other than www', () => {
+ expect(normalizeDomain('https://blog.twenty.com')).toBe('blog.twenty.com');
+ });
+
+ it('should fold an internationalized domain onto its punycode spelling', () => {
+ expect(normalizeDomain('münchen.de')).toBe('xn--mnchen-3ya.de');
+ expect(normalizeDomain('https://München.de')).toBe('xn--mnchen-3ya.de');
+ expect(normalizeDomain('xn--mnchen-3ya.de')).toBe('xn--mnchen-3ya.de');
+ });
+
+ it('should read a backslash as a path separator, like a browser does', () => {
+ expect(normalizeDomain('twenty.com\\@evil.com')).toBe('twenty.com');
+ expect(normalizeDomain('https://twenty.com\\evil.com/x')).toBe(
+ 'twenty.com',
+ );
+ });
+
+ it('should drop every user info segment', () => {
+ expect(normalizeDomain('https://a@[email protected]')).toBe('twenty.com');
+ });
+
+ it('should strip every repeated www label and trailing dot in one pass', () => {
+ expect(normalizeDomain('www.www.twenty.com')).toBe('twenty.com');
+ expect(normalizeDomain('twenty.com..')).toBe('twenty.com');
+ });
+
+ it.each([
+ 'twenty.com',
+ 'https://www.twenty.com/careers?x=1',
+ 'www.www.twenty.com',
+ 'twenty.com..',
+ 'münchen.de',
+ 'not a domain',
+ '',
+ ])('should already be normalized after one pass for %s', (rawDomain) => {
+ const normalized = normalizeDomain(rawDomain);
+
+ expect(normalizeDomain(normalized)).toBe(normalized);
+ });
+
+ it('should return an empty string for an empty value', () => {
+ expect(normalizeDomain('')).toBe('');
+ });
+
+ it('should hand back something unparseable rather than throwing', () => {
+ expect(normalizeDomain('not a domain')).toBe('not a domain');
+ });
+});
diff --git a/packages/twenty-shared/src/utils/url/getLinkUrlNormalizer.ts b/packages/twenty-shared/src/utils/url/getLinkUrlNormalizer.ts
new file mode 100644
index 00000000000..7f684d19523
--- /dev/null
+++ b/packages/twenty-shared/src/utils/url/getLinkUrlNormalizer.ts
@@ -0,0 +1,8 @@
+import { type FieldLinksVariant } from '@/types/FieldMetadataSettings';
+import { normalizeDomain } from '@/utils/url/normalizeDomain';
+import { normalizeUrlOrigin } from '@/utils/url/normalizeUrlOrigin';
+
+export const getLinkUrlNormalizer = (
+ linksVariant: FieldLinksVariant | undefined,
+): ((url: string) => string) =>
+ linksVariant === 'domain' ? normalizeDomain : normalizeUrlOrigin;
diff --git a/packages/twenty-shared/src/utils/url/index.ts b/packages/twenty-shared/src/utils/url/index.ts
index bbb6c792670..135f7ba34ad 100644
--- a/packages/twenty-shared/src/utils/url/index.ts
+++ b/packages/twenty-shared/src/utils/url/index.ts
@@ -5,8 +5,11 @@ export * from './ensureAbsoluteUrl';
export * from './getAbsoluteUrlOrThrow';
export * from './getUrlHostnameOrThrow';
export * from './isAbsoluteUrl';
+export * from './isValidDomain';
export * from './isValidHostname';
export * from './isValidUrl';
+export * from './getLinkUrlNormalizer';
+export * from './normalizeDomain';
export * from './normalizeUrl';
export * from './normalizeUrlOrigin';
export * from './buildSignedPath';
diff --git a/packages/twenty-shared/src/utils/url/isValidDomain.ts b/packages/twenty-shared/src/utils/url/isValidDomain.ts
new file mode 100644
index 00000000000..8fdcb8eee2c
--- /dev/null
+++ b/packages/twenty-shared/src/utils/url/isValidDomain.ts
@@ -0,0 +1,8 @@
+import { isValidHostname } from '@/utils/url/isValidHostname';
+import { normalizeDomain } from '@/utils/url/normalizeDomain';
+
+export const isValidDomain = (rawDomain: string): boolean =>
+ isValidHostname(normalizeDomain(rawDomain), {
+ allowLocalhost: false,
+ allowIp: false,
+ });
diff --git a/packages/twenty-shared/src/utils/url/normalizeDomain.ts b/packages/twenty-shared/src/utils/url/normalizeDomain.ts
new file mode 100644
index 00000000000..dd436e2918e
--- /dev/null
+++ b/packages/twenty-shared/src/utils/url/normalizeDomain.ts
@@ -0,0 +1,40 @@
+const SCHEME_PREFIX_REGEX = /^[a-z][a-z0-9+.-]*:\/\//i;
+const PATH_SEPARATOR_REGEX = /[/\\?#]/;
+const USER_INFO_PREFIX_REGEX = /^.*@/;
+const PORT_SUFFIX_REGEX = /:\d+$/;
+
+const stripWwwPrefixesAndTrailingDots = (host: string): string => {
+ const labels = host.split('.');
+
+ while (labels.length > 0 && labels[labels.length - 1] === '') {
+ labels.pop();
+ }
+
+ while (labels[0] === 'www') {
+ labels.shift();
+ }
+
+ return labels.join('.');
+};
+
+const toPunycodeHost = (host: string): string => {
+ try {
+ return new URL(`https://${host}`).hostname;
+ } catch {
+ return host;
+ }
+};
+
+export const normalizeDomain = (rawDomain: string): string => {
+ const host = stripWwwPrefixesAndTrailingDots(
+ rawDomain
+ .trim()
+ .replace(SCHEME_PREFIX_REGEX, '')
+ .split(PATH_SEPARATOR_REGEX)[0]
+ .replace(USER_INFO_PREFIX_REGEX, '')
+ .replace(PORT_SUFFIX_REGEX, '')
+ .toLowerCase(),
+ );
+
+ return toPunycodeHost(host);
+};