@startsimpli/integrations 0.2.195 → 0.2.196
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 +3 -3
- package/src/__tests__/load-error.test.tsx +46 -0
- package/src/components/LoadError.tsx +21 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/ConnectionsPage.tsx +3 -1
- package/src/components/pages/DecisionsPage.tsx +3 -1
- package/src/components/pages/LibraryPage.tsx +5 -2
- package/src/components/pages/TrackerPage.tsx +10 -2
- package/src/components/pages/overview/OverviewPage.tsx +4 -2
- package/src/components/pages/tracker/TrackerTimeline.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startsimpli/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.196",
|
|
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,8 +50,8 @@
|
|
|
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.190",
|
|
53
54
|
"@startsimpli/auth": "^0.4.53",
|
|
54
|
-
"@startsimpli/ui": "^0.4.189",
|
|
55
55
|
"@startsimpli/utils": "^0.4.20"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"react-native": "0.85.3",
|
|
100
100
|
"react-native-safe-area-context": "~5.7.0",
|
|
101
101
|
"@startsimpli/llm": "0.4.31",
|
|
102
|
-
"@startsimpli/ui": "0.4.
|
|
102
|
+
"@startsimpli/ui": "0.4.190",
|
|
103
103
|
"@startsimpli/ui-native": "0.1.15",
|
|
104
104
|
"@startsimpli/auth": "0.4.53",
|
|
105
105
|
"@startsimpli/utils": "0.4.20"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { LoadError } from '../components/LoadError';
|
|
5
|
+
import { OverviewPage } from '../components/pages/overview/OverviewPage';
|
|
6
|
+
|
|
7
|
+
describe('LoadError', () => {
|
|
8
|
+
it('says what failed in a sentence, keeps the server words, and Try again calls back', () => {
|
|
9
|
+
let tries = 0;
|
|
10
|
+
render(<LoadError what="the thing" message="simulated outage" onRetry={() => { tries += 1; }} />);
|
|
11
|
+
expect(screen.getByRole('alert').textContent).toContain('Could not load the thing.');
|
|
12
|
+
expect(screen.getByRole('alert').textContent).toContain('simulated outage');
|
|
13
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
14
|
+
expect(tries).toBe(1);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('OverviewPage failing then recovering', () => {
|
|
19
|
+
it('shows a retryable error, and Try again loads the page', async () => {
|
|
20
|
+
let calls = 0;
|
|
21
|
+
const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
|
|
22
|
+
const api = {
|
|
23
|
+
listFocuses: async () => { calls += 1; if (calls === 1) throw new Error('simulated outage'); return page([{ id: 'f1', title: 'Alpha', status: 'active' }]); },
|
|
24
|
+
listCommitments: async () => page([{ id: '1', externalId: 'c1', title: 'task', status: 'open', ownerName: 'Sam', focusId: 'f1', mentions: [], dueAt: null, lastSeenAt: null }]),
|
|
25
|
+
} as never;
|
|
26
|
+
render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
|
|
27
|
+
await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
|
|
28
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
29
|
+
await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
import { TrackerPage } from '../components/pages/TrackerPage';
|
|
34
|
+
|
|
35
|
+
describe('TrackerPage when the load fails', () => {
|
|
36
|
+
it('shows a retryable error and no 0-owed counts, then loads on Try again', async () => {
|
|
37
|
+
let calls = 0;
|
|
38
|
+
const page = { count: 0, next: null, previous: null, results: [] as never[] };
|
|
39
|
+
const api = { listCommitments: async () => { calls += 1; if (calls <= 1) throw new Error('simulated outage'); return page; } } as never;
|
|
40
|
+
render(<TrackerPage api={api} scope={{} as never} classNames={{} as never} />);
|
|
41
|
+
await waitFor(() => expect(screen.getByTestId('load-error')).toBeTruthy());
|
|
42
|
+
expect(screen.getByTestId('tracker-summary').textContent).toBe('');
|
|
43
|
+
fireEvent.click(screen.getByRole('button', { name: 'Try again' }));
|
|
44
|
+
await waitFor(() => expect(screen.queryByTestId('load-error')).toBeNull());
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A load failure that says what happened in a sentence and offers Try again. The server's own words stay visible
|
|
7
|
+
* underneath (they are the useful part for whoever has to fix it), but they are never the whole message.
|
|
8
|
+
*/
|
|
9
|
+
export function LoadError({ message, onRetry, what = 'this' }: { message: string; onRetry?: () => void; what?: string }) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="rounded-xl border border-red-200 bg-red-50 p-4 text-sm" role="alert" data-testid="load-error">
|
|
12
|
+
<p className="font-medium text-red-900">Could not load {what}.</p>
|
|
13
|
+
{message ? <p className="mt-1 text-red-800">{message}</p> : null}
|
|
14
|
+
{onRetry ? (
|
|
15
|
+
<button type="button" onClick={onRetry} className="mt-3 rounded-md border border-red-300 bg-white px-3 py-1.5 font-medium text-red-900 hover:bg-red-100">
|
|
16
|
+
Try again
|
|
17
|
+
</button>
|
|
18
|
+
) : null}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import * as React from 'react';
|
|
36
36
|
|
|
37
|
+
import { LoadError } from '../LoadError';
|
|
38
|
+
|
|
37
39
|
import type { Connection, ConnectionPermissions, ConnectorCatalogEntry } from './types';
|
|
38
40
|
import { MemberConnectionRoster } from './MemberConnectionRoster';
|
|
39
41
|
import { connectableEntries } from './connectable-entries';
|
|
@@ -91,7 +93,7 @@ export function ConnectionsPage(props: ConnectionsPageProps) {
|
|
|
91
93
|
React.useEffect(() => { void reload(); }, [reload]);
|
|
92
94
|
|
|
93
95
|
if (loadError) {
|
|
94
|
-
return <
|
|
96
|
+
return <LoadError what="your connections" message={loadError} onRetry={() => { setLoadError(''); void reload(); }} />;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
return (
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
|
|
8
|
+
import { LoadError } from '../LoadError';
|
|
9
|
+
|
|
8
10
|
import type { NotifyClient } from '../../corpus/notify/client';
|
|
9
11
|
import type { DecisionIndexRow, DecisionRecord } from '../../corpus/notify/types';
|
|
10
12
|
|
|
@@ -61,7 +63,7 @@ export function DecisionsPage({ client, classNames, focus }: DecisionsPageProps)
|
|
|
61
63
|
const ordered = (rows ?? []).slice().sort((a, b) => Number(b.id === focus) - Number(a.id === focus));
|
|
62
64
|
return (
|
|
63
65
|
<div className={cx('root')}>
|
|
64
|
-
{error ? <
|
|
66
|
+
{error ? <LoadError what="your decisions" message={error} onRetry={() => { setError(null); load(); }} /> : null}
|
|
65
67
|
{rows && !rows.length ? (
|
|
66
68
|
<div className="rounded-xl border border-gray-200 bg-white p-6 text-center" data-testid="decisions-empty">
|
|
67
69
|
<p className="font-medium text-gray-900">Nothing is waiting on you.</p>
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import * as React from 'react';
|
|
29
29
|
|
|
30
|
+
import { LoadError } from '../LoadError';
|
|
31
|
+
|
|
30
32
|
import { DocumentDetail } from '../DocumentDetail';
|
|
31
33
|
import { formatDate, summaryOf } from '../documentText';
|
|
32
34
|
import { FolderTree, folderTrail } from '../FolderTree';
|
|
@@ -192,6 +194,7 @@ export function LibraryPage({
|
|
|
192
194
|
const [selectError, setSelectError] = React.useState('');
|
|
193
195
|
const [loading, setLoading] = React.useState(true);
|
|
194
196
|
const [loadError, setLoadError] = React.useState('');
|
|
197
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
195
198
|
/**
|
|
196
199
|
* LATCHED, not per-page. "The data API returned another workspace's rows" is a
|
|
197
200
|
* fact about the API, and paging forward past the offending page must not make
|
|
@@ -256,7 +259,7 @@ export function LibraryPage({
|
|
|
256
259
|
}
|
|
257
260
|
})();
|
|
258
261
|
return () => { live = false; };
|
|
259
|
-
}, [api, query, scope]);
|
|
262
|
+
}, [api, query, scope, attempt]);
|
|
260
263
|
|
|
261
264
|
React.useEffect(() => {
|
|
262
265
|
if (!selectedId) { setSelected(null); setSelectError(''); return; }
|
|
@@ -345,7 +348,7 @@ export function LibraryPage({
|
|
|
345
348
|
const hasFilters = Boolean(filters.source || filters.partyId || filters.occurredAfter || filters.occurredBefore);
|
|
346
349
|
|
|
347
350
|
if (loadError) {
|
|
348
|
-
return <
|
|
351
|
+
return <LoadError what="the library" message={loadError} onRetry={() => { setLoadError(''); setAttempt((n) => n + 1); }} />;
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
return (
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import * as React from 'react';
|
|
28
28
|
|
|
29
|
+
import { LoadError } from '../LoadError';
|
|
30
|
+
|
|
29
31
|
import { isStalled, runProgress } from '../../corpus/runs';
|
|
30
32
|
import { isOverdue } from '../../corpus/work-item-logic';
|
|
31
33
|
import { useTrackerName } from '../../task-tracker/useTrackerName';
|
|
@@ -181,6 +183,8 @@ export function TrackerPage({
|
|
|
181
183
|
const [applied, setApplied] = React.useState<string[]>([]);
|
|
182
184
|
const [loading, setLoading] = React.useState(true);
|
|
183
185
|
const [error, setError] = React.useState('');
|
|
186
|
+
// a failed LOAD (offer Try again, hide the counts) is different from a failed action on one row (keep the plain message)
|
|
187
|
+
const [loadFailed, setLoadFailed] = React.useState(false);
|
|
184
188
|
const [running, setRunning] = React.useState(false);
|
|
185
189
|
/**
|
|
186
190
|
* The SWEEP, when this deployment runs extraction as a job
|
|
@@ -214,6 +218,8 @@ export function TrackerPage({
|
|
|
214
218
|
const load = React.useCallback(async () => {
|
|
215
219
|
setLoading(true);
|
|
216
220
|
setError('');
|
|
221
|
+
setLoadFailed(false);
|
|
222
|
+
setLoadFailed(false);
|
|
217
223
|
try {
|
|
218
224
|
const page = await apiRef.current.listCommitments(query);
|
|
219
225
|
setRows(page.results);
|
|
@@ -232,6 +238,8 @@ export function TrackerPage({
|
|
|
232
238
|
} catch (err) {
|
|
233
239
|
setRows([]);
|
|
234
240
|
setError(failureMessage(err));
|
|
241
|
+
setLoadFailed(true);
|
|
242
|
+
setLoadFailed(true);
|
|
235
243
|
} finally {
|
|
236
244
|
setLoading(false);
|
|
237
245
|
}
|
|
@@ -499,7 +507,7 @@ export function TrackerPage({
|
|
|
499
507
|
) : null}
|
|
500
508
|
<div className="flex flex-wrap items-center gap-3">
|
|
501
509
|
<p className={cn.muted} data-testid="tracker-summary">
|
|
502
|
-
{loading ? 'Loading…' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
|
|
510
|
+
{loading ? 'Loading…' : loadFailed ? '' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
|
|
503
511
|
</p>
|
|
504
512
|
<div className="ml-auto">
|
|
505
513
|
{canQueue ? (
|
|
@@ -560,7 +568,7 @@ export function TrackerPage({
|
|
|
560
568
|
<p className={`mt-2 ${cn.warning}`} role="status">{unfilteredMessage(['status'] as const, applied, query)}</p>
|
|
561
569
|
</details>
|
|
562
570
|
) : null}
|
|
563
|
-
{error ? <p className={cn.error} role="alert">{error}</p> : null}
|
|
571
|
+
{error ? (loadFailed ? <LoadError what="your to-dos" message={error} onRetry={() => void load()} /> : <p className={cn.error} role="alert">{error}</p>) : null}
|
|
564
572
|
{sweep ? <SweepPanel sweep={sweep} now={clock} classNames={cn} /> : null}
|
|
565
573
|
|
|
566
574
|
{!loading && owed === 0 && c.stale === 0 && !filtering ? (
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
|
+
import { LoadError } from '../../LoadError';
|
|
10
11
|
import { buildOverview, NO_PROJECT, type OverviewRow } from '../../../corpus/overview';
|
|
11
12
|
import type { Commitment, CorpusScope, Focus, PlanningApi } from '../../../corpus/types';
|
|
12
13
|
|
|
@@ -45,6 +46,7 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
45
46
|
const [error, setError] = React.useState('');
|
|
46
47
|
const [who, setWho] = React.useState<string | null>(null);
|
|
47
48
|
const [sort, setSort] = React.useState<{ key: SortKey; dir: 1 | -1 } | null>(null);
|
|
49
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
48
50
|
|
|
49
51
|
React.useEffect(() => {
|
|
50
52
|
let live = true;
|
|
@@ -59,10 +61,10 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
59
61
|
return () => {
|
|
60
62
|
live = false;
|
|
61
63
|
};
|
|
62
|
-
}, [api, scope]);
|
|
64
|
+
}, [api, scope, attempt]);
|
|
63
65
|
|
|
64
66
|
const overview = React.useMemo(() => (data ? buildOverview(data.focuses, data.items, { meNames, now }) : null), [data, meNames, now]);
|
|
65
|
-
if (error) return <
|
|
67
|
+
if (error) return <LoadError what="the overview" message={error} onRetry={() => setAttempt((n) => n + 1)} />;
|
|
66
68
|
if (!overview) return <p className="text-sm text-gray-500">Loading…</p>;
|
|
67
69
|
if (!overview.rows.length) return <p className="text-sm text-gray-500">Nothing in flight yet. Projects and their open to-dos show up here as they are connected or planned.</p>;
|
|
68
70
|
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* or render would be a second.
|
|
12
12
|
*/
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
|
|
15
|
+
import { LoadError } from '../../LoadError';
|
|
14
16
|
import { DEFAULT_RANGES, RangeEventTable, RangeSelector, RangeTimelineChart } from '@startsimpli/ui/insights';
|
|
15
17
|
|
|
16
18
|
import { buildTimeline, anchorOf, type TimelineFilter } from '../../../corpus/tracker-timeline';
|
|
@@ -61,6 +63,7 @@ export function TrackerTimeline({
|
|
|
61
63
|
owner: filter.owner ?? '', search: debouncedSearch,
|
|
62
64
|
});
|
|
63
65
|
const anchor = anchorOf(now, timeZone);
|
|
66
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
64
67
|
|
|
65
68
|
React.useEffect(() => {
|
|
66
69
|
let live = true;
|
|
@@ -77,14 +80,14 @@ export function TrackerTimeline({
|
|
|
77
80
|
return () => { live = false; };
|
|
78
81
|
// `now` is the page's frozen clock; the anchor day stands in for it.
|
|
79
82
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
80
|
-
}, [orgId, filterKey, anchor, timeZone]);
|
|
83
|
+
}, [orgId, filterKey, anchor, timeZone, attempt]);
|
|
81
84
|
|
|
82
85
|
const built = React.useMemo(() => (read ? buildTimeline(read, now, timeZone) : null), [read, now, timeZone]);
|
|
83
86
|
|
|
84
87
|
return (
|
|
85
88
|
<section className={className ?? 'space-y-4'} aria-label="Tracker timeline" data-testid="tracker-timeline">
|
|
86
89
|
{heading ? <h2 className="text-lg font-semibold text-gray-900">Timeline</h2> : null}
|
|
87
|
-
{error ? <
|
|
90
|
+
{error ? <LoadError what="the timeline" message={error} onRetry={() => setAttempt((n) => n + 1)} /> : null}
|
|
88
91
|
{loading && !built ? <p className="text-sm text-gray-500">Loading the timeline…</p> : null}
|
|
89
92
|
{built ? (
|
|
90
93
|
<>
|