The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
feat(website): add the affiliate partners page (#29278)
StephanieJoly436ab566a6b88
diff --git a/packages/twenty-website/.env.example b/packages/twenty-website/.env.exampleindex 7fd8902a5a0..899b08c3751 100644--- a/packages/twenty-website/.env.example+++ b/packages/twenty-website/.env.example@@ -13,6 +13,15 @@ PARTNER_APPLICATION_SECRET=CLIENT_BRIEF_WEBHOOK_URL=CLIENT_BRIEF_SECRET=+# Affiliate application — the form on /affiliate-partners POSTs to+# /api/affiliate-application, which forwards the payload to the webhook of the+# "Affiliate form: create affiliate application" workflow in the partners+# workspace (https://api.twenty.com/webhooks/workflows/<workspaceId>/<workflowId>).+# Workflows cannot read headers, so the secret is sent as applicationSecret in+# the body; the workflow must stop when it does not match.+AFFILIATE_APPLICATION_WEBHOOK_URL=+AFFILIATE_APPLICATION_SECRET=+# Partners marketplace — the Twenty workspace the partner directory reads from# (server-side only) via the /s/partners REST endpoint.TWENTY_PARTNERS_API_URL=diff --git a/packages/twenty-website/scripts/check-conventions.mjs b/packages/twenty-website/scripts/check-conventions.mjsindex 38f46629bbc..9d5dee0249b 100644--- a/packages/twenty-website/scripts/check-conventions.mjs+++ b/packages/twenty-website/scripts/check-conventions.mjs@@ -98,6 +98,8 @@ const PUBLIC_SVG_README_DOC_PATHS = [// where layout is genuinely multi-axis (wrapping rows, multi-column// tracks) — listed here explicitly.const ROW_GAP_MULTI_AXIS_FILES = new Set([+ 'sections/affiliate-program/AffiliateIntegratorStrip.tsx',+ 'sections/affiliate-program/AffiliateProgramTerms.tsx','sections/case-study-detail/CaseStudyHero.tsx','sections/faq/Faq.tsx','sections/faq/FaqItems.tsx',diff --git a/packages/twenty-website/src/affiliate-application/AffiliateApplicationForm.tsx b/packages/twenty-website/src/affiliate-application/AffiliateApplicationForm.tsxnew file mode 100644index 00000000000..7383446c8fc--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/AffiliateApplicationForm.tsx@@ -0,0 +1,326 @@+'use client';++import { useLingui } from '@lingui/react';+import { styled } from '@linaria/react';+import { type FormEvent, useState } from 'react';+import { isDefined, isNonEmptyString } from 'twenty-shared/utils';++import {+ color,+ FONT_WEIGHT,+ fontFamily,+ mediaUp,+ semanticColor,+ spacing,+ typeRampDeclarations,+} from '@/tokens';+import { Button, Field, Heading, Select, TextareaField, TextField } from '@/ui';++import { AFFILIATE_APPLICATION_COPY } from './affiliate-application-copy';+import { affiliateApplicationRequestSchema } from './affiliate-application-request-schema';+import {+ AFFILIATE_PARTNER_TYPE_OPTIONS,+ type AffiliatePartnerTypeValue,+} from './data/affiliate-partner-type-options';++const COPY = AFFILIATE_APPLICATION_COPY;++const FormGrid = styled.form`+ column-gap: ${spacing(4)};+ display: grid;+ grid-template-columns: minmax(0, 1fr);+ row-gap: ${spacing(4)};+ text-align: start;++ ${mediaUp('sm')} {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }+`;++const FullWidth = styled.div`+ ${mediaUp('sm')} {+ grid-column: 1 / -1;+ }+`;++const Footer = styled.div`+ align-items: flex-start;+ display: flex;+ flex-direction: column;+ row-gap: ${spacing(4)};++ ${mediaUp('md')} {+ align-items: center;+ flex-direction: row;+ justify-content: space-between;+ }+`;++const CheckboxStack = styled.div`+ display: flex;+ flex-direction: column;+ row-gap: ${spacing(2)};+`;++const CheckboxLabel = styled.label`+ ${typeRampDeclarations('bodyXs')}+ align-items: center;+ color: ${semanticColor.inkMuted};+ cursor: pointer;+ display: flex;+ font-family: ${fontFamily('sans')};+ gap: ${spacing(2)};++ & > input {+ accent-color: ${color('blue')};+ height: 16px;+ width: 16px;+ }+`;++const ErrorBanner = styled.p`+ ${typeRampDeclarations('bodyXs')}+ color: ${color('error')};+ font-family: ${fontFamily('sans')};+ font-weight: ${FONT_WEIGHT.medium};+`;++const SuccessStack = styled.div`+ & > * + * {+ margin-top: ${spacing(2)};+ }+`;++type FieldWithError = keyof typeof AFFILIATE_APPLICATION_COPY.errors;++const isFieldWithError = (field: unknown): field is FieldWithError =>+ typeof field === 'string' && field in AFFILIATE_APPLICATION_COPY.errors;++type FormState = {+ name: string;+ email: string;+ partnerType: AffiliatePartnerTypeValue | '';+ mainChannel: string;+ audienceSize: string;+ country: string;+ promotionPlan: string;+ isIntegrationPartner: boolean;+ acceptsTerms: boolean;+};++const INITIAL_STATE: FormState = {+ name: '',+ email: '',+ partnerType: '',+ mainChannel: '',+ audienceSize: '',+ country: '',+ promotionPlan: '',+ isIntegrationPartner: false,+ acceptsTerms: false,+};++// The route's schema is strict and rejects an empty optional, so blanks are+// dropped rather than sent as ''.+function buildRequestBody(state: FormState) {+ const trimmedChannel = state.mainChannel.trim();+ const trimmedAudience = state.audienceSize.trim();+ const trimmedCountry = state.country.trim();+ const trimmedPlan = state.promotionPlan.trim();++ return {+ name: state.name.trim(),+ email: state.email.trim(),+ partnerType: state.partnerType,+ ...(isNonEmptyString(trimmedChannel) && { mainChannel: trimmedChannel }),+ ...(isNonEmptyString(trimmedAudience) && { audienceSize: trimmedAudience }),+ ...(isNonEmptyString(trimmedCountry) && { country: trimmedCountry }),+ ...(isNonEmptyString(trimmedPlan) && { promotionPlan: trimmedPlan }),+ ...(state.isIntegrationPartner && { isIntegrationPartner: true }),+ acceptsTerms: state.acceptsTerms,+ };+}++export function AffiliateApplicationForm() {+ const { i18n } = useLingui();+ const [state, setState] = useState<FormState>(INITIAL_STATE);+ const [isSubmitting, setIsSubmitting] = useState(false);+ const [isSubmitted, setIsSubmitted] = useState(false);+ const [errorMessage, setErrorMessage] = useState<string | null>(null);++ const setField = <TKey extends keyof FormState>(+ key: TKey,+ value: FormState[TKey],+ ) => setState((current) => ({ ...current, [key]: value }));++ // Same schema as the API route, so anything it would reject gets a+ // field-specific message here instead of a generic failure.+ const validate = () => {+ const result = affiliateApplicationRequestSchema.safeParse(+ buildRequestBody(state),+ );++ if (result.success) {+ return null;+ }++ const field = result.error.issues[0]?.path[0];++ return i18n._(+ isFieldWithError(field) ? COPY.errors[field] : COPY.errors.unexpected,+ );+ };++ const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {+ event.preventDefault();++ const validationError = validate();+ if (isDefined(validationError)) {+ setErrorMessage(validationError);+ return;+ }++ setIsSubmitting(true);+ setErrorMessage(null);++ try {+ const response = await fetch('/api/affiliate-application', {+ body: JSON.stringify(buildRequestBody(state)),+ headers: { 'Content-Type': 'application/json' },+ method: 'POST',+ });++ if (!response.ok) {+ setErrorMessage(i18n._(COPY.errors.unexpected));+ return;+ }++ setIsSubmitted(true);+ setState(INITIAL_STATE);+ } catch {+ setErrorMessage(i18n._(COPY.errors.unexpected));+ } finally {+ setIsSubmitting(false);+ }+ };++ if (isSubmitted) {+ return (+ <SuccessStack role="status">+ <Heading as="h3" size="xs" weight="regular">+ {i18n._(COPY.successHeading)}+ </Heading>+ </SuccessStack>+ );+ }++ return (+ <FormGrid noValidate onSubmit={handleSubmit}>+ <Field label={i18n._(COPY.fields.name)}>+ <TextField+ ariaLabel={i18n._(COPY.fields.name)}+ name="name"+ onValueChange={(value) => setField('name', value)}+ value={state.name}+ />+ </Field>+ <Field label={i18n._(COPY.fields.email)}>+ <TextField+ ariaLabel={i18n._(COPY.fields.email)}+ inputMode="email"+ name="email"+ onValueChange={(value) => setField('email', value)}+ value={state.email}+ />+ </Field>+ <Field label={i18n._(COPY.fields.partnerType)}>+ <Select+ ariaLabel={i18n._(COPY.fields.partnerType)}+ onValueChange={(value) => setField('partnerType', value)}+ options={AFFILIATE_PARTNER_TYPE_OPTIONS.map((option) => ({+ label: i18n._(option.label),+ value: option.value,+ }))}+ placeholder={i18n._(COPY.fields.partnerTypePlaceholder)}+ value={state.partnerType}+ />+ </Field>+ <Field label={i18n._(COPY.fields.mainChannel)}>+ <TextField+ ariaLabel={i18n._(COPY.fields.mainChannel)}+ inputMode="url"+ name="mainChannel"+ onValueChange={(value) => setField('mainChannel', value)}+ placeholder={i18n._(COPY.fields.mainChannelPlaceholder)}+ value={state.mainChannel}+ />+ </Field>+ <Field label={i18n._(COPY.fields.audienceSize)}>+ <TextField+ ariaLabel={i18n._(COPY.fields.audienceSize)}+ name="audienceSize"+ onValueChange={(value) => setField('audienceSize', value)}+ placeholder={i18n._(COPY.fields.audienceSizePlaceholder)}+ value={state.audienceSize}+ />+ </Field>+ <Field label={i18n._(COPY.fields.country)}>+ <TextField+ ariaLabel={i18n._(COPY.fields.country)}+ name="country"+ onValueChange={(value) => setField('country', value)}+ value={state.country}+ />+ </Field>+ <FullWidth>+ <Field label={i18n._(COPY.fields.promotionPlan)}>+ <TextareaField+ ariaLabel={i18n._(COPY.fields.promotionPlan)}+ name="promotionPlan"+ onValueChange={(value) => setField('promotionPlan', value)}+ placeholder={i18n._(COPY.fields.promotionPlanPlaceholder)}+ value={state.promotionPlan}+ />+ </Field>+ </FullWidth>+ <FullWidth>+ <Footer>+ <CheckboxStack>+ <CheckboxLabel>+ <input+ checked={state.isIntegrationPartner}+ name="isIntegrationPartner"+ onChange={(event) =>+ setField('isIntegrationPartner', event.target.checked)+ }+ type="checkbox"+ />+ {i18n._(COPY.fields.isIntegrationPartner)}+ </CheckboxLabel>+ <CheckboxLabel>+ <input+ checked={state.acceptsTerms}+ name="acceptsTerms"+ onChange={(event) =>+ setField('acceptsTerms', event.target.checked)+ }+ type="checkbox"+ />+ {i18n._(COPY.fields.acceptsTerms)}+ </CheckboxLabel>+ </CheckboxStack>+ <Button+ disabled={isSubmitting}+ label={i18n._(isSubmitting ? COPY.submitting : COPY.submit)}+ type="submit"+ />+ </Footer>+ </FullWidth>+ {isDefined(errorMessage) ? (+ <FullWidth>+ <ErrorBanner role="alert">{errorMessage}</ErrorBanner>+ </FullWidth>+ ) : null}+ </FormGrid>+ );+}diff --git a/packages/twenty-website/src/affiliate-application/affiliate-application-copy.ts b/packages/twenty-website/src/affiliate-application/affiliate-application-copy.tsnew file mode 100644index 00000000000..54211a49130--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/affiliate-application-copy.ts@@ -0,0 +1,33 @@+import { msg } from '@lingui/core/macro';++export const AFFILIATE_APPLICATION_COPY = {+ fields: {+ name: msg`Full name`,+ email: msg`Email`,+ partnerType: msg`Partner type`,+ partnerTypePlaceholder: msg`Select a partner type`,+ mainChannel: msg`Main channel (URL)`,+ mainChannelPlaceholder: msg`https://`,+ audienceSize: msg`Audience size or clients`,+ audienceSizePlaceholder: msg`12k newsletter subscribers`,+ country: msg`Country`,+ promotionPlan: msg`How you plan to promote Twenty`,+ promotionPlanPlaceholder: msg`Reviews, tutorials, migration guides, client recommendations…`,+ isIntegrationPartner: msg`I'm already a Twenty integration partner`,+ acceptsTerms: msg`I agree to the affiliate program terms sent with my referral link`,+ },+ errors: {+ name: msg`Please enter your full name.`,+ email: msg`Please enter a valid email address.`,+ partnerType: msg`Please select a partner type.`,+ mainChannel: msg`Main channel must be a full URL starting with https://`,+ audienceSize: msg`Audience size must be 200 characters or fewer.`,+ country: msg`Country must be 100 characters or fewer.`,+ promotionPlan: msg`How you plan to promote Twenty must be 2,000 characters or fewer.`,+ acceptsTerms: msg`Please agree to the program terms.`,+ unexpected: msg`Something went wrong. Please try again.`,+ },+ submit: msg`Submit application`,+ submitting: msg`Submitting…`,+ successHeading: msg`Application received`,+} as const;diff --git a/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.test.ts b/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.test.tsnew file mode 100644index 00000000000..1f270884a98--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.test.ts@@ -0,0 +1,52 @@+import { affiliateApplicationRequestSchema } from './affiliate-application-request-schema';++const VALID_REQUEST = {+ name: 'Ada Lovelace',+ email: '[email protected]',+ partnerType: 'CONTENT_CREATOR',+ acceptsTerms: true,+} as const;++describe('affiliateApplicationRequestSchema', () => {+ it('accepts the minimal application', () => {+ const result = affiliateApplicationRequestSchema.safeParse(VALID_REQUEST);++ expect(result.success).toBe(true);+ });++ it('rejects an application without accepted terms', () => {+ const result = affiliateApplicationRequestSchema.safeParse({+ ...VALID_REQUEST,+ acceptsTerms: false,+ });++ expect(result.success).toBe(false);+ });++ it('rejects an unknown partner type', () => {+ const result = affiliateApplicationRequestSchema.safeParse({+ ...VALID_REQUEST,+ partnerType: 'ASTRONAUT',+ });++ expect(result.success).toBe(false);+ });++ it('rejects a main channel that is not an http URL', () => {+ const result = affiliateApplicationRequestSchema.safeParse({+ ...VALID_REQUEST,+ mainChannel: 'twenty.com',+ });++ expect(result.success).toBe(false);+ });++ it('rejects unknown keys', () => {+ const result = affiliateApplicationRequestSchema.safeParse({+ ...VALID_REQUEST,+ referralCode: 'abc',+ });++ expect(result.success).toBe(false);+ });+});diff --git a/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.ts b/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.tsnew file mode 100644index 00000000000..1f561f8bab4--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/affiliate-application-request-schema.ts@@ -0,0 +1,30 @@+import { z } from 'zod';++import { emailFieldSchema } from '@/partner-application/email-field-schema';+import { httpUrlFieldSchema } from '@/partner-application/http-url-field-schema';++import { AFFILIATE_PARTNER_TYPE_OPTIONS } from './data/affiliate-partner-type-options';++const partnerTypeValues = AFFILIATE_PARTNER_TYPE_OPTIONS.map(+ (option) => option.value,+);++export const affiliateApplicationRequestSchema = z.strictObject({+ name: z.string().trim().min(1, { error: 'Name is required.' }),+ email: emailFieldSchema,+ partnerType: z.enum(partnerTypeValues, {+ error: 'Partner type is required.',+ }),+ mainChannel: httpUrlFieldSchema.optional(),+ audienceSize: z.string().trim().max(200).optional(),+ country: z.string().trim().max(100).optional(),+ promotionPlan: z.string().trim().max(2000).optional(),+ isIntegrationPartner: z.boolean().optional(),+ acceptsTerms: z.literal(true, {+ error: 'The program terms must be accepted.',+ }),+});++export type AffiliateApplicationRequest = z.infer<+ typeof affiliateApplicationRequestSchema+>;diff --git a/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.test.ts b/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.test.tsnew file mode 100644index 00000000000..595b239e4ad--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.test.ts@@ -0,0 +1,51 @@+import { buildAffiliateWorkflowPayload } from './build-affiliate-workflow-payload';++const BASE_REQUEST = {+ name: 'Ada Lovelace',+ email: '[email protected]',+ partnerType: 'CONTENT_CREATOR',+ acceptsTerms: true,+} as const;++describe('buildAffiliateWorkflowPayload', () => {+ it('sends every key, with blanks for the optional fields left empty', () => {+ const payload = buildAffiliateWorkflowPayload(BASE_REQUEST);++ expect(payload).toEqual({+ name: 'Ada Lovelace',+ email: '[email protected]',+ partnerType: 'CONTENT_CREATOR',+ mainChannelUrl: '',+ audienceSize: '',+ country: '',+ promotionPlan: '',+ isIntegrationPartner: false,+ });+ });++ it('flags an existing integration partner', () => {+ const payload = buildAffiliateWorkflowPayload({+ ...BASE_REQUEST,+ isIntegrationPartner: true,+ });++ expect(payload.isIntegrationPartner).toBe(true);+ });++ it('carries the filled optional fields through', () => {+ const payload = buildAffiliateWorkflowPayload({+ ...BASE_REQUEST,+ mainChannel: 'https://youtube.com/@ada',+ audienceSize: '12k subscribers',+ country: 'France',+ promotionPlan: 'Monthly CRM teardown videos.',+ });++ expect(payload).toMatchObject({+ mainChannelUrl: 'https://youtube.com/@ada',+ audienceSize: '12k subscribers',+ country: 'France',+ promotionPlan: 'Monthly CRM teardown videos.',+ });+ });+});diff --git a/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.ts b/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.tsnew file mode 100644index 00000000000..af159dcaf8e--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/build-affiliate-workflow-payload.ts@@ -0,0 +1,32 @@+import { type AffiliateApplicationRequest } from './affiliate-application-request-schema';+import { type AffiliatePartnerTypeValue } from './data/affiliate-partner-type-options';++// Mirrors the expectedBody of the "Affiliate form: create affiliate+// application" workflow in the partners workspace. Every key is always sent:+// a workflow variable pointing at a missing key would not resolve.+export type AffiliateApplicationWorkflowPayload = {+ name: string;+ email: string;+ partnerType: AffiliatePartnerTypeValue;+ mainChannelUrl: string;+ audienceSize: string;+ country: string;+ promotionPlan: string;+ isIntegrationPartner: boolean;+};++export function buildAffiliateWorkflowPayload(+ request: AffiliateApplicationRequest,+): AffiliateApplicationWorkflowPayload {+ return {+ name: request.name,+ // Lowercased so the workflow can match the applicant to an existing person.+ email: request.email.toLowerCase(),+ partnerType: request.partnerType,+ mainChannelUrl: request.mainChannel ?? '',+ audienceSize: request.audienceSize ?? '',+ country: request.country ?? '',+ promotionPlan: request.promotionPlan ?? '',+ isIntegrationPartner: request.isIntegrationPartner === true,+ };+}diff --git a/packages/twenty-website/src/affiliate-application/data/affiliate-partner-type-options.ts b/packages/twenty-website/src/affiliate-application/data/affiliate-partner-type-options.tsnew file mode 100644index 00000000000..5dba065e42f--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/data/affiliate-partner-type-options.ts@@ -0,0 +1,13 @@+import { msg } from '@lingui/core/macro';++import { defineFieldOptions } from '@/partner-application/data/define-field-options';++export const AFFILIATE_PARTNER_TYPE_OPTIONS = defineFieldOptions([+ { value: 'CONTENT_CREATOR', label: msg`Content creator` },+ { value: 'COMMUNITY', label: msg`Community` },+ { value: 'CONSULTANT_AGENCY', label: msg`Consultant or agency` },+ { value: 'TECH_PARTNER', label: msg`Tech partner` },+]);++export type AffiliatePartnerTypeValue =+ (typeof AFFILIATE_PARTNER_TYPE_OPTIONS)[number]['value'];diff --git a/packages/twenty-website/src/affiliate-application/index.ts b/packages/twenty-website/src/affiliate-application/index.tsnew file mode 100644index 00000000000..cddff93fa1b--- /dev/null+++ b/packages/twenty-website/src/affiliate-application/index.ts@@ -0,0 +1 @@+export { AffiliateApplicationForm } from './AffiliateApplicationForm';diff --git a/packages/twenty-website/src/app/[locale]/(site)/affiliate-partners/page.tsx b/packages/twenty-website/src/app/[locale]/(site)/affiliate-partners/page.tsxnew file mode 100644index 00000000000..49e0be7a99f--- /dev/null+++ b/packages/twenty-website/src/app/[locale]/(site)/affiliate-partners/page.tsx@@ -0,0 +1,57 @@+import { getCommunityStats } from '@/platform/community';+import {+ getRouteI18n,+ type LocaleRouteParams,+} from '@/platform/i18n/get-route-i18n';+import { resolveLocaleParam } from '@/platform/i18n/resolve-locale-param';+import {+ buildBreadcrumbListJsonLd,+ buildRouteMetadata,+ JsonLd,+} from '@/platform/seo';+import {+ AffiliateApply,+ AffiliateAudiences,+ AffiliateHero,+ AffiliateIntegratorStrip,+ AffiliateProgramTerms,+} from '@/sections/affiliate-program';+import { AffiliateProgramFaq } from '@/sections/faq';+import { Menu } from '@/sections/menu';++export const generateMetadata = buildRouteMetadata('affiliatePartners');++export default async function AffiliateProgramPage({+ params,+}: {+ params: Promise<LocaleRouteParams>;+}) {+ const [, communityStats] = await Promise.all([+ getRouteI18n(params),+ getCommunityStats(),+ ]);+ const locale = resolveLocaleParam((await params).locale);++ return (+ <>+ <JsonLd+ data={buildBreadcrumbListJsonLd(+ [+ { name: 'Home', path: '/' },+ { name: 'Affiliate program', path: '/affiliate-partners' },+ ],+ locale,+ )}+ />+ <Menu communityStats={communityStats} />+ <main>+ <AffiliateHero />+ <AffiliateProgramTerms />+ <AffiliateAudiences />+ <AffiliateIntegratorStrip />+ <AffiliateProgramFaq />+ <AffiliateApply />+ </main>+ </>+ );+}diff --git a/packages/twenty-website/src/app/api/affiliate-application/route.test.ts b/packages/twenty-website/src/app/api/affiliate-application/route.test.tsnew file mode 100644index 00000000000..89c3c0b6408--- /dev/null+++ b/packages/twenty-website/src/app/api/affiliate-application/route.test.ts@@ -0,0 +1,131 @@+// oxlint-disable-next-line unicorn/require-module-specifiers -- isolate from the other route.test globals+export {};++const ORIGINAL_FETCH = global.fetch;+const ORIGINAL_WEBHOOK_URL = process.env.AFFILIATE_APPLICATION_WEBHOOK_URL;+const ORIGINAL_SECRET = process.env.AFFILIATE_APPLICATION_SECRET;++const VALID_PAYLOAD = {+ name: 'Ada Lovelace',+ email: '[email protected]',+ partnerType: 'CONTENT_CREATOR',+ acceptsTerms: true,+};++function buildRequest({+ body = JSON.stringify(VALID_PAYLOAD),+ ip = '198.51.100.1',+}: {+ body?: string;+ ip?: string;+} = {}) {+ return new Request('https://example.com/api/affiliate-application', {+ method: 'POST',+ headers: { 'content-type': 'application/json', 'x-forwarded-for': ip },+ body,+ });+}++function mockWebhookReply(reply: object) {+ const fetchSpy = jest+ .fn()+ .mockResolvedValue(new Response(JSON.stringify(reply), { status: 200 }));+ global.fetch = fetchSpy;+ return fetchSpy;+}++async function loadRoute() {+ jest.resetModules();+ return import('@/app/api/affiliate-application/route');+}++describe('POST /api/affiliate-application', () => {+ beforeEach(() => {+ process.env.AFFILIATE_APPLICATION_WEBHOOK_URL =+ 'https://hooks.example/workflow';+ process.env.AFFILIATE_APPLICATION_SECRET = 'test-secret-abc123';+ jest.spyOn(console, 'error').mockImplementation(() => {});+ });++ afterEach(() => {+ jest.restoreAllMocks();+ global.fetch = ORIGINAL_FETCH;+ process.env.AFFILIATE_APPLICATION_WEBHOOK_URL = ORIGINAL_WEBHOOK_URL;+ process.env.AFFILIATE_APPLICATION_SECRET = ORIGINAL_SECRET;+ });++ it('forwards the workflow payload with the secret in the body and accepts success:true', async () => {+ const fetchSpy = mockWebhookReply({+ success: true,+ workflowRunId: 'run-id',+ });+ const { POST } = await loadRoute();++ const response = await POST(buildRequest());++ expect(response.status).toBe(200);+ await expect(response.json()).resolves.toEqual({ success: true });+ const [url, init] = fetchSpy.mock.calls[0];+ expect(url).toBe('https://hooks.example/workflow');+ expect(JSON.parse(init.body)).toEqual({+ name: 'Ada Lovelace',+ email: '[email protected]',+ partnerType: 'CONTENT_CREATOR',+ mainChannelUrl: '',+ audienceSize: '',+ country: '',+ promotionPlan: '',+ isIntegrationPartner: false,+ applicationSecret: 'test-secret-abc123',+ });+ });++ it('returns 502 when the workflow answers ok:true instead of success:true', async () => {+ mockWebhookReply({ ok: true });+ const { POST } = await loadRoute();++ const response = await POST(buildRequest({ ip: '198.51.100.2' }));++ expect(response.status).toBe(502);+ });++ it('returns 503 when the webhook URL is not set', async () => {+ delete process.env.AFFILIATE_APPLICATION_WEBHOOK_URL;+ const fetchSpy = mockWebhookReply({ success: true });+ const { POST } = await loadRoute();++ const response = await POST(buildRequest({ ip: '198.51.100.3' }));++ expect(response.status).toBe(503);+ expect(fetchSpy).not.toHaveBeenCalled();+ });++ it('returns 503 without calling the workflow when the secret is not set', async () => {+ delete process.env.AFFILIATE_APPLICATION_SECRET;+ const fetchSpy = mockWebhookReply({ success: true });+ const { POST } = await loadRoute();++ const response = await POST(buildRequest({ ip: '198.51.100.5' }));++ expect(response.status).toBe(503);+ expect(fetchSpy).not.toHaveBeenCalled();+ });++ it('returns 400 when the promotion plan is over the length limit', async () => {+ const fetchSpy = mockWebhookReply({ success: true });+ const { POST } = await loadRoute();++ const response = await POST(+ buildRequest({+ body: JSON.stringify({+ ...VALID_PAYLOAD,+ promotionPlan: 'a'.repeat(2001),+ }),+ ip: '198.51.100.4',+ }),+ );++ expect(response.status).toBe(400);+ expect(fetchSpy).not.toHaveBeenCalled();+ });+});diff --git a/packages/twenty-website/src/app/api/affiliate-application/route.ts b/packages/twenty-website/src/app/api/affiliate-application/route.tsnew file mode 100644index 00000000000..1023eeae8bd--- /dev/null+++ b/packages/twenty-website/src/app/api/affiliate-application/route.ts@@ -0,0 +1,14 @@+import { affiliateApplicationRequestSchema } from '@/affiliate-application/affiliate-application-request-schema';+import { buildAffiliateWorkflowPayload } from '@/affiliate-application/build-affiliate-workflow-payload';+import { createWebhookForwardingRoute } from '@/platform/http';++export const POST = createWebhookForwardingRoute({+ webhookUrlEnvVar: 'AFFILIATE_APPLICATION_WEBHOOK_URL',+ secretEnvVar: 'AFFILIATE_APPLICATION_SECRET',+ upstreamKind: 'workflow-webhook',+ schema: affiliateApplicationRequestSchema,+ buildPayload: buildAffiliateWorkflowPayload,+ logTag: 'affiliate-application',+ notConfiguredMessage: 'Affiliate application endpoint is not configured.',+ failureMessage: 'Affiliate application could not be submitted.',+});diff --git a/packages/twenty-website/src/app/api/partner-application/route.test.ts b/packages/twenty-website/src/app/api/partner-application/route.test.tsindex 7bb25f35fff..7f3fd29b13b 100644--- a/packages/twenty-website/src/app/api/partner-application/route.test.ts+++ b/packages/twenty-website/src/app/api/partner-application/route.test.ts@@ -305,6 +305,27 @@ describe('POST /api/partner-application', () => {expect(response.status).toBe(502);});+ it('returns 502 when the webhook answers success:true instead of ok:true', async () => {+ global.fetch = jest+ .fn()+ .mockResolvedValue(+ new Response(JSON.stringify({ success: true }), { status: 200 }),+ );+ const { POST } = await loadRoute();+ const response = await POST(buildRequest({ ip: '203.0.113.27' }));+ expect(response.status).toBe(502);+ });++ it('returns 503 without calling the webhook when the secret is not set', async () => {+ delete process.env.PARTNER_APPLICATION_SECRET;+ const fetchSpy = jest.fn();+ global.fetch = fetchSpy;+ const { POST } = await loadRoute();+ const response = await POST(buildRequest({ ip: '203.0.113.28' }));+ expect(response.status).toBe(503);+ expect(fetchSpy).not.toHaveBeenCalled();+ });+it('returns 504 when the webhook surfaces an AbortError (timeout path)', async () => {global.fetch = jest.fn()diff --git a/packages/twenty-website/src/platform/http/create-webhook-forwarding-route.ts b/packages/twenty-website/src/platform/http/create-webhook-forwarding-route.tsindex 32f5abf98e6..de2fe4a9801 100644--- a/packages/twenty-website/src/platform/http/create-webhook-forwarding-route.ts+++ b/packages/twenty-website/src/platform/http/create-webhook-forwarding-route.ts@@ -18,9 +18,14 @@ const applicationSecretSchema = z.string().trim().min(1);const MAX_BODY_BYTES = 16 * 1024;const WEBHOOK_TIMEOUT_MS = 8_000;+// Twenty workflow webhooks cannot read headers, so they get the secret in the+// body, and they answer { success: true } where logic functions answer { ok: true }.+type UpstreamKind = 'logic-function' | 'workflow-webhook';+type WebhookForwardingRouteConfig<TSchema extends z.ZodType> = {webhookUrlEnvVar: string;secretEnvVar: string;+ upstreamKind?: UpstreamKind;schema: TSchema;buildPayload: (data: z.infer<TSchema>) => object;logTag: string;@@ -28,9 +33,15 @@ type WebhookForwardingRouteConfig<TSchema extends z.ZodType> = {failureMessage: string;};+const UPSTREAM_SUCCESS_KEY: Record<UpstreamKind, string> = {+ 'logic-function': 'ok',+ 'workflow-webhook': 'success',+};+export function createWebhookForwardingRoute<TSchema extends z.ZodType>({webhookUrlEnvVar,secretEnvVar,+ upstreamKind = 'logic-function',schema,buildPayload,logTag,@@ -133,7 +144,11 @@ export function createWebhookForwardingRoute<TSchema extends z.ZodType>({const upstream = await fetchWithTimeout(webhookUrl,{- body: JSON.stringify(payload),+ body: JSON.stringify(+ upstreamKind === 'workflow-webhook'+ ? { ...payload, applicationSecret }+ : payload,+ ),headers: {'Content-Type': 'application/json','X-Application-Secret': applicationSecret,@@ -184,10 +199,12 @@ export function createWebhookForwardingRoute<TSchema extends z.ZodType>({if (typeof logicResult !== 'object' ||logicResult === null ||- (logicResult as Record<string, unknown>)['ok'] !== true+ (logicResult as Record<string, unknown>)[+ UPSTREAM_SUCCESS_KEY[upstreamKind]+ ] !== true) {console.error(- `[${logTag}] logic function returned non-ok result`,+ `[${logTag}] upstream returned a non-success result`,JSON.stringify({body: upstreamBody.slice(0, 2000),payloadKeys: Object.keys(payload),diff --git a/packages/twenty-website/src/platform/routing/static-website-routes.ts b/packages/twenty-website/src/platform/routing/static-website-routes.tsindex b487d024f0a..378423b78e6 100644--- a/packages/twenty-website/src/platform/routing/static-website-routes.ts+++ b/packages/twenty-website/src/platform/routing/static-website-routes.ts@@ -120,6 +120,15 @@ export const STATIC_WEBSITE_ROUTES: readonly WebsiteRoute[] = [priority: 0.3,title: msg`Submit a Client Brief — Twenty Partners`,},+ {+ changeFrequency: 'monthly',+ description: msg`Earn 20% of seat revenue for 12 months on every team you bring to Twenty Cloud. Apply to the affiliate program for creators, communities, consultants and tech partners.`,+ id: 'affiliatePartners',+ indexed: false,+ path: '/affiliate-partners',+ priority: 0.6,+ title: msg`Twenty Affiliate Program — Earn 20% on Every Referral`,+ },{changeFrequency: 'monthly',description: msg`Packaged CRMs make every company look the same. Twenty is the open source CRM teams shape around their workflow, with a modern UI and a developer-first platform.`,diff --git a/packages/twenty-website/src/platform/routing/website-route.ts b/packages/twenty-website/src/platform/routing/website-route.tsindex b093e86b8ac..6ef3392bc1d 100644--- a/packages/twenty-website/src/platform/routing/website-route.ts+++ b/packages/twenty-website/src/platform/routing/website-route.ts@@ -2,6 +2,7 @@ import { type MessageDescriptor } from '@lingui/core';import { type MetadataRoute } from 'next';export type WebsiteRouteId =+ | 'affiliatePartners'| 'apps'| 'comparePricingDynamics'| 'comparePricingHubspot'diff --git a/packages/twenty-website/src/sections/affiliate-program/AffiliateApply.tsx b/packages/twenty-website/src/sections/affiliate-program/AffiliateApply.tsxnew file mode 100644index 00000000000..7c9bbd0bfa7--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/AffiliateApply.tsx@@ -0,0 +1,74 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { AffiliateApplicationForm } from '@/affiliate-application';+import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import { color, mediaUp, radius, semanticColor, spacing } from '@/tokens';+import { Body, CornerMarkers, Heading, HeadingPair, SectionShell } from '@/ui';++const ApplyStack = styled.div`+ align-items: center;+ display: flex;+ flex-direction: column;+ text-align: center;+ width: 100%;++ & > * + * {+ margin-top: ${spacing(8)};+ }+`;++const HeadingMeasure = styled.div`+ max-width: 615px;+`;++const BodyMeasure = styled.div`+ max-width: 440px;+`;++const FormCard = styled.div`+ background-color: ${color('white')};+ border: 1px solid ${semanticColor.line};+ border-radius: ${radius(2)};+ max-width: 720px;+ padding: ${spacing(6)};+ position: relative;+ width: 100%;++ ${mediaUp('md')} {+ padding: ${spacing(10)};+ }+`;++export function AffiliateApply() {+ const i18n = getServerI18n();++ return (+ <SectionShell+ ariaLabel={i18n._(msg`Affiliate program application`)}+ rhythm="section"+ scheme="light"+ >+ <ApplyStack id="apply">+ <HeadingPair>+ <HeadingMeasure>+ <Heading as="h2" size="lg" weight="light">+ {i18n._(msg`Ready *to start?*`)}+ </Heading>+ </HeadingMeasure>+ <BodyMeasure>+ <Body muted size="sm">+ {i18n._(+ msg`We review every application within 5 business days and send your link once you're approved.`,+ )}+ </Body>+ </BodyMeasure>+ </HeadingPair>+ <FormCard>+ <CornerMarkers />+ <AffiliateApplicationForm />+ </FormCard>+ </ApplyStack>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/affiliate-program/AffiliateAudiences.tsx b/packages/twenty-website/src/sections/affiliate-program/AffiliateAudiences.tsxnew file mode 100644index 00000000000..8bbfa14180c--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/AffiliateAudiences.tsx@@ -0,0 +1,102 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import {+ color,+ FONT_WEIGHT,+ fontFamily,+ fontSize,+ mediaUp,+ radius,+ semanticColor,+ spacing,+} from '@/tokens';+import {+ Body,+ Eyebrow,+ Heading,+ SectionIntro,+ SectionShell,+ SectionStack,+} from '@/ui';++import { AFFILIATE_AUDIENCES } from './affiliate-audiences.data';++const HeadingMeasure = styled.div`+ ${mediaUp('md')} {+ max-width: 640px;+ }+`;++const AudienceGrid = styled.div`+ display: grid;+ gap: ${spacing(3)};+ grid-template-columns: minmax(0, 1fr);++ ${mediaUp('sm')} {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }++ ${mediaUp('lg')} {+ grid-template-columns: repeat(4, minmax(0, 1fr));+ }+`;++const AudienceCard = styled.div`+ background-color: ${color('white')};+ border: 1px solid ${semanticColor.line};+ border-radius: ${radius(2)};+ padding: ${spacing(5)} ${spacing(6)};++ & > * + * {+ margin-top: ${spacing(2)};+ }+`;++const AudienceMarker = styled.span`+ background-color: ${color('blue')};+ border-radius: 1px;+ display: block;+ height: 7px;+ width: 14px;+`;++const AudienceTitle = styled.h3`+ color: ${semanticColor.ink};+ font-family: ${fontFamily('sans')};+ font-size: ${fontSize(4.5)};+ font-weight: ${FONT_WEIGHT.medium};+ letter-spacing: -0.01em;+ line-height: 1.3;+`;++export function AffiliateAudiences() {+ const i18n = getServerI18n();++ return (+ <SectionShell rhythm="section" scheme="light">+ <SectionStack>+ <SectionIntro>+ <Eyebrow>{i18n._(msg`Who it's for`)}</Eyebrow>+ <HeadingMeasure>+ <Heading as="h2" size="lg" weight="light">+ {i18n._(msg`People teams trust *to pick their tools*`)}+ </Heading>+ </HeadingMeasure>+ </SectionIntro>+ <AudienceGrid>+ {AFFILIATE_AUDIENCES.map((audience) => (+ <AudienceCard key={audience.title.id}>+ <AudienceMarker aria-hidden />+ <AudienceTitle>{i18n._(audience.title)}</AudienceTitle>+ <Body muted size="sm">+ {i18n._(audience.body)}+ </Body>+ </AudienceCard>+ ))}+ </AudienceGrid>+ </SectionStack>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/affiliate-program/AffiliateHero.tsx b/packages/twenty-website/src/sections/affiliate-program/AffiliateHero.tsxnew file mode 100644index 00000000000..1ad974f48c6--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/AffiliateHero.tsx@@ -0,0 +1,82 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import { GRADIENT, mediaUp, spacing } from '@/tokens';+import {+ Body,+ Button,+ Eyebrow,+ Heading,+ HeadingPair,+ SectionShell,+} from '@/ui';++const GradientBackdrop = styled.div`+ background: ${GRADIENT.heroGlow};+ inset: 0 -20%;+ position: absolute;+`;++// Same hero rhythm as PartnerHero: Heading->Body 12px (HeadingPair), then one+// 32px step to every following block.+const IntroStack = styled.div`+ align-items: center;+ display: flex;+ flex-direction: column;+ text-align: center;+ width: 100%;++ & > * + * {+ margin-top: ${spacing(8)};+ }+`;++const HeadingMeasure = styled.div`+ max-width: 360px;+ width: 100%;++ ${mediaUp('md')} {+ max-width: 720px;+ }+`;++const BodyMeasure = styled.div`+ margin-inline: auto;+ max-width: 360px;++ ${mediaUp('md')} {+ max-width: 500px;+ }+`;++export function AffiliateHero() {+ const i18n = getServerI18n();++ return (+ <SectionShell+ background={<GradientBackdrop />}+ rhythm="hero"+ scheme="light"+ >+ <IntroStack>+ <Eyebrow>{i18n._(msg`Twenty affiliate program`)}</Eyebrow>+ <HeadingPair>+ <HeadingMeasure>+ <Heading as="h1" size="lg" weight="light">+ {i18n._(msg`Earn 20% on every team\n*you bring to Twenty*`)}+ </Heading>+ </HeadingMeasure>+ <BodyMeasure>+ <Body muted size="sm">+ {i18n._(+ msg`Recommend the CRM technical teams build at AI speed. Get paid every month, for a year, on each new customer.`,+ )}+ </Body>+ </BodyMeasure>+ </HeadingPair>+ <Button href="#apply" label={i18n._(msg`Apply now`)} />+ </IntroStack>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/affiliate-program/AffiliateIntegratorStrip.tsx b/packages/twenty-website/src/sections/affiliate-program/AffiliateIntegratorStrip.tsxnew file mode 100644index 00000000000..c7b7a894a5f--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/AffiliateIntegratorStrip.tsx@@ -0,0 +1,57 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import { color, mediaUp, radius, semanticColor, spacing } from '@/tokens';+import { Body, Button, Heading, SectionShell } from '@/ui';++const IntegratorRow = styled.div`+ align-items: center;+ background-color: ${color('white')};+ border: 1px solid ${semanticColor.line};+ border-radius: ${radius(2)};+ column-gap: ${spacing(6)};+ display: flex;+ flex-direction: column;+ padding: ${spacing(6)};+ row-gap: ${spacing(4)};++ ${mediaUp('sm')} {+ flex-direction: row;+ justify-content: space-between;+ }+`;++const IntegratorCopy = styled.div`+ max-width: 520px;++ & > * + * {+ margin-top: ${spacing(1.5)};+ }+`;++export function AffiliateIntegratorStrip() {+ const i18n = getServerI18n();++ return (+ <SectionShell rhythm="section" scheme="muted">+ <IntegratorRow>+ <IntegratorCopy>+ <Heading as="h2" size="xs" weight="regular">+ {i18n._(msg`Already a Twenty *integration partner?*`)}+ </Heading>+ <Body muted size="sm">+ {i18n._(+ msg`Tick the box in the form and we link your application to your existing partner record, so you can be in both programs.`,+ )}+ </Body>+ </IntegratorCopy>+ <Button+ href="#apply"+ label={i18n._(msg`Join the program`)}+ variant="outlined"+ />+ </IntegratorRow>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/affiliate-program/AffiliateProgramTerms.tsx b/packages/twenty-website/src/sections/affiliate-program/AffiliateProgramTerms.tsxnew file mode 100644index 00000000000..a5a2883aa99--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/AffiliateProgramTerms.tsx@@ -0,0 +1,113 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import {+ color,+ DURATION,+ mediaUp,+ radius,+ REDUCED_MOTION,+ semanticColor,+ SHADOW,+ spacing,+} from '@/tokens';+import { Body, Eyebrow, Heading, SectionShell } from '@/ui';++import { AFFILIATE_PROGRAM_TERMS } from './affiliate-program-terms.data';++const TermsGrid = styled.div`+ column-gap: ${spacing(10)};+ display: grid;+ grid-template-columns: minmax(0, 1fr);+ row-gap: ${spacing(8)};++ ${mediaUp('md')} {+ grid-template-columns: 340px minmax(0, 1fr);+ }+`;++const TermsAside = styled.div`+ & > * + * {+ margin-top: ${spacing(4)};+ }++ ${mediaUp('md')} {+ align-self: start;+ position: sticky;+ top: ${spacing(24)};+ }+`;++const TermsCards = styled.div`+ display: grid;+ gap: ${spacing(3)};+ grid-template-columns: minmax(0, 1fr);++ ${mediaUp('sm')} {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ }+`;++const TermCard = styled.div`+ background-color: ${color('white')};+ border: 1px solid ${semanticColor.line};+ border-radius: ${radius(2)};+ padding: ${spacing(5)} ${spacing(6)};+ transition: box-shadow ${DURATION.xs} ease;++ & > * + * {+ margin-top: ${spacing(2)};+ }++ &:hover {+ box-shadow: ${SHADOW.card};+ }++ ${REDUCED_MOTION} {+ transition: none;+ }+`;++const TermMarker = styled.span`+ background-color: ${color('blue')};+ border-radius: 1px;+ display: block;+ height: 7px;+ width: 14px;+`;++export function AffiliateProgramTerms() {+ const i18n = getServerI18n();++ return (+ <SectionShell rhythm="section" scheme="muted">+ <TermsGrid>+ <TermsAside>+ <Eyebrow>{i18n._(msg`How it works`)}</Eyebrow>+ <Heading as="h2" size="sm" weight="light">+ {i18n._(msg`From link *to payout*`)}+ </Heading>+ <Body muted size="sm">+ {i18n._(+ msg`Share your link, we credit the signups it brings, and you get paid every month the customer stays.`,+ )}+ </Body>+ </TermsAside>+ <TermsCards>+ {AFFILIATE_PROGRAM_TERMS.map((term) => (+ <TermCard key={term.value.id}>+ <TermMarker aria-hidden />+ <Heading as="h3" size="xs" weight="light">+ {i18n._(term.value)}+ </Heading>+ <Body muted size="sm">+ {i18n._(term.label)}+ </Body>+ </TermCard>+ ))}+ </TermsCards>+ </TermsGrid>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/affiliate-program/affiliate-audiences.data.ts b/packages/twenty-website/src/sections/affiliate-program/affiliate-audiences.data.tsnew file mode 100644index 00000000000..8b57ab047de--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/affiliate-audiences.data.ts@@ -0,0 +1,26 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';++export type AffiliateAudience = {+ title: MessageDescriptor;+ body: MessageDescriptor;+};++export const AFFILIATE_AUDIENCES: readonly AffiliateAudience[] = [+ {+ title: msg`Content creators`,+ body: msg`YouTube, newsletters, LinkedIn, TikTok: anyone covering GTM tools.`,+ },+ {+ title: msg`Communities`,+ body: msg`Open source, Engineering and GTM communities.`,+ },+ {+ title: msg`Consultants and agencies`,+ body: msg`Recommend Twenty to clients, even on projects you don't implement.`,+ },+ {+ title: msg`Tech partners`,+ body: msg`Software companies whose customers need a CRM.`,+ },+];diff --git a/packages/twenty-website/src/sections/affiliate-program/affiliate-program-terms.data.ts b/packages/twenty-website/src/sections/affiliate-program/affiliate-program-terms.data.tsnew file mode 100644index 00000000000..a88b8c11016--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/affiliate-program-terms.data.ts@@ -0,0 +1,26 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';++export type AffiliateProgramTerm = {+ value: MessageDescriptor;+ label: MessageDescriptor;+};++export const AFFILIATE_PROGRAM_TERMS: readonly AffiliateProgramTerm[] = [+ {+ value: msg`20%`,+ label: msg`of seat revenue on Cloud Organization and Enterprise`,+ },+ {+ value: msg`12 months`,+ label: msg`per customer, from their first payment`,+ },+ {+ value: msg`60 days`,+ label: msg`of credit after each click on your link`,+ },+ {+ value: msg`Monthly`,+ label: msg`Payouts from $50, after a 30-day hold`,+ },+];diff --git a/packages/twenty-website/src/sections/affiliate-program/index.ts b/packages/twenty-website/src/sections/affiliate-program/index.tsnew file mode 100644index 00000000000..50d08b81686--- /dev/null+++ b/packages/twenty-website/src/sections/affiliate-program/index.ts@@ -0,0 +1,5 @@+export { AffiliateApply } from './AffiliateApply';+export { AffiliateAudiences } from './AffiliateAudiences';+export { AffiliateHero } from './AffiliateHero';+export { AffiliateIntegratorStrip } from './AffiliateIntegratorStrip';+export { AffiliateProgramTerms } from './AffiliateProgramTerms';diff --git a/packages/twenty-website/src/sections/faq/AffiliateProgramFaq.tsx b/packages/twenty-website/src/sections/faq/AffiliateProgramFaq.tsxnew file mode 100644index 00000000000..642829029f5--- /dev/null+++ b/packages/twenty-website/src/sections/faq/AffiliateProgramFaq.tsx@@ -0,0 +1,47 @@+import { msg } from '@lingui/core/macro';+import { styled } from '@linaria/react';++import { getServerI18n } from '@/platform/i18n/get-server-i18n';+import { buildFaqPageJsonLd } from '@/platform/seo/build-faq-page-json-ld';+import { JsonLd } from '@/platform/seo/JsonLd';+import { mediaUp } from '@/tokens';+import {+ Eyebrow,+ Heading,+ SectionIntro,+ SectionShell,+ SectionStack,+} from '@/ui';++import { AFFILIATE_PROGRAM_FAQ_QUESTIONS } from './affiliate-program-faq.data';+import { FaqBackdrop } from './FaqBackdrop';+import { FaqItems } from './FaqItems';++const HeadingMeasure = styled.div`+ ${mediaUp('md')} {+ max-width: 700px;+ }+`;++export function AffiliateProgramFaq() {+ const i18n = getServerI18n();++ return (+ <SectionShell background={<FaqBackdrop />} rhythm="spacious" scheme="dark">+ <JsonLd+ data={buildFaqPageJsonLd(i18n, AFFILIATE_PROGRAM_FAQ_QUESTIONS)}+ />+ <SectionStack>+ <SectionIntro>+ <Eyebrow>{i18n._(msg`FAQ`)}</Eyebrow>+ <HeadingMeasure>+ <Heading as="h2" size="lg" weight="light">+ {i18n._(msg`Earning with *Twenty*`)}+ </Heading>+ </HeadingMeasure>+ </SectionIntro>+ <FaqItems questions={AFFILIATE_PROGRAM_FAQ_QUESTIONS} />+ </SectionStack>+ </SectionShell>+ );+}diff --git a/packages/twenty-website/src/sections/faq/affiliate-program-faq.data.ts b/packages/twenty-website/src/sections/faq/affiliate-program-faq.data.tsnew file mode 100644index 00000000000..7b461d6f803--- /dev/null+++ b/packages/twenty-website/src/sections/faq/affiliate-program-faq.data.ts@@ -0,0 +1,22 @@+import { msg } from '@lingui/core/macro';++import { type FaqQuestion } from './faq.data';++export const AFFILIATE_PROGRAM_FAQ_QUESTIONS: readonly FaqQuestion[] = [+ {+ question: msg`Which plans count?`,+ answer: msg`Organization and Enterprise plans on Twenty Cloud. Self-hosted Organization is coming soon. Pro plans and AI credits are not included.`,+ },+ {+ question: msg`How long does my link work?`,+ answer: msg`60 days after the click. If the visitor starts a Cloud Organization or Enterprise plan within that time, the commission is yours. If they later click another partner's link, that partner gets the credit.`,+ },+ {+ question: msg`When do I get paid?`,+ answer: msg`Monthly, once your balance reaches $50. Each commission is released 30 days after the customer pays, to cover refunds. Once paid, it's yours.`,+ },+ {+ question: msg`Can I refer my own company?`,+ answer: msg`No. Self-referrals, your own workspace, and existing Twenty customers don't earn commission.`,+ },+];diff --git a/packages/twenty-website/src/sections/faq/index.ts b/packages/twenty-website/src/sections/faq/index.tsindex 46f2709707a..14e29c4c6bf 100644--- a/packages/twenty-website/src/sections/faq/index.ts+++ b/packages/twenty-website/src/sections/faq/index.ts@@ -1,3 +1,4 @@+export { AffiliateProgramFaq } from './AffiliateProgramFaq';export { BecomePartnerFaq } from './BecomePartnerFaq';export { Faq } from './Faq';export { PartnerFaq } from './PartnerFaq';