@startsimpli/integrations 0.2.131 → 0.2.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.131",
3
+ "version": "0.2.132",
4
4
  "description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://startsimpli.com",
@@ -50,9 +50,9 @@
50
50
  "react-native": ">=0.74.0",
51
51
  "@startsimpli/ui-native": ">=0.1.12",
52
52
  "react-native-safe-area-context": ">=4.0.0",
53
- "@startsimpli/ui": "^0.4.171",
54
53
  "@startsimpli/auth": "^0.4.50",
55
- "@startsimpli/utils": "^0.4.17"
54
+ "@startsimpli/utils": "^0.4.17",
55
+ "@startsimpli/ui": "^0.4.171"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -98,7 +98,7 @@
98
98
  "vitest": "^3.0.0",
99
99
  "react-native": "0.85.3",
100
100
  "react-native-safe-area-context": "~5.7.0",
101
- "@startsimpli/llm": "0.4.30",
101
+ "@startsimpli/llm": "0.4.31",
102
102
  "@startsimpli/ui": "0.4.171",
103
103
  "@startsimpli/ui-native": "0.1.14",
104
104
  "@startsimpli/auth": "0.4.50",
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { describe, expect, it, vi } from 'vitest';
4
+
5
+ import { ConnectionsPage } from '../components/pages/ConnectionsPage';
6
+ import { connectableEntries } from '../components/pages/connectable-entries';
7
+
8
+ const row = (key: string, name: string) => ({
9
+ key, name, description: `${name} desc`, logo_url: '', docs_url: '',
10
+ capabilities: ['poll'], auth_mode: 'api_key',
11
+ credential_schema: { version: 1, fields: [] }, config_schema: { version: 1, fields: [] },
12
+ record_types: [], supports_webhooks: false, availability: { available: true, reason: '' },
13
+ });
14
+ const conn = (key: string, status = 'connected') => ({
15
+ id: `id-${key}`, public_id: `p-${key}`, name: `My ${key}`, connector_key: key,
16
+ connector_name: key, external_account_id: '', account_label: '',
17
+ capabilities_enabled: ['poll'], config: {}, status, health: 'ok', auth_mode: 'api_key',
18
+ });
19
+
20
+ describe('connectableEntries', () => {
21
+ const catalog = [row('dropbox', 'Dropbox'), row('linear', 'Linear'), row('fathom', 'Fathom')] as never[];
22
+ it('drops providers with a live connection', () => {
23
+ const out = connectableEntries(catalog, [conn('dropbox'), conn('fathom', 'needs_reauth')] as never[]);
24
+ expect(out.map((e) => e.key)).toEqual(['linear']);
25
+ });
26
+ it('keeps a provider whose only card is disabled, so it can be reconnected', () => {
27
+ const out = connectableEntries(catalog, [conn('dropbox', 'disabled')] as never[]);
28
+ expect(out.map((e) => e.key)).toContain('dropbox');
29
+ });
30
+ });
31
+
32
+ describe('personal ConnectionsPage', () => {
33
+ it('does not list an already-connected provider under Connect your own account', async () => {
34
+ const api = {
35
+ connectorCatalog: vi.fn().mockResolvedValue({ results: [row('dropbox', 'Dropbox'), row('linear', 'Linear')] }),
36
+ connections: vi.fn().mockResolvedValue({
37
+ results: [conn('dropbox')], permissions: { view: true, manage: false, issue_tokens: false },
38
+ }),
39
+ } as never;
40
+ render(<ConnectionsPage mode="personal" api={api} />);
41
+ await screen.findByText('My dropbox');
42
+ expect(await screen.findByText('Linear')).toBeInTheDocument();
43
+ expect(screen.queryByText('Dropbox')).toBeNull();
44
+ });
45
+ });
@@ -885,7 +885,11 @@ describe('ConnectionsPage — personal mode speaks to the member surface', () =>
885
885
  // The foundry-wide catalog holds n8n. The member catalog does not. If this
886
886
  // page ever merges the two, or filters a full list in the browser, the
887
887
  // vendor the foundry deliberately withheld ships in the bundle anyway.
888
- render(<ConnectionsPage mode="personal" api={stubMemberApi()} />);
888
+ // Granola is already connected (MY_CONNECTIONS), so it is the connected
889
+ // card that shows, not a second connect card; n8n is simply absent.
890
+ render(<ConnectionsPage mode="personal" api={stubMemberApi({
891
+ connections: vi.fn().mockResolvedValue({ ...MY_CONNECTIONS, results: [] }),
892
+ })} />);
889
893
  expect(await screen.findByText('Granola')).toBeInTheDocument();
890
894
  expect(screen.queryByText('n8n')).toBeNull();
891
895
  });
@@ -58,6 +58,7 @@ import type {
58
58
  } from './types';
59
59
  import { MemberConnectionRoster } from './MemberConnectionRoster';
60
60
  import { TaskTrackerSettings } from './task-tracker/TaskTrackerSettings';
61
+ import { connectableEntries } from './connectable-entries';
61
62
  import { isTaskTracker } from '../../task-tracker/sync-config';
62
63
 
63
64
  type ClassNames = Partial<Record<
@@ -397,7 +398,7 @@ export function ConnectionsPage(props: ConnectionsPageProps) {
397
398
  decides which ones you may connect your own account on.
398
399
  </p>
399
400
  ) : null}
400
- {catalog.map((entry) => (
401
+ {(personal ? connectableEntries(catalog, connections) : catalog).map((entry) => (
401
402
  <CatalogCard
402
403
  key={entry.key}
403
404
  api={api}
@@ -0,0 +1,19 @@
1
+ import type { Connection, ConnectorCatalogEntry } from './types';
2
+
3
+ /**
4
+ * The catalog rows to offer under "Connect your own account".
5
+ *
6
+ * A provider the member already has a live account on is not offered again:
7
+ * the connected card above it is where they manage that account. A
8
+ * `disabled` card (disconnected, kept as a record) does not count, or the
9
+ * member could never reconnect.
10
+ */
11
+ export function connectableEntries(
12
+ catalog: ConnectorCatalogEntry[],
13
+ connections: Connection[],
14
+ ): ConnectorCatalogEntry[] {
15
+ const taken = new Set(
16
+ connections.filter((c) => c.status !== 'disabled').map((c) => c.connector_key),
17
+ );
18
+ return catalog.filter((entry) => !taken.has(entry.key));
19
+ }