Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/dashboard/src/components/provider-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,29 @@ function SendGridIcon({ size = 24, ...props }: ProviderIconProps) {
);
}

function SlackIcon({ size = 24, ...props }: ProviderIconProps) {
return (
<SvgIcon {...props} defaultLabel="Slack" size={size} viewBox="0 0 128 128">
<path
d="M27.255 80.719c0 7.33-5.978 13.317-13.309 13.317C6.616 94.036.63 88.049.63 80.719s5.987-13.317 13.317-13.317h13.309zm6.709 0c0-7.33 5.987-13.317 13.317-13.317s13.317 5.986 13.317 13.317v33.335c0 7.33-5.986 13.317-13.317 13.317-7.33 0-13.317-5.987-13.317-13.317zm0 0"
fill="#de1c59"
/>
<path
d="M47.281 27.255c-7.33 0-13.317-5.978-13.317-13.309C33.964 6.616 39.951.63 47.281.63s13.317 5.987 13.317 13.317v13.309zm0 6.709c7.33 0 13.317 5.987 13.317 13.317s-5.986 13.317-13.317 13.317H13.946C6.616 60.598.63 54.612.63 47.281c0-7.33 5.987-13.317 13.317-13.317zm0 0"
fill="#35c5f0"
/>
<path
d="M100.745 47.281c0-7.33 5.978-13.317 13.309-13.317 7.33 0 13.317 5.987 13.317 13.317s-5.987 13.317-13.317 13.317h-13.309zm-6.709 0c0 7.33-5.987 13.317-13.317 13.317s-13.317-5.986-13.317-13.317V13.946C67.402 6.616 73.388.63 80.719.63c7.33 0 13.317 5.987 13.317 13.317zm0 0"
fill="#2eb57d"
/>
<path
d="M80.719 100.745c7.33 0 13.317 5.978 13.317 13.309 0 7.33-5.987 13.317-13.317 13.317s-13.317-5.987-13.317-13.317v-13.309zm0-6.709c-7.33 0-13.317-5.987-13.317-13.317s5.986-13.317 13.317-13.317h33.335c7.33 0 13.317 5.986 13.317 13.317 0 7.33-5.987 13.317-13.317 13.317zm0 0"
fill="#ebb02e"
/>
</SvgIcon>
);
}

export const GitHubIcon = createSimpleProviderIcon(siGithub);

export const ProviderIcons = {
Expand Down Expand Up @@ -300,6 +323,7 @@ export const ProviderIcons = {
posthog: createSimpleProviderIcon(siPosthog),
sendgrid: SendGridIcon,
sentry: createSimpleProviderIcon(siSentry),
slack: SlackIcon,
snowflake: createSimpleProviderIcon(siSnowflake),
tiktok_marketing: createSimpleProviderIcon(siTiktok),
vercel: createSimpleProviderIcon(siVercel),
Expand Down
3 changes: 2 additions & 1 deletion apps/landing/src/features/connectors/Browser.astro
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ const categoryOptions = [
{connector.capabilities.map((capability) => <span>{capability}</span>)}
</div>
<h2>{connector.label}</h2>
<p>{connector.category}</p>
<p class="connector-card-category">{connector.category}</p>
<p class="connector-card-description">{connector.description}</p>
</div>
</a>
))
Expand Down
13 changes: 13 additions & 0 deletions apps/landing/src/features/connectors/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ describe("DATA_SOURCE_CONNECTORS", () => {
);
});

it("includes Slack as an API connector with provider description copy", () => {
expect(getConnector("slack")).toEqual(
expect.objectContaining({
capabilities: ["API"],
category: "Productivity",
description: expect.stringContaining("Slack"),
key: "slack",
label: "Slack",
slug: "slack",
})
);
});

