The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Show app READMEs on marketplace app pages (#28842)
Abdul Rahman7260ffb3ac94
diff --git a/packages/twenty-apps/public/slack/README.md b/packages/twenty-apps/public/slack/README.mdindex edbfc42dcc3..4fad7dc6e6d 100644--- a/packages/twenty-apps/public/slack/README.md+++ b/packages/twenty-apps/public/slack/README.md@@ -2,18 +2,37 @@**Your CRM, in the conversation. Ask Twenty anything from Slack, and post back to any channel.**-## ✨ What you get+## How it works-- **A CRM assistant in Slack**: `@twenty how many open opportunities do we have?` It answers as whoever tagged it-- **Slack steps for your workflows**: post, update or delete messages, send ephemerals, add reactions, list channels-- **Linked members only**: the assistant answers only Slack accounts linked to a workspace member, and always acts with that member's own permissions+Mention `@Twenty` in a channel or send it a direct message. It looks up records in your workspace, makes the changes you ask for and replies in the thread.-## 💳 Billing+It only answers people whose Slack account is linked to a Twenty user, and it acts with that user's permissions, so it can't see or change anything they couldn't in Twenty.-**Free to run**: no per-seat, per-message or per-event charge. Assistant answers use AI credits on the model's token usage.+> Answers are generated by AI and can be inaccurate. Check important details in Twenty before acting on them.++- **Ask questions**: look up a contact, a company or your open deals.+- **Create and update records**: people, companies, opportunities, notes and tasks, from a message.+- **Preview record links**: paste a link to a Twenty record and Slack shows a preview of it.+- **Slack steps for your workflows**: post, update or delete messages, send ephemerals, add reactions, list channels.++## What you can ask++- “How many open opportunities do we have?”+- “Which deals are closing this month?”+- “What do we know about Acme Corp?”+- “Create a company called Acme Corp”+- “Add a note to Jane Doe: follow up on pricing next week”+- “Create a task to send Acme the proposal by Friday”-## 📌 Getting started+## Getting started-Open the Slack app in Twenty, click **Add connection**, and complete the Slack sign-in. You're all set.+1. **Install the app**: click **Install** to add the Slack app to your Twenty workspace.+2. **Connect Slack**: in the app's **Connections** tab, click **Add connection** and approve the install in Slack.+3. **Link your accounts**: Slack accounts with the same email as a Twenty user are linked automatically. An admin can link the rest from the app's **Settings** tab, and the person approves it in a DM from the bot.+4. **Start asking**: type `/invite @Twenty` in a channel and mention it with your question, or send it a DM.**Self-hosting?** Your admin creates the Slack app and sets its credentials first: see the [self-hosting setup guide](https://github.com/twentyhq/twenty/blob/main/packages/twenty-apps/public/slack/SETUP.md).++## Billing++**Free to run**: no per-seat, per-message or per-event charge. Assistant answers use AI credits on the model's token usage.diff --git a/packages/twenty-apps/public/slack/package.json b/packages/twenty-apps/public/slack/package.jsonindex ab33c6c997f..35f1e7f745c 100644--- a/packages/twenty-apps/public/slack/package.json+++ b/packages/twenty-apps/public/slack/package.json@@ -1,6 +1,6 @@{"name": "@twentyhq/slack",- "version": "1.9.0",+ "version": "1.9.1","description": "Slack assistant and workflow steps for Twenty","license": "MIT","engines": {diff --git a/packages/twenty-website/package.json b/packages/twenty-website/package.jsonindex 95e74878314..1db89256390 100644--- a/packages/twenty-website/package.json+++ b/packages/twenty-website/package.json@@ -29,6 +29,7 @@"react": "19.2.3","react-dom": "19.2.3","react-markdown": "^10.1.0",+ "remark-gfm": "^4.0.1","server-only": "^0.0.1","stripe": "^20.3.1","three": "^0.184.0",diff --git a/packages/twenty-website/src/apps-marketplace/AppDetail.tsx b/packages/twenty-website/src/apps-marketplace/AppDetail.tsxindex 507ad658f17..4e143d75914 100644--- a/packages/twenty-website/src/apps-marketplace/AppDetail.tsx+++ b/packages/twenty-website/src/apps-marketplace/AppDetail.tsx@@ -1,5 +1,6 @@import { msg } from '@lingui/core/macro';import { styled } from '@linaria/react';+import { isDefined } from 'twenty-shared/utils';import { getServerI18n } from '@/platform/i18n/get-server-i18n';import {@@ -14,6 +15,7 @@ import {import { Body, Button, ExternalLink, Heading, SectionShell } from '@/ui';import { AppLogo } from './AppLogo';+import { AppReadme } from './AppReadme';import { buildAppInstallUrl } from './build-app-install-url';import { type MarketplaceAppDetail } from './marketplace-app';@@ -206,6 +208,9 @@ export function AppDetail({ app }: AppDetailProps) {))}</ScreenshotList>)}+ {isDefined(app.aboutDescription) && (+ <AppReadme markdown={app.aboutDescription} />+ )}</MainColumn><Sidebar>diff --git a/packages/twenty-website/src/apps-marketplace/AppReadme.tsx b/packages/twenty-website/src/apps-marketplace/AppReadme.tsxnew file mode 100644index 00000000000..3f88303d60c--- /dev/null+++ b/packages/twenty-website/src/apps-marketplace/AppReadme.tsx@@ -0,0 +1,136 @@+import { styled } from '@linaria/react';+import Markdown, { type Components } from 'react-markdown';+import remarkGfm from 'remark-gfm';+import { isDefined } from 'twenty-shared/utils';++import {+ color,+ FONT_WEIGHT,+ fontFamily,+ radius,+ semanticColor,+ spacing,+ typeRampDeclarations,+} from '@/tokens';+import { ExternalLink } from '@/ui';++import { stripLeadingMarkdownTitle } from './strip-leading-markdown-title';++const Prose = styled.div`+ ${typeRampDeclarations('bodyMd')}+ color: ${semanticColor.inkMuted};+ font-family: ${fontFamily('sans')};+ overflow-wrap: anywhere;++ & > * + * {+ margin-top: ${spacing(4)};+ }++ & > * + h2 {+ margin-top: ${spacing(10)};+ }++ & > * + h3 {+ margin-top: ${spacing(6)};+ }++ & h2 {+ ${typeRampDeclarations('headingXs')}+ color: ${semanticColor.ink};+ font-family: ${fontFamily('serif')};+ font-weight: ${FONT_WEIGHT.light};+ }++ & h3 {+ color: ${semanticColor.ink};+ font-weight: ${FONT_WEIGHT.medium};+ }++ & strong {+ color: ${semanticColor.ink};+ font-weight: ${FONT_WEIGHT.medium};+ }++ & ul,+ & ol {+ padding-left: ${spacing(6)};+ }++ & li + li {+ margin-top: ${spacing(2)};+ }++ & blockquote {+ ${typeRampDeclarations('bodySm')}+ }++ & code {+ color: ${semanticColor.ink};+ font-family: ${fontFamily('mono')};+ font-size: 0.9em;+ }++ & pre,+ & table {+ border: 1px solid ${semanticColor.line};+ border-radius: ${radius(2)};+ display: block;+ max-width: 100%;+ overflow-x: auto;+ }++ & pre {+ padding: ${spacing(3)} ${spacing(4)};+ }++ & table {+ border-collapse: collapse;+ }++ & th,+ & td {+ border-bottom: 1px solid ${semanticColor.line};+ padding: ${spacing(2)} ${spacing(3)};+ text-align: left;+ vertical-align: top;+ }++ & th {+ color: ${semanticColor.ink};+ font-weight: ${FONT_WEIGHT.medium};+ }++ & a {+ color: ${color('blue')};+ text-decoration: underline;+ text-underline-offset: 2px;+ }+`;++const README_COMPONENTS: Components = {+ h1: ({ children }) => <h2>{children}</h2>,+ a: ({ href, children }) =>+ isDefined(href) && href.startsWith('http') ? (+ <ExternalLink href={href}>{children}</ExternalLink>+ ) : (+ <a href={href}>{children}</a>+ ),+};++type AppReadmeProps = {+ markdown: string;+};++export function AppReadme({ markdown }: AppReadmeProps) {+ return (+ <Prose>+ <Markdown+ components={README_COMPONENTS}+ disallowedElements={['img']}+ remarkPlugins={[remarkGfm]}+ >+ {stripLeadingMarkdownTitle(markdown)}+ </Markdown>+ </Prose>+ );+}diff --git a/packages/twenty-website/src/apps-marketplace/fetch-marketplace-app-detail.ts b/packages/twenty-website/src/apps-marketplace/fetch-marketplace-app-detail.tsindex b84b9b42d0d..aee450b107b 100644--- a/packages/twenty-website/src/apps-marketplace/fetch-marketplace-app-detail.ts+++ b/packages/twenty-website/src/apps-marketplace/fetch-marketplace-app-detail.ts@@ -11,7 +11,6 @@ const FIND_MARKETPLACE_APP_DETAIL_QUERY = `sourcePackagelatestAvailableVersionisVetted- descriptionauthorcategorylogoUrl@@ -28,7 +27,6 @@ type ApiMarketplaceAppDetail = {sourcePackage?: string | null;latestAvailableVersion?: string | null;isVetted: boolean;- description?: string | null;author?: string | null;category?: string | null;logoUrl?: string | null;@@ -72,7 +70,7 @@ export async function fetchMarketplaceAppDetailBySlug(logoUrl: detail.logoUrl ?? app.logoUrl,sourcePackage: detail.sourcePackage ?? undefined,isVetted: detail.isVetted,- description: detail.aboutDescription ?? detail.description ?? app.tagline,+ aboutDescription: detail.aboutDescription ?? undefined,screenshots: detail.galleryImages ?? [],websiteUrl: detail.websiteUrl ?? undefined,latestAvailableVersion: detail.latestAvailableVersion ?? undefined,@@ -82,7 +80,6 @@ export async function fetchMarketplaceAppDetailBySlug(return {...app,- description: app.tagline,screenshots: [],};}diff --git a/packages/twenty-website/src/apps-marketplace/marketplace-app.ts b/packages/twenty-website/src/apps-marketplace/marketplace-app.tsindex 8282f7c7f82..c24f07e36d3 100644--- a/packages/twenty-website/src/apps-marketplace/marketplace-app.ts+++ b/packages/twenty-website/src/apps-marketplace/marketplace-app.ts@@ -11,7 +11,7 @@ export type MarketplaceApp = {};export type MarketplaceAppDetail = MarketplaceApp & {- description: string;+ aboutDescription?: string;screenshots: readonly string[];websiteUrl?: string;latestAvailableVersion?: string;diff --git a/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.test.ts b/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.test.tsnew file mode 100644index 00000000000..6be3ac1079b--- /dev/null+++ b/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.test.ts@@ -0,0 +1,22 @@+import { stripLeadingMarkdownTitle } from './strip-leading-markdown-title';++describe('stripLeadingMarkdownTitle', () => {+ it('drops a leading h1 and the blank lines after it', () => {+ expect(stripLeadingMarkdownTitle('# Slack\n\n**Tagline**\n\n## How')).toBe(+ '**Tagline**\n\n## How',+ );+ });++ it('drops a leading h1 preceded by whitespace', () => {+ expect(stripLeadingMarkdownTitle('\n\n # Slack\nBody')).toBe('Body');+ });++ it.each([+ '## Getting started\n\nBody',+ 'Body first\n\n# Not a title',+ '#hashtag without a space',+ '',+ ])('leaves %j unchanged', (markdown) => {+ expect(stripLeadingMarkdownTitle(markdown)).toBe(markdown);+ });+});diff --git a/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.ts b/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.tsnew file mode 100644index 00000000000..a14bc5fde4b--- /dev/null+++ b/packages/twenty-website/src/apps-marketplace/strip-leading-markdown-title.ts@@ -0,0 +1,4 @@+const LEADING_TITLE_PATTERN = /^\s*#\s[^\n]*\n+/;++export const stripLeadingMarkdownTitle = (markdown: string): string =>+ markdown.replace(LEADING_TITLE_PATTERN, '');diff --git a/yarn.lock b/yarn.lockindex 4edbcacc6b6..ee678dbd659 100644--- a/yarn.lock+++ b/yarn.lock@@ -46409,6 +46409,7 @@ __metadata:react: "npm:19.2.3"react-dom: "npm:19.2.3"react-markdown: "npm:^10.1.0"+ remark-gfm: "npm:^4.0.1"server-only: "npm:^0.0.1"stripe: "npm:^20.3.1"three: "npm:^0.184.0"