@startsimpli/integrations 0.2.140 → 0.2.142

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.140",
3
+ "version": "0.2.142",
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/auth": "^0.4.50",
53
+ "@startsimpli/ui": "^0.4.171",
54
54
  "@startsimpli/utils": "^0.4.17",
55
- "@startsimpli/ui": "^0.4.171"
55
+ "@startsimpli/auth": "^0.4.50"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -150,7 +150,7 @@ describe('TrackerPage — it must not loop', () => {
150
150
  render(<TrackerPage api={api} scope={SCOPE} now={NOW} />);
151
151
  await screen.findByText('Chase the inventor for comments on 2148');
152
152
  expect(calls).toBe(1);
153
- await userEvent.click(screen.getAllByRole('button', { name: 'Done' })[0]);
153
+ await userEvent.click(screen.getAllByRole('button', { name: 'Mark done' })[0]);
154
154
  await new Promise((resolve) => setTimeout(resolve, 150));
155
155
  expect(updated).toHaveLength(1);
156
156
  expect(calls).toBe(2);
@@ -646,3 +646,18 @@ describe('TrackerPage — adding a to-do', () => {
646
646
  expect(screen.queryByRole('textbox', { name: /add a to-do/i })).toBeNull();
647
647
  });
648
648
  });
649
+
650
+ describe('TrackerPage — done fold and blocked reason', () => {
651
+ it('says so when nothing has been finished', async () => {
652
+ render(<TrackerPage api={makeApi({ rows: ROWS.filter((r) => r.status !== 'done') })} scope={SCOPE} now={NOW} />);
653
+ await screen.findByText('Chase the inventor for comments on 2148');
654
+ await userEvent.click(screen.getByText('Done'));
655
+ expect(await screen.findByText(/nothing finished yet/i)).toBeInTheDocument();
656
+ });
657
+
658
+ it('shows why a blocked to-do is blocked', async () => {
659
+ const rows = [commitment({ externalId: 'commit:b1', title: 'Share the staging link', status: 'blocked', statusReason: 'Waiting on DNS' })];
660
+ render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
661
+ expect(await screen.findByText(/Waiting on DNS/)).toBeInTheDocument();
662
+ });
663
+ });
@@ -66,3 +66,39 @@ describe('TaskDetailPage', () => {
66
66
  expect(await screen.findByRole('link', { name: 'Open in Linear: ENG-7' })).toBeInTheDocument();
67
67
  });
68
68
  });