it("creates connector FAQ copy from provider metadata", () => {
const connector = getConnector("github");
const faqs = getConnectorFaqs(connector);
Expand Down
26 changes: 20 additions & 6 deletions apps/landing/src/features/connectors/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@
display: grid;
grid-template-columns: 76px minmax(0, 1fr);
gap: 16px;
align-items: center;
min-height: 126px;
align-items: start;
min-height: 174px;
padding: 12px 18px 12px 12px;
border: 1px solid var(--connector-line);
border-radius: 28px;
Expand Down Expand Up @@ -251,6 +251,7 @@
display: inline-flex;
align-items: center;
justify-content: center;
margin-top: 3px;
width: 76px;
height: 76px;
border-radius: 18px;
Expand Down Expand Up @@ -310,16 +311,29 @@
white-space: nowrap;
}

.connector-card p {
.connector-card-category,
.connector-card-description {
margin: 6px 0 0;
overflow: hidden;
color: var(--connector-muted);
line-height: 1.35;
}

.connector-card-category {
overflow: hidden;
font-size: 18px;
line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}

.connector-card-description {
display: -webkit-box;
overflow: hidden;
color: var(--connector-soft);
font-size: 14px;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}

.connector-detail-main {
width: min(100%, 1180px);
margin: 0 auto;
Expand Down Expand Up @@ -715,7 +729,7 @@
}

.connector-card {
min-height: 112px;
min-height: 158px;
border-radius: 22px;
}

Expand Down
24 changes: 24 additions & 0 deletions apps/landing/src/shared/icons/brands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,29 @@ function SendGridIcon({ size, ...props }: IconSvgProps) {
);
}

function SlackIcon({ size, ...props }: IconSvgProps) {
return (
<SvgIcon {...props} defaultLabel="Slack" size={size} viewBox="0 0 128 128">
<path
d="M27.255 80.719c0 7.33-5.978 13.317-13.309 13.317C6.616 94.036.63 88.049.63 80.719s5.987-13.317 13.317-13.317h13.309zm6.709 0c0-7.33 5.987-13.317 13.317-13.317s13.317 5.986 13.317 13.317v33.335c0 7.33-5.986 13.317-13.317 13.317-7.33 0-13.317-5.987-13.317-13.317zm0 0"
fill="#de1c59"
/>
<path
d="M47.281 27.255c-7.33 0-13.317-5.978-13.317-13.309C33.964 6.616 39.951.63 47.281.63s13.317 5.987 13.317 13.317v13.309zm0 6.709c7.33 0 13.317 5.987 13.317 13.317s-5.986 13.317-13.317 13.317H13.946C6.616 60.598.63 54.612.63 47.281c0-7.33 5.987-13.317 13.317-13.317zm0 0"
fill="#35c5f0"
/>
<path
d="M100.745 47.281c0-7.33 5.978-13.317 13.309-13.317 7.33 0 13.317 5.987 13.317 13.317s-5.987 13.317-13.317 13.317h-13.309zm-6.709 0c0 7.33-5.987 13.317-13.317 13.317s-13.317-5.986-13.317-13.317V13.946C67.402 6.616 73.388.63 80.719.63c7.33 0 13.317 5.987 13.317 13.317zm0 0"
fill="#2eb57d"
/>
<path
d="M80.719 100.745c7.33 0 13.317 5.978 13.317 13.309 0 7.33-5.987 13.317-13.317 13.317s-13.317-5.987-13.317-13.317v-13.309zm0-6.709c-7.33 0-13.317-5.987-13.317-13.317s5.986-13.317 13.317-13.317h33.335c7.33 0 13.317 5.986 13.317 13.317 0 7.33-5.987 13.317-13.317 13.317zm0 0"
fill="#ebb02e"
/>
</SvgIcon>
);
}

function CloudflareD1Icon({ size, ...props }: IconSvgProps) {
return (
<SvgIcon
Expand Down Expand Up @@ -230,6 +253,7 @@ const BRAND_ICONS = {
posthog: createSimpleBrandIcon(siPosthog),
sentry: createSimpleBrandIcon(siSentry),
sendgrid: SendGridIcon,
slack: SlackIcon,
snowflake: createSimpleBrandIcon(siSnowflake),
supabase: createSimpleBrandIcon(siSupabase),
tiktok_marketing: createSimpleBrandIcon(siTiktok),
Expand Down
1 change: 1 addition & 0 deletions packages/db/src/__snapshots__/credentials.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports[`credentials schemas > credentialSchemaMap > matches supported provider
"posthog",
"sendgrid",
"sentry",
"slack",
"snowflake",
"tiktok_marketing",
"vercel",
Expand Down
73 changes: 73 additions & 0 deletions packages/db/src/credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
isLinearCredentials,
isMongoCredentials,
isOAuthCredentials,
isSlackCredentials,
isTokenExpired,
LaminarCredentialsSchema,
LinearCredentialsSchema,
Expand All @@ -38,6 +39,7 @@ import {
PostHogCredentialsSchema,
SendGridCredentialsSchema,
SentryCredentialsSchema,
SlackCredentialsSchema,
SnowflakeCredentialsSchema,
TikTokMarketingCredentialsSchema,
VercelCredentialsSchema,
Expand Down Expand Up @@ -73,6 +75,7 @@ import type {
PostHogCredentials,
SendGridCredentials,
SentryCredentials,
SlackCredentials,
SnowflakeCredentials,
TikTokMarketingCredentials,
VercelCredentials,
Expand Down Expand Up @@ -1407,6 +1410,58 @@ describe("credentials schemas", () => {
});
});

describe("SlackCredentialsSchema", () => {
it("validates canonical Slack credentials", () => {
const credentials: SlackCredentials = {
botScopes: ["channels:read", "channels:history"],
botToken: "xoxb-token",
botUserId: "U123",
teamId: "T123",
teamName: "Acme",
type: "slack",
};

const result = SlackCredentialsSchema.safeParse(credentials);
expect(result.success).toBe(true);
});

it("normalizes legacy comma-delimited scope credentials", () => {
const result = SlackCredentialsSchema.safeParse({
botToken: "xoxb-token",
botUserId: "U123",
scope: "channels:read, channels:history,",
teamId: "T123",
teamName: "Acme",
type: "slack",
});

expect(result.success).toBe(true);
if (result.success) {
expect(result.data).toEqual({
botScopes: ["channels:read", "channels:history"],
botToken: "xoxb-token",
botUserId: "U123",
teamId: "T123",
teamName: "Acme",
type: "slack",
});
}
});

it("rejects blank bot tokens", () => {
const result = SlackCredentialsSchema.safeParse({
botScopes: ["channels:read"],
botToken: " ",
botUserId: "U123",
teamId: "T123",
teamName: "Acme",
type: "slack",
});

expect(result.success).toBe(false);
});
});

describe("CalCredentialsSchema", () => {
it("defaults apiVersion to the current v2 header version", () => {
const result = CalCredentialsSchema.safeParse({
Expand Down Expand Up @@ -1857,6 +1912,10 @@ describe("credentials schemas", () => {
expect(credentialSchemaMap.discord).toBe(DiscordCredentialsSchema);
});

it("should map slack to SlackCredentialsSchema", () => {
expect(credentialSchemaMap.slack).toBe(SlackCredentialsSchema);
});

it("should map cal to CalCredentialsSchema", () => {
expect(credentialSchemaMap.cal).toBe(CalCredentialsSchema);
});
Expand Down Expand Up @@ -1953,6 +2012,20 @@ describe("credentials schemas", () => {
});
});

describe("isSlackCredentials", () => {
it("should return true for Slack credentials", () => {
const credentials: SlackCredentials = {
botScopes: ["channels:read"],
botToken: "xoxb-token",
botUserId: "U123",
teamId: "T123",
teamName: "Acme",
type: "slack",
};
expect(isSlackCredentials(credentials)).toBe(true);
});
});

describe("normalizeEnvVarName", () => {
it("matches normalized env var snapshots", () => {
expect({
Expand Down
53 changes: 53 additions & 0 deletions packages/db/src/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,51 @@ export const DiscordCredentialsSchema = z.object({

export type DiscordCredentials = z.infer<typeof DiscordCredentialsSchema>;

const parseSlackScopeList = (scope: string): string[] =>
scope
.split(",")
.map((value) => value.trim())
.filter((value) => value.length > 0);

const SlackCredentialsBaseSchema = z.object({
botToken: requiredOpaqueString("Bot token is required"),
botUserId: z.string(),
teamId: trimmedString("Team ID is required"),
teamName: z.string(),
type: z.literal("slack"),
});

const CanonicalSlackCredentialsSchema = SlackCredentialsBaseSchema.extend({
botScopes: z.array(z.string()),
});

const LegacySlackCredentialsSchema = SlackCredentialsBaseSchema.extend({
botScopes: z.array(z.string()).optional(),
scope: z.string(),
});

export const SlackCredentialsSchema = z
.union([CanonicalSlackCredentialsSchema, LegacySlackCredentialsSchema])
.transform((credentials) => {
if ("scope" in credentials) {
// Comment: Older Slack installs stored a comma-delimited `scope` string.
// Normalize on read so source-api adapters only receive `botScopes`.
return {
botScopes:
credentials.botScopes ?? parseSlackScopeList(credentials.scope),
botToken: credentials.botToken,
botUserId: credentials.botUserId,
teamId: credentials.teamId,
teamName: credentials.teamName,
type: credentials.type,
};
}

return credentials;
});

export type SlackCredentials = z.infer<typeof SlackCredentialsSchema>;

export const CalCredentialsSchema = z.object({
apiBaseUrl: optionalTrimmedUrl("API base URL must be a valid URL"),
apiKey: requiredOpaqueString("API key is required"),
Expand Down Expand Up @@ -471,6 +516,7 @@ export const CredentialsSchema = z.union([
GitHubCredentialsSchema,
AirtableCredentialsSchema,
DiscordCredentialsSchema,
SlackCredentialsSchema,
CalCredentialsSchema,
GranolaCredentialsSchema,
GoogleSearchConsoleCredentialsSchema,
Expand Down Expand Up @@ -552,6 +598,7 @@ export const credentialSchemaMap = {
posthog: PostHogCredentialsSchema,
sendgrid: SendGridCredentialsSchema,
sentry: SentryCredentialsSchema,
slack: SlackCredentialsSchema,
snowflake: SnowflakeCredentialsSchema,
tiktok_marketing: TikTokMarketingCredentialsSchema,
vercel: VercelCredentialsSchema,
Expand Down Expand Up @@ -627,6 +674,12 @@ export function isLinearCredentials(
return credentials.type === "linear";
}

export function isSlackCredentials(
credentials: Credentials
): credentials is SlackCredentials {
return credentials.type === "slack";
}

export function normalizeEnvVarName(name: string): string {
return name
.toUpperCase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`data-sources schema > matches provider type snapshots 1`] = `
"github",
"airtable",
"discord",
"slack",
"cal",
"granola",
"google_search_console",
Expand Down Expand Up @@ -55,6 +56,7 @@ exports[`data-sources schema > matches provider type snapshots 1`] = `
"github",
"airtable",
"discord",
"slack",
"cal",
"granola",
"google_search_console",
Expand Down
Loading