Skip to content

The open alternative to Salesforce, designed for AI.

Partner application form: required fields, skills rework, fail-fast validation (#21710)

Rashad Karanouh7afc991bd6b1
diff --git a/packages/twenty-website/package.json b/packages/twenty-website/package.json
index be33114bb8a..c0bdb18667e 100644
--- a/packages/twenty-website/package.json
+++ b/packages/twenty-website/package.json
@@ -48,6 +48,9 @@
"@opennextjs/cloudflare": "^1.0.0",
"@swc/core": "^1.15.11",
"@swc/jest": "^0.2.39",
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.3.0",
+ "@testing-library/user-event": "^14.6.1",
"@types/jest": "^30.0.0",
"@types/node": "^20",
"@types/react": "^19.2.0",
@@ -56,6 +59,7 @@
"@types/three": "^0.183.1",
"babel-plugin-react-compiler": "1.0.0",
"jest": "29.7.0",
+ "jest-environment-jsdom": "30.0.0-beta.3",
"jest-environment-node": "^29.4.1",
"ts-jest": "^29.1.1",
"wrangler": "^4.0.0"
diff --git a/packages/twenty-website/src/app/api/partner-application/__tests__/partner-application-schema.test.ts b/packages/twenty-website/src/app/api/partner-application/__tests__/partner-application-schema.test.ts
index 97693df4571..2b80447aab5 100644
--- a/packages/twenty-website/src/app/api/partner-application/__tests__/partner-application-schema.test.ts
+++ b/packages/twenty-website/src/app/api/partner-application/__tests__/partner-application-schema.test.ts
@@ -7,6 +7,10 @@ const minimalValid = {
name: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
+ website: 'https://analyticalengines.example',
+ city: 'London',
+ hourlyRate: 150,
+ projectBudgetMin: 5000,
};
const fullValid = {
@@ -108,7 +112,6 @@ describe('buildLogicFunctionPayload', () => {
expect('country' in payload).toBe(false);
expect('languages' in payload).toBe(false);
expect('partnerScope' in payload).toBe(false);
- expect('domainName' in payload).toBe(false);
});
it('forwards website as domainName when provided', () => {
diff --git a/packages/twenty-website/src/app/api/partner-application/__tests__/route.test.ts b/packages/twenty-website/src/app/api/partner-application/__tests__/route.test.ts
index efabe12ebe7..c3bf221e2a2 100644
--- a/packages/twenty-website/src/app/api/partner-application/__tests__/route.test.ts
+++ b/packages/twenty-website/src/app/api/partner-application/__tests__/route.test.ts
@@ -7,6 +7,9 @@ const VALID_PAYLOAD = {
name: 'Ada Lovelace',
company: 'Analytical Engines',
website: 'https://analytical.example/',
+ city: 'London',
+ hourlyRate: 150,
+ projectBudgetMin: 5000,
};
const VALID_BODY = JSON.stringify(VALID_PAYLOAD);
@@ -168,6 +171,9 @@ describe('POST /api/partner-application', () => {
lastName: 'Lovelace',
companyName: 'Analytical Engines',
domainName: 'https://analytical.example/',
+ city: 'London',
+ hourlyRate: 150,
+ projectBudgetMin: 5000,
});
expect(init.signal).toBeInstanceOf(AbortSignal);
});
diff --git a/packages/twenty-website/src/design-system/components/Form/TagInput.tsx b/packages/twenty-website/src/design-system/components/Form/TagInput.tsx
index b3d08f22217..059c2ca7dde 100644
--- a/packages/twenty-website/src/design-system/components/Form/TagInput.tsx
+++ b/packages/twenty-website/src/design-system/components/Form/TagInput.tsx
@@ -136,6 +136,7 @@ type FormTagInputProps = {
placeholder?: string;
ariaLabel?: string;
suggestions?: ReadonlyArray<string>;
+ searchPool?: ReadonlyArray<string>;
};
export function FormTagInput({
@@ -144,14 +145,20 @@ export function FormTagInput({
placeholder,
ariaLabel,
suggestions,
+ searchPool,
}: FormTagInputProps) {
const [draft, setDraft] = useState('');
const [activeIndex, setActiveIndex] = useState(-1);
const listId = useId();
- const menuMatches =
+ const searchableSuggestions =
suggestions !== undefined
- ? filterSkillSuggestions(suggestions, values, draft)
+ ? [...suggestions, ...(searchPool ?? [])]
+ : undefined;
+
+ const menuMatches =
+ searchableSuggestions !== undefined
+ ? filterSkillSuggestions(searchableSuggestions, values, draft)
: [];
const menuOpen = menuMatches.length > 0;
diff --git a/packages/twenty-website/src/design-system/components/Form/__tests__/TagInput.test.tsx b/packages/twenty-website/src/design-system/components/Form/__tests__/TagInput.test.tsx
new file mode 100644
index 00000000000..6c469ddf48c
--- /dev/null
+++ b/packages/twenty-website/src/design-system/components/Form/__tests__/TagInput.test.tsx
@@ -0,0 +1,40 @@
+/**
+ * @jest-environment jsdom
+ */
+import '@testing-library/jest-dom';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { useState } from 'react';
+
+import { FormTagInput } from '@/design-system/components/Form/TagInput';
+
+function Harness() {
+ const [values, setValues] = useState<string[]>([]);
+ return (
+ <FormTagInput
+ values={values}
+ onValuesChange={setValues}
+ ariaLabel="skills"
+ suggestions={['Workflows']}
+ searchPool={['Kubernetes']}
+ />
+ );
+}
+
+describe('FormTagInput searchPool', () => {
+ it('shows only `suggestions` as ghost chips, not the pool', () => {
+ render(<Harness />);
+ expect(
+ screen.getByRole('button', { name: '+ Workflows' }),
+ ).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: '+ Kubernetes' })).toBeNull();
+ });
+
+ it('autocompletes against the pool', async () => {
+ render(<Harness />);
+ await userEvent.type(screen.getByRole('combobox'), 'kuber');
+ expect(
+ screen.getByRole('option', { name: 'Kubernetes' }),
+ ).toBeInTheDocument();
+ });
+});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/__tests__/partner-application-field-schemas.test.ts b/packages/twenty-website/src/sections/PartnerApplication/__tests__/partner-application-field-schemas.test.ts
new file mode 100644
index 00000000000..06896c84681
--- /dev/null
+++ b/packages/twenty-website/src/sections/PartnerApplication/__tests__/partner-application-field-schemas.test.ts
@@ -0,0 +1,52 @@
+import {
+ nonNegativeAmountStringSchema,
+ partnerApplicationRequestSchema,
+} from '@/sections/PartnerApplication/partner-application-field-schemas';
+
+const validBody: Record<string, unknown> = {
+ name: 'Acme',
+ email: '[email protected]',
+ company: 'Acme Inc',
+ website: 'https://acme.com',
+ city: 'Paris',
+ country: 'FRANCE',
+ partnerScope: ['DEVELOPMENT'],
+ hourlyRate: 120,
+ projectBudgetMin: 5000,
+};
+
+describe('partnerApplicationRequestSchema required fields', () => {
+ it('accepts a complete body', () => {
+ expect(partnerApplicationRequestSchema.safeParse(validBody).success).toBe(
+ true,
+ );
+ });
+
+ it.each(['website', 'city', 'hourlyRate', 'projectBudgetMin'])(
+ 'rejects a body missing %s',
+ (field) => {
+ const { [field]: _omitted, ...rest } = validBody;
+ expect(partnerApplicationRequestSchema.safeParse(rest).success).toBe(
+ false,
+ );
+ },
+ );
+});
+
+describe('nonNegativeAmountStringSchema', () => {
+ it.each(['0', '120', '12.5', '.5', '12.', ' 90 '])(
+ 'accepts the valid amount %p',
+ (value) => {
+ expect(nonNegativeAmountStringSchema.safeParse(value).success).toBe(true);
+ },
+ );
+
+ it.each(['', '.', 'abc', '12abc', '-5', 'NaN', 'Infinity'])(
+ 'rejects the invalid amount %p',
+ (value) => {
+ expect(nonNegativeAmountStringSchema.safeParse(value).success).toBe(
+ false,
+ );
+ },
+ );
+});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/partner-application-field-schemas.ts b/packages/twenty-website/src/sections/PartnerApplication/partner-application-field-schemas.ts
index 615709caece..7722666bbab 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/partner-application-field-schemas.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/partner-application-field-schemas.ts
@@ -25,20 +25,36 @@ export const httpUrlFieldSchema = z
.min(1)
.pipe(z.httpUrl({ error: 'Invalid URL.' }));
+// Currency fields live in wizard state as strings, and the Form.Currency input
+// allows digits plus a single decimal separator — so a lone "." (or "") can
+// reach the reducer. Reject any non-empty value that doesn't represent a
+// finite, non-negative number, so the wizard fails fast on the commercials step
+// instead of submitting parseFloat(".") === NaN to the server.
+export const nonNegativeAmountStringSchema = z
+ .string()
+ .trim()
+ .min(1)
+ .refine(
+ (value) => {
+ const parsed = Number(value);
+ return Number.isFinite(parsed) && parsed >= 0;
+ },
+ { error: 'Enter a valid non-negative amount.' },
+ );
+
const optionalNonEmptyString = z.string().trim().min(1).optional();
const optionalUrl = httpUrlFieldSchema.optional();
-const optionalNonNegativeNumber = z.number().nonnegative().optional();
export const partnerApplicationRequestSchema = z.strictObject({
// Identity
name: z.string().trim().min(1, { error: 'Name is required.' }),
email: emailFieldSchema,
company: z.string().trim().min(1, { error: 'Company is required.' }),
- website: optionalUrl,
+ website: httpUrlFieldSchema,
// Profile
linkedin: optionalUrl,
- city: optionalNonEmptyString,
+ city: z.string().trim().min(1, { error: 'City is required.' }),
country: z.enum(PARTNER_COUNTRY_VALUES).optional(),
languages: z.array(z.enum(PARTNER_LANGUAGE_VALUES)).optional(),
@@ -49,8 +65,10 @@ export const partnerApplicationRequestSchema = z.strictObject({
applicationNotes: optionalNonEmptyString,
// Commercials
- hourlyRate: optionalNonNegativeNumber,
- projectBudgetMin: optionalNonNegativeNumber,
+ hourlyRate: z.number({ error: 'Hourly rate is required.' }).nonnegative(),
+ projectBudgetMin: z
+ .number({ error: 'Minimum project budget is required.' })
+ .nonnegative(),
calendarLink: optionalUrl,
});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/partner-application-modal-data.ts b/packages/twenty-website/src/sections/PartnerApplication/partner-application-modal-data.ts
index 1dae32d4c95..b752241d451 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/partner-application-modal-data.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/partner-application-modal-data.ts
@@ -20,6 +20,7 @@ export const PARTNER_APPLICATION_MODAL_COPY = {
incompleteForm: msg`Please complete all required fields before continuing.`,
invalidEmail: msg`Enter a valid email address.`,
invalidUrl: msg`Enter a valid URL (starting with http:// or https://).`,
+ invalidAmount: msg`Enter a valid amount using numbers only.`,
submitFailed: msg`We could not submit your application. Please try again in a moment.`,
},
} as const;
@@ -29,10 +30,10 @@ export const PARTNER_APPLICATION_FIELD_COPY = {
name: msg`Your name *`,
email: msg`Work email *`,
company: msg`Company or brand *`,
- website: msg`Website or GitHub`,
+ website: msg`Website or GitHub *`,
// Profile
linkedin: msg`LinkedIn URL`,
- city: msg`City`,
+ city: msg`City *`,
country: msg`Country *`,
countryPlaceholder: msg`Select your country`,
countrySearchPlaceholder: msg`Search a country…`,
@@ -44,14 +45,14 @@ export const PARTNER_APPLICATION_FIELD_COPY = {
partnerScope: msg`What you cover *`,
partnerScopeHint: msg`Pick every category that applies.`,
skills: msg`Technical skills`,
- skillsHint: msg`Press Enter or comma to add a skill.`,
- skillsPlaceholder: msg`e.g. React, Postgres, n8n…`,
+ skillsHint: msg`Tools, technologies and industries you specialize in. Press Enter or comma to add.`,
+ skillsPlaceholder: msg`e.g. n8n, Shopify, Real estate…`,
applicationNotes: msg`Anything else we should know?`,
applicationNotesPlaceholder: msg`Workspace URL, customer references, relevant links…`,
// Commercials
- hourlyRate: msg`Hourly rate`,
+ hourlyRate: msg`Hourly rate *`,
hourlyRatePlaceholder: msg`150`,
- projectBudgetMin: msg`Minimum project budget`,
+ projectBudgetMin: msg`Minimum project budget *`,
projectBudgetMinPlaceholder: msg`5,000`,
calendarLink: msg`Calendar / booking link`,
} as const;
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/PartnerApplicationWizard.tsx b/packages/twenty-website/src/sections/PartnerApplication/wizard/PartnerApplicationWizard.tsx
index 49041eae287..e07a18fc470 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/PartnerApplicationWizard.tsx
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/PartnerApplicationWizard.tsx
@@ -177,6 +177,7 @@ export function PartnerApplicationWizard({
setSubmitError,
setSubmitted,
reset,
+ validateCurrentStep,
} = controller;
useEffect(() => {
@@ -192,7 +193,9 @@ export function PartnerApplicationWizard({
? PARTNER_APPLICATION_MODAL_COPY.validation.invalidEmail
: errorValues.includes('invalid_url')
? PARTNER_APPLICATION_MODAL_COPY.validation.invalidUrl
- : PARTNER_APPLICATION_MODAL_COPY.validation.incompleteForm;
+ : errorValues.includes('invalid_amount')
+ ? PARTNER_APPLICATION_MODAL_COPY.validation.invalidAmount
+ : PARTNER_APPLICATION_MODAL_COPY.validation.incompleteForm;
const stepLabelNode = (
<>
@@ -214,6 +217,9 @@ export function PartnerApplicationWizard({
return;
}
if (state.isSubmitting) return;
+ // Fail fast: the final step bypasses GO_NEXT's gate, so validate its
+ // required fields here before hitting the server.
+ if (!validateCurrentStep()) return;
const payload = buildPartnerApplicationRequestBody(state);
@@ -244,6 +250,7 @@ export function PartnerApplicationWizard({
[
isLastStep,
goNext,
+ validateCurrentStep,
state,
setSubmitError,
setSubmitting,
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/build-partner-application-request-body.test.ts b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/build-partner-application-request-body.test.ts
index cdb2b5a0611..7c51cd123cb 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/build-partner-application-request-body.test.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/build-partner-application-request-body.test.ts
@@ -9,6 +9,10 @@ const minimalState: PartnerApplicationState = {
name: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
+ website: 'https://analyticalengines.example',
+ city: 'London',
+ hourlyRate: '150',
+ projectBudgetMin: '5000',
};
describe('buildPartnerApplicationRequestBody', () => {
@@ -18,6 +22,10 @@ describe('buildPartnerApplicationRequestBody', () => {
name: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
+ website: 'https://analyticalengines.example',
+ city: 'London',
+ hourlyRate: 150,
+ projectBudgetMin: 5000,
});
});
@@ -27,24 +35,24 @@ describe('buildPartnerApplicationRequestBody', () => {
name: ' Ada Lovelace ',
email: ' [email protected] ',
company: ' Analytical Engines Ltd ',
+ website: ' https://analyticalengines.example ',
+ city: ' London ',
});
expect(body.name).toBe('Ada Lovelace');
expect(body.email).toBe('[email protected]');
expect(body.company).toBe('Analytical Engines Ltd');
+ expect(body.website).toBe('https://analyticalengines.example');
+ expect(body.city).toBe('London');
});
it('omits optional string fields that are blank or whitespace-only', () => {
const body = buildPartnerApplicationRequestBody({
...minimalState,
- website: ' ',
linkedin: '',
- city: ' ',
applicationNotes: '',
calendarLink: ' ',
});
- expect('website' in body).toBe(false);
expect('linkedin' in body).toBe(false);
- expect('city' in body).toBe(false);
expect('applicationNotes' in body).toBe(false);
expect('calendarLink' in body).toBe(false);
});
@@ -52,15 +60,11 @@ describe('buildPartnerApplicationRequestBody', () => {
it('trims optional string fields when present', () => {
const body = buildPartnerApplicationRequestBody({
...minimalState,
- website: ' https://analyticalengines.example ',
linkedin: ' https://www.linkedin.com/in/ada ',
- city: ' London ',
applicationNotes: ' refs: Acme ',
calendarLink: ' https://cal.com/ada ',
});
- expect(body.website).toBe('https://analyticalengines.example');
expect(body.linkedin).toBe('https://www.linkedin.com/in/ada');
- expect(body.city).toBe('London');
expect(body.applicationNotes).toBe('refs: Acme');
expect(body.calendarLink).toBe('https://cal.com/ada');
});
@@ -97,24 +101,4 @@ describe('buildPartnerApplicationRequestBody', () => {
expect(body.hourlyRate).toBe(150);
expect(body.projectBudgetMin).toBe(5000);
});
-
- it('omits numeric fields that are blank or not parseable', () => {
- const body = buildPartnerApplicationRequestBody({
- ...minimalState,
- hourlyRate: '',
- projectBudgetMin: 'abc',
- });
- expect('hourlyRate' in body).toBe(false);
- expect('projectBudgetMin' in body).toBe(false);
- });
-
- it('omits negative numeric values', () => {
- const body = buildPartnerApplicationRequestBody({
- ...minimalState,
- hourlyRate: '-5',
- projectBudgetMin: '-1',
- });
- expect('hourlyRate' in body).toBe(false);
- expect('projectBudgetMin' in body).toBe(false);
- });
});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/partner-fields.data.test.ts b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/partner-fields.data.test.ts
index 6b36211e69e..030dc18c0d9 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/partner-fields.data.test.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/partner-fields.data.test.ts
@@ -2,6 +2,7 @@ import {
PARTNER_SCOPE_VALUES,
PARTNER_SCOPE_OPTIONS,
PARTNER_SKILL_SUGGESTIONS,
+ PARTNER_SKILL_POOL,
PARTNER_APPLICATION_STEP_REQUIRED_FIELDS,
} from '@/sections/PartnerApplication/wizard/partner-fields.data';
@@ -29,16 +30,38 @@ describe('partner-fields.data', () => {
it('ships a non-empty starter skills suggestion pool', () => {
expect(PARTNER_SKILL_SUGGESTIONS.length).toBeGreaterThan(0);
- expect(PARTNER_SKILL_SUGGESTIONS).toContain('React');
+ expect(PARTNER_SKILL_SUGGESTIONS).toContain('CRM migration');
});
- it('requires country + typeOfTeam on profile, partnerScope on expertise', () => {
+ it('ships a non-empty searchable skill pool containing technical entries', () => {
+ expect(PARTNER_SKILL_POOL.length).toBeGreaterThan(0);
+ expect(PARTNER_SKILL_POOL).toContain('React');
+ });
+
+ it('never suggests a competitor CRM as a skill', () => {
+ const all = [...PARTNER_SKILL_SUGGESTIONS, ...PARTNER_SKILL_POOL];
+ const competitor = /salesforce|hubspot|attio|pipedrive|zoho/i;
+ expect(all.filter((skill) => competitor.test(skill))).toEqual([]);
+ });
+
+ it('requires country, typeOfTeam, and city on profile, partnerScope on expertise', () => {
+ expect([...PARTNER_APPLICATION_STEP_REQUIRED_FIELDS.identity]).toEqual([
+ 'name',
+ 'email',
+ 'company',
+ 'website',
+ ]);
expect([...PARTNER_APPLICATION_STEP_REQUIRED_FIELDS.profile]).toEqual([
'country',
'typeOfTeam',
+ 'city',
]);
expect([...PARTNER_APPLICATION_STEP_REQUIRED_FIELDS.expertise]).toEqual([
'partnerScope',
]);
+ expect([...PARTNER_APPLICATION_STEP_REQUIRED_FIELDS.commercials]).toEqual([
+ 'hourlyRate',
+ 'projectBudgetMin',
+ ]);
});
});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/use-partner-application-state.test.ts b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/use-partner-application-state.test.ts
index cf0b1594981..b6821b31014 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/use-partner-application-state.test.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/__tests__/use-partner-application-state.test.ts
@@ -8,6 +8,7 @@ const baseValidIdentity: Partial<PartnerApplicationState> = {
name: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
+ website: 'https://analyticalengines.example',
};
describe('partnerApplicationReducer', () => {
@@ -53,6 +54,7 @@ describe('partnerApplicationReducer', () => {
'company',
'email',
'name',
+ 'website',
]);
});
@@ -126,7 +128,7 @@ describe('partnerApplicationReducer', () => {
);
});
- it('GO_NEXT on Profile requires country and typeOfTeam', () => {
+ it('GO_NEXT on Profile requires country, typeOfTeam, and city', () => {
const onProfile: PartnerApplicationState = {
...INITIAL_PARTNER_APPLICATION_STATE,
stepIndex: 1,
@@ -135,9 +137,10 @@ describe('partnerApplicationReducer', () => {
const blocked = partnerApplicationReducer(onProfile, { type: 'GO_NEXT' });
expect(blocked.stepIndex).toBe(1);
expect(blocked.fieldErrors.typeOfTeam).toBe('required');
+ expect(blocked.fieldErrors.city).toBe('required');
const ok = partnerApplicationReducer(
- { ...onProfile, typeOfTeam: 'SOLO' },
+ { ...onProfile, typeOfTeam: 'SOLO', city: 'Paris' },
{ type: 'GO_NEXT' },
);
expect(ok.stepIndex).toBe(2);
@@ -152,4 +155,53 @@ describe('partnerApplicationReducer', () => {
});
expect(next.applicationNotes).toBe('Workspace: https://x · refs: Acme');
});
+
+ it('SET_FIELD_ERRORS replaces fieldErrors', () => {
+ const next = partnerApplicationReducer(INITIAL_PARTNER_APPLICATION_STATE, {
+ type: 'SET_FIELD_ERRORS',
+ errors: { hourlyRate: 'required', projectBudgetMin: 'required' },
+ });
+ expect(next.fieldErrors).toEqual({
+ hourlyRate: 'required',
+ projectBudgetMin: 'required',
+ });
+ });
+
+ it('flags Commercials required fields (hourlyRate, projectBudgetMin) when empty', () => {
+ const onCommercials: PartnerApplicationState = {
+ ...INITIAL_PARTNER_APPLICATION_STATE,
+ stepIndex: 3,
+ };
+ const blocked = partnerApplicationReducer(onCommercials, {
+ type: 'GO_NEXT',
+ });
+ expect(blocked.fieldErrors.hourlyRate).toBe('required');
+ expect(blocked.fieldErrors.projectBudgetMin).toBe('required');
+ });
+
+ it('flags Commercials amounts that are non-empty but unparseable (e.g. ".")', () => {
+ const onCommercials: PartnerApplicationState = {
+ ...INITIAL_PARTNER_APPLICATION_STATE,
+ stepIndex: 3,
+ hourlyRate: '.',
+ projectBudgetMin: '5000',
+ };
+ const blocked = partnerApplicationReducer(onCommercials, {
+ type: 'GO_NEXT',
+ });
+ expect(blocked.stepIndex).toBe(3);
+ expect(blocked.fieldErrors.hourlyRate).toBe('invalid_amount');
+ expect(blocked.fieldErrors.projectBudgetMin).toBeUndefined();
+ });
+
+ it('accepts valid Commercials amounts', () => {
+ const onCommercials: PartnerApplicationState = {
+ ...INITIAL_PARTNER_APPLICATION_STATE,
+ stepIndex: 3,
+ hourlyRate: '120',
+ projectBudgetMin: '5000',
+ };
+ const next = partnerApplicationReducer(onCommercials, { type: 'GO_NEXT' });
+ expect(next.fieldErrors).toEqual({});
+ });
});
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/partner-fields.data.ts b/packages/twenty-website/src/sections/PartnerApplication/wizard/partner-fields.data.ts
index 4c5dfdf97ff..1adec8d30b9 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/partner-fields.data.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/partner-fields.data.ts
@@ -71,25 +71,54 @@ export const PARTNER_SCOPE_OPTIONS: ReadonlyArray<{
},
];
+// Shown as ghost chips by default. Technical skills COMPLEMENT "What you cover"
+// (the service categories): they name the specific tools, technologies and
+// industries a partner brings, not the service itself. No competitor CRMs —
+// a migration off any tool is just "CRM migration".
export const PARTNER_SKILL_SUGGESTIONS: ReadonlyArray<string> = [
+ 'CRM migration',
+ 'n8n',
+ 'Zapier',
+ 'Make',
+ 'AI agents',
+ 'Shopify',
+ 'Stripe',
+ 'Real estate',
+ 'E-commerce',
+];
+
+// Searchable-only (autocomplete) — the rest of the tools, stack and verticals,
+// not shown as chips. Surfaced when the applicant types a match. Excludes
+// competitor CRMs (Salesforce, HubSpot, Attio, …) and anything already covered
+// by the "What you cover" service categories.
+export const PARTNER_SKILL_POOL: ReadonlyArray<string> = [
+ // Stack
'React',
'TypeScript',
'Node.js',
'Python',
'PostgreSQL',
'GraphQL',
- 'n8n',
- 'Zapier',
- 'Make',
- 'Salesforce',
- 'HubSpot',
- 'SAP',
- 'Shopify',
- 'Stripe',
+ // Infrastructure
'Docker',
'Kubernetes',
'AWS',
'GCP',
+ 'Azure',
+ 'DevOps',
+ // Tools & platforms
+ 'SAP',
+ 'WhatsApp',
+ // Specializations
+ 'AI automations',
+ 'Data enrichment',
+ 'Cyber security',
+ // Verticals
+ 'Fintech',
+ 'B2B SaaS',
+ 'Non-profit / NGO',
+ 'Tax & accounting',
+ 'Healthcare',
];
export const PARTNER_COUNTRY_VALUES = [
@@ -538,8 +567,8 @@ export const PARTNER_APPLICATION_STEP_REQUIRED_FIELDS: Record<
PartnerApplicationStepId,
ReadonlyArray<keyof PartnerApplicationState>
> = {
- identity: ['name', 'email', 'company'],
- profile: ['country', 'typeOfTeam'],
+ identity: ['name', 'email', 'company', 'website'],
+ profile: ['country', 'typeOfTeam', 'city'],
expertise: ['partnerScope'],
- commercials: [],
+ commercials: ['hourlyRate', 'projectBudgetMin'],
};
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ExpertiseStep.tsx b/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ExpertiseStep.tsx
index 173ab7db069..c640912c155 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ExpertiseStep.tsx
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ExpertiseStep.tsx
@@ -5,6 +5,7 @@ import { useLingui } from '@lingui/react';
import { PARTNER_APPLICATION_FIELD_COPY } from '@/sections/PartnerApplication/partner-application-modal-data';
import {
PARTNER_SCOPE_OPTIONS,
+ PARTNER_SKILL_POOL,
PARTNER_SKILL_SUGGESTIONS,
type PartnerScopeValue,
} from '@/sections/PartnerApplication/wizard/partner-fields.data';
@@ -50,6 +51,7 @@ export function ExpertiseStep({ controller }: ExpertiseStepProps) {
placeholder={i18n._(COPY.skillsPlaceholder)}
ariaLabel={i18n._(COPY.skills)}
suggestions={PARTNER_SKILL_SUGGESTIONS}
+ searchPool={PARTNER_SKILL_POOL}
/>
</Form.Field>
<Form.Field label={i18n._(COPY.applicationNotes)}>
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ProfileStep.tsx b/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ProfileStep.tsx
index 25880571260..c80db92bfd7 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ProfileStep.tsx
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/steps/ProfileStep.tsx
@@ -73,6 +73,7 @@ export function ProfileStep({ controller }: ProfileStepProps) {
type="text"
value={state.city}
onChange={(event) => setField('city', event.target.value)}
+ aria-invalid={state.fieldErrors.city ? true : undefined}
/>
</Form.Field>
<Form.Field>
diff --git a/packages/twenty-website/src/sections/PartnerApplication/wizard/use-partner-application-state.ts b/packages/twenty-website/src/sections/PartnerApplication/wizard/use-partner-application-state.ts
index 017cc06501d..b0f190532a4 100644
--- a/packages/twenty-website/src/sections/PartnerApplication/wizard/use-partner-application-state.ts
+++ b/packages/twenty-website/src/sections/PartnerApplication/wizard/use-partner-application-state.ts
@@ -3,6 +3,7 @@ import { useReducer, useCallback } from 'react';
import {
emailFieldSchema,
httpUrlFieldSchema,
+ nonNegativeAmountStringSchema,
type PartnerApplicationRequest,
} from '@/sections/PartnerApplication/partner-application-field-schemas';
import {
@@ -92,6 +93,7 @@ export type PartnerApplicationAction =
| { type: 'TOGGLE_SCOPE'; value: PartnerScopeValue }
| { type: 'TOGGLE_LANGUAGE'; value: PartnerLanguageValue }
| { type: 'SET_SKILLS'; value: string[] }
+ | { type: 'SET_FIELD_ERRORS'; errors: Partial<Record<string, string>> }
| { type: 'GO_NEXT' }
| { type: 'GO_BACK' }
| { type: 'SET_SUBMITTING'; value: boolean }
@@ -109,9 +111,18 @@ function isEmpty(value: unknown): boolean {
// exactly what the server route schema rejects. The empty/required gate above
// owns "is it filled in"; these only run on non-empty values.
type FieldFormatCheck = {
- field: 'email' | 'website' | 'linkedin' | 'calendarLink';
- schema: typeof emailFieldSchema | typeof httpUrlFieldSchema;
- errorCode: 'invalid_email' | 'invalid_url';
+ field:
+ | 'email'
+ | 'website'
+ | 'linkedin'
+ | 'calendarLink'
+ | 'hourlyRate'
+ | 'projectBudgetMin';
+ schema:
+ | typeof emailFieldSchema
+ | typeof httpUrlFieldSchema
+ | typeof nonNegativeAmountStringSchema;
+ errorCode: 'invalid_email' | 'invalid_url' | 'invalid_amount';
};
const STEP_FORMAT_CHECKS: Partial<
@@ -125,6 +136,16 @@ const STEP_FORMAT_CHECKS: Partial<
{ field: 'linkedin', schema: httpUrlFieldSchema, errorCode: 'invalid_url' },
],
commercials: [
+ {
+ field: 'hourlyRate',
+ schema: nonNegativeAmountStringSchema,
+ errorCode: 'invalid_amount',
+ },
+ {
+ field: 'projectBudgetMin',
+ schema: nonNegativeAmountStringSchema,
+ errorCode: 'invalid_amount',
+ },
{
field: 'calendarLink',
schema: httpUrlFieldSchema,
@@ -194,6 +215,8 @@ export function partnerApplicationReducer(
}
case 'SET_SKILLS':
return { ...state, skills: action.value };
+ case 'SET_FIELD_ERRORS':
+ return { ...state, fieldErrors: action.errors };
case 'GO_NEXT': {
const errors = validateStep(state);
if (Object.keys(errors).length > 0) {
@@ -270,6 +293,15 @@ export function usePartnerApplicationState() {
);
const reset = useCallback(() => dispatch({ type: 'RESET' }), []);
+ // Validate the current step on demand. The final step submits directly and
+ // never passes through GO_NEXT's gate, so the wizard calls this before POSTing
+ // to catch empty required fields client-side instead of round-tripping.
+ const validateCurrentStep = useCallback(() => {
+ const errors = validateStep(state);
+ dispatch({ type: 'SET_FIELD_ERRORS', errors });
+ return Object.keys(errors).length === 0;
+ }, [state]);
+
return {
state,
setField,
@@ -282,6 +314,7 @@ export function usePartnerApplicationState() {
setSubmitError,
setSubmitted,
reset,
+ validateCurrentStep,
};
}
@@ -305,11 +338,13 @@ export function buildPartnerApplicationRequestBody(
name: state.name.trim(),
email: state.email.trim(),
company: state.company.trim(),
+ website: state.website.trim(),
+ city: state.city.trim(),
+ hourlyRate: parseFloat(state.hourlyRate),
+ projectBudgetMin: parseFloat(state.projectBudgetMin),
};
- if (state.website.trim()) body.website = state.website.trim();
if (state.linkedin.trim()) body.linkedin = state.linkedin.trim();
- if (state.city.trim()) body.city = state.city.trim();
if (state.country !== '') body.country = state.country;
if (state.languages.length > 0) body.languages = state.languages;
if (state.typeOfTeam !== '') body.typeOfTeam = state.typeOfTeam;
@@ -317,15 +352,6 @@ export function buildPartnerApplicationRequestBody(
if (state.skills.length > 0) body.skills = state.skills;
if (state.applicationNotes.trim())
body.applicationNotes = state.applicationNotes.trim();
-
- const hourlyRate = parseFloat(state.hourlyRate);
- if (Number.isFinite(hourlyRate) && hourlyRate >= 0)
- body.hourlyRate = hourlyRate;
-
- const projectBudgetMin = parseFloat(state.projectBudgetMin);
- if (Number.isFinite(projectBudgetMin) && projectBudgetMin >= 0)
- body.projectBudgetMin = projectBudgetMin;
-
if (state.calendarLink.trim()) body.calendarLink = state.calendarLink.trim();
return body;
diff --git a/yarn.lock b/yarn.lock
index 907d3ff706b..24fc3c8576d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -55098,6 +55098,9 @@ __metadata:
"@swc/core": "npm:^1.15.11"
"@swc/jest": "npm:^0.2.39"
"@tabler/icons-react": "npm:^3.41.1"
+ "@testing-library/jest-dom": "npm:^6.6.3"
+ "@testing-library/react": "npm:^16.3.0"
+ "@testing-library/user-event": "npm:^14.6.1"
"@types/jest": "npm:^30.0.0"
"@types/node": "npm:^20"
"@types/react": "npm:^19.2.0"
@@ -55109,6 +55112,7 @@ __metadata:
framer-motion: "npm:^11.18.0"
gray-matter: "npm:^4.0.3"
jest: "npm:29.7.0"
+ jest-environment-jsdom: "npm:30.0.0-beta.3"
jest-environment-node: "npm:^29.4.1"
next: "npm:^16.2.6"
next-with-linaria: "npm:^1.3.0"