69
+
70
+ describe('TaskDetailPage — editing', () => {
71
+ it('saves a changed title, notes, owner and due date through updateCommitment', async () => {
72
+ const api = apiWith([make('a', { owner_name: 'Megan' })]);
73
+ render(<TaskDetailPage api={api} scope={scope} itemId="commit:a" />);
74
+ fireEvent.click(await screen.findByRole('button', { name: /^edit$/i }));
75
+ fireEvent.change(screen.getByLabelText('Title'), { target: { value: 'Renamed task' } });
76
+ fireEvent.change(screen.getByLabelText('Notes'), { target: { value: 'More detail' } });
77
+ fireEvent.change(screen.getByLabelText('Owner'), { target: { value: 'Rae' } });
78
+ fireEvent.change(screen.getByLabelText('Due date'), { target: { value: '2026-12-01' } });
79
+ fireEvent.click(screen.getByRole('button', { name: /^save$/i }));
80
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(
81
+ expect.objectContaining({ externalId: 'commit:a' }),
82
+ expect.objectContaining({ title: 'Renamed task', detail: 'More detail', ownerName: 'Rae', dueAt: expect.stringMatching(/^2026-12-01/) }),
83
+ ));
84
+ expect(await screen.findByRole('heading', { name: 'Renamed task' })).toBeInTheDocument();
85
+ });
86
+
87
+ it('refuses an empty title', async () => {
88
+ const api = apiWith([make('a')]);
89
+ render(<TaskDetailPage api={api} scope={scope} itemId="commit:a" />);
90
+ fireEvent.click(await screen.findByRole('button', { name: /^edit$/i }));
91
+ fireEvent.change(screen.getByLabelText('Title'), { target: { value: ' ' } });
92
+ expect(screen.getByRole('button', { name: /^save$/i })).toBeDisabled();
93
+ });
94
+
95
+ it('cancel discards the edit', async () => {
96
+ const api = apiWith([make('a')]);
97
+ render(<TaskDetailPage api={api} scope={scope} itemId="commit:a" />);
98
+ fireEvent.click(await screen.findByRole('button', { name: /^edit$/i }));
99
+ fireEvent.change(screen.getByLabelText('Title'), { target: { value: 'x' } });
100
+ fireEvent.click(screen.getByRole('button', { name: /cancel/i }));
101
+ expect(screen.getByRole('heading', { name: 'Task a' })).toBeInTheDocument();
102
+ expect(api.updateCommitment).not.toHaveBeenCalled();
103
+ });
104
+ });
@@ -78,6 +78,8 @@ export function TaskDetailPage({
78
78
  const [loading, setLoading] = React.useState(true);
79
79
  const [error, setError] = React.useState('');
80
80
  const [busy, setBusy] = React.useState(false);
81
+ const [editing, setEditing] = React.useState(false);
82
+ const [form, setForm] = React.useState({ title: '', detail: '', owner: '', due: '' });
81
83
 
82
84
  React.useEffect(() => {
83
85
  let live = true;
@@ -107,6 +109,36 @@ export function TaskDetailPage({
107
109
  }
108
110
  };
109
111
 
112
+ const startEdit = () => {
113
+ if (!item) return;
114
+ setForm({
115
+ title: item.title, detail: item.detail ?? '', owner: item.ownerName ?? '',
116
+ due: item.dueAt ? item.dueAt.slice(0, 10) : '',
117
+ });
118
+ setEditing(true);
119
+ };
120
+
121
+ const save = async () => {
122
+ if (!item || !apiRef.current.updateCommitment || !form.title.trim()) return;
123
+ setBusy(true);
124
+ setError('');
125
+ try {
126
+ const patch = {
127
+ title: form.title.trim(),
128
+ detail: form.detail,
129
+ ownerName: form.owner.trim() || undefined,
130
+ dueAt: form.due ? `${form.due}T00:00:00Z` : null,
131
+ };
132
+ const updated = await apiRef.current.updateCommitment(item, patch);
133
+ setItem({ ...item, ...patch, ...updated });
134
+ setEditing(false);
135
+ } catch (err) {
136
+ setError(failureMessage(err));
137
+ } finally {
138
+ setBusy(false);
139
+ }
140
+ };
141
+
110
142
  const back = onBack ? (
111
143
  <button type="button" className="text-sm text-blue-700 underline" onClick={onBack}>← Back to Tracker</button>
112
144
  ) : null;
@@ -140,6 +172,28 @@ export function TaskDetailPage({
140
172
  {project ? <span className={cn.badge}>{project}</span> : null}
141
173
  {item.sync ? <ExternalLinkChip sync={item.sync} trackerName={trackerName} className={cn.badge} /> : null}
142
174
  </div>
175
+ {editing ? (
176
+ <form className="mt-3 space-y-3" onSubmit={(e) => { e.preventDefault(); void save(); }}>
177
+ <label className="block text-sm">Title
178
+ <input className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-1.5 text-sm" value={form.title} onChange={(e) => setForm({ ...form, title: e.target.value })} />
179
+ </label>
180
+ <label className="block text-sm">Notes
181
+ <textarea className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-1.5 text-sm" rows={3} value={form.detail} onChange={(e) => setForm({ ...form, detail: e.target.value })} />
182
+ </label>
183
+ <div className="flex flex-wrap gap-3">
184
+ <label className="block text-sm">Owner
185
+ <input className="mt-1 block rounded-md border border-gray-300 px-3 py-1.5 text-sm" value={form.owner} onChange={(e) => setForm({ ...form, owner: e.target.value })} />
186
+ </label>
187
+ <label className="block text-sm">Due date
188
+ <input type="date" className="mt-1 block rounded-md border border-gray-300 px-3 py-1.5 text-sm" value={form.due} onChange={(e) => setForm({ ...form, due: e.target.value })} />
189
+ </label>
190
+ </div>
191
+ <div className="flex gap-2">
192
+ <button type="submit" className={cn.button} disabled={busy || !form.title.trim()}>Save</button>
193
+ <button type="button" className={cn.secondaryButton} disabled={busy} onClick={() => setEditing(false)}>Cancel</button>
194
+ </div>
195
+ </form>
196
+ ) : (<>
143
197
  <h1 className={`mt-2 ${cn.heading}`}>{item.title}</h1>
144
198
 
145
199
  <dl className="mt-3 grid grid-cols-[7rem_1fr] gap-y-1 text-sm">
@@ -159,8 +213,11 @@ export function TaskDetailPage({
159
213
  <p className="mt-3 text-sm text-gray-600">{item.status === 'done' ? 'Closed by' : 'Blocked by'}: “{item.statusReason}”</p>
160
214
  ) : null}
161
215
 
162
- {canWrite ? (
216
+ </>)}
217
+
218
+ {canWrite && !editing ? (
163
219
  <div className="mt-4 flex flex-wrap gap-2">
220
+ <button type="button" className={cn.secondaryButton} disabled={busy} onClick={startEdit}>Edit</button>
164
221
  {closed ? (
165
222
  <button type="button" className={cn.secondaryButton} disabled={busy} onClick={() => void setStatus('open')}>Reopen</button>
166
223
  ) : (
@@ -483,7 +483,7 @@ export function TrackerPage({
483
483
  </h2>
484
484
  <ul>
485
485
  {groups[key].map((entry) => rowFor(entry, canWrite ? {
486
- actions: <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'done' })}>Done</button>,
486
+ actions: <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'done' })}>Mark done</button>,
487
487
  } : undefined))}
488
488
  </ul>
489
489
  </section>
@@ -538,7 +538,7 @@ export function TrackerPage({
538
538
  >
539
539
  <summary className={foldSummary}>Done{doneRows ? ` (${doneGroups.length})` : ''}</summary>
540
540
  <ul className="px-4 pb-3">
541
- {doneRows === null ? <li className={cn.muted}>Loading…</li> : doneGroups.map((entry) => rowFor(entry))}
541
+ {doneRows === null ? <li className={cn.muted}>Loading…</li> : doneGroups.length === 0 ? <li className={cn.muted}>Nothing finished yet.</li> : doneGroups.map((entry) => rowFor(entry))}
542
542
  </ul>
543
543
  </details>
544
544
  </div>
@@ -48,10 +48,13 @@ export function CompactItemRow({ item, days, due, project, trackerName, onOpen,
48
48
  {item.title}
49
49
  </button>
50
50
  ) : <span className="block truncate text-sm font-medium text-gray-900">{item.title}</span>}
51
+ {item.status === 'blocked' && item.statusReason ? (
52
+ <span className="block truncate text-xs text-gray-500">Blocked: {item.statusReason}</span>
53
+ ) : null}
51
54
  </div>
52
55
  <div className="flex shrink-0 items-center gap-2">
53
56
  {project ? <span className={CHIP} title={project}>{project}</span> : null}
54
- {showStatus && item.status !== 'open' && item.status !== 'done' ? <span className={CHIP}>{item.status.replace('_', ' ')}</span> : null}
57
+ {showStatus && item.status !== 'open' && item.status !== 'done' ? <span className={CHIP} title={item.statusReason || undefined}>{item.status.replace('_', ' ')}</span> : null}
55
58
  {item.sync ? <ExternalLinkChip sync={item.sync} trackerName={trackerName} className={CHIP} /> : null}
56
59
  {label ? <span className={`w-16 text-right text-xs ${late ? 'font-semibold text-red-700' : 'text-gray-500'}`}>{label}</span> : null}
57
60
  {actions}