@startsimpli/integrations 0.2.220 → 0.2.221
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.
|
|
3
|
+
"version": "0.2.221",
|
|
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/
|
|
53
|
+
"@startsimpli/ui": "^0.4.208",
|
|
54
54
|
"@startsimpli/auth": "^0.4.62",
|
|
55
|
-
"@startsimpli/
|
|
55
|
+
"@startsimpli/utils": "^0.4.21"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { dueCell } from '../components/table/todo-model';
|
|
3
|
+
import { resolveStatedDate } from '../corpus/stated-date';
|
|
4
|
+
|
|
5
|
+
const DAY = 86_400_000;
|
|
6
|
+
const NOW = Date.parse('2026-11-27T15:00:00Z');
|
|
7
|
+
const CALL = '2026-11-25T17:00:00Z'; // the call, two days ago
|
|
8
|
+
|
|
9
|
+
describe('a suggested to-do is never "late"', () => {
|
|
10
|
+
it('shows the date, not N days late, and no overdue tone', () => {
|
|
11
|
+
const cell = dueCell({ dueAt: new Date(NOW - 26 * DAY).toISOString(), status: 'suggested' }, NOW, 'UTC');
|
|
12
|
+
expect(cell.text).not.toMatch(/late/);
|
|
13
|
+
expect(cell.tone).toBe('plain');
|
|
14
|
+
});
|
|
15
|
+
it('an unknown due date stays empty', () => {
|
|
16
|
+
expect(dueCell({ dueAt: null, status: 'suggested' }, NOW, 'UTC')).toMatchObject({ text: '–', tone: 'none' });
|
|
17
|
+
});
|
|
18
|
+
it('an accepted open to-do still says how late', () => {
|
|
19
|
+
expect(dueCell({ dueAt: new Date(NOW - 3 * DAY).toISOString(), status: 'open' }, NOW, 'UTC')).toMatchObject({ text: '3 days late', tone: 'overdue' });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('relative phrases resolve from the call date (Wed 2026-11-25), not today', () => {
|
|
24
|
+
const day = (t: string) => resolveStatedDate(t, CALL)?.date ?? null;
|
|
25
|
+
it('today / tomorrow / weekday / in N days', () => {
|
|
26
|
+
expect(day('send it today')).toBe('2026-11-25');
|
|
27
|
+
expect(day('send it tomorrow')).toBe('2026-11-26');
|
|
28
|
+
expect(day('send it by Sunday')).toBe('2026-11-29');
|
|
29
|
+
expect(day('review it in 3 days')).toBe('2026-11-28');
|
|
30
|
+
});
|
|
31
|
+
it('absolute dates keep year logic', () => {
|
|
32
|
+
expect(day('due by Nov 24')).toBe('2026-11-24'); // said as a deadline, so kept even though it is before the call
|
|
33
|
+
expect(day('due by 2027-01-05')).toBe('2027-01-05');
|
|
34
|
+
});
|
|
35
|
+
it('unknown / vague stays empty', () => {
|
|
36
|
+
expect(day('sometime next week')).toBeNull();
|
|
37
|
+
expect(day('we should follow up')).toBeNull();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
import { isOverdue } from '../corpus/work-item-logic';
|
|
42
|
+
import { dueLabel } from '../components/pages/home/CompactItemRow';
|
|
43
|
+
describe('other "late" surfaces', () => {
|
|
44
|
+
it('a suggestion is never overdue', () => {
|
|
45
|
+
expect(isOverdue({ dueAt: new Date(NOW - 5 * DAY).toISOString(), status: 'suggested' }, NOW)).toBe(false);
|
|
46
|
+
expect(isOverdue({ dueAt: new Date(NOW - 5 * DAY).toISOString(), status: 'open' }, NOW)).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
it('compact row label for a suggestion is a date', () => {
|
|
49
|
+
expect(dueLabel(-26, '2026-11-01', 'suggested')).toBe('Nov 1');
|
|
50
|
+
expect(dueLabel(-2, '2026-11-25', 'open')).toBe('2d late');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('a date before the call is history, not a deadline', () => {
|
|
55
|
+
const day = (t: string) => resolveStatedDate(t, CALL)?.date ?? null;
|
|
56
|
+
it('absolute dates earlier than the call day stay empty', () => {
|
|
57
|
+
expect(day('Follow up on the invoice we sent Oct 31')).toBeNull();
|
|
58
|
+
expect(day('Review the 2026-09-18 draft')).toBeNull();
|
|
59
|
+
});
|
|
60
|
+
it('a past date said as a deadline is kept (it really is overdue)', () => {
|
|
61
|
+
expect(day('signed by 29th Oct')).toBe('2026-10-29');
|
|
62
|
+
});
|
|
63
|
+
it('the call day itself and later dates still resolve', () => {
|
|
64
|
+
expect(day('finish it by Nov 25')).toBe('2026-11-25');
|
|
65
|
+
expect(day('finish it by Dec 3')).toBe('2026-12-03');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -12,8 +12,9 @@ import { ExternalLinkChip } from '../task-tracker/ExternalLinkChip';
|
|
|
12
12
|
import type { Commitment } from '../../../corpus/types';
|
|
13
13
|
|
|
14
14
|
/** "2d late", "today", "tomorrow", "in 3d", else a short date. */
|
|
15
|
-
export function dueLabel(days: number | null, due: string | null): string {
|
|
15
|
+
export function dueLabel(days: number | null, due: string | null, status?: string): string {
|
|
16
16
|
if (days === null || !due) return '';
|
|
17
|
+
if (days < 0 && status === 'suggested') return new Date(`${due}T00:00:00Z`).toLocaleDateString(undefined, { month: 'short', day: 'numeric', timeZone: 'UTC' });
|
|
17
18
|
if (days < 0) return `${-days}d late`;
|
|
18
19
|
if (days === 0) return 'today';
|
|
19
20
|
if (days === 1) return 'tomorrow';
|
|
@@ -56,8 +57,8 @@ function MeetingEvidence({ item }: { item: Commitment }) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export function CompactItemRow({ item, days, due, project, trackerName, onOpen, actions, showStatus = true, guessedDue, below }: CompactItemRowProps) {
|
|
59
|
-
const late = days !== null && days < 0 && item.status !== 'done';
|
|
60
|
-
const label = dueLabel(days, due);
|
|
60
|
+
const late = days !== null && days < 0 && item.status !== 'done' && item.status !== 'suggested';
|
|
61
|
+
const label = dueLabel(days, due, item.status);
|
|
61
62
|
return (
|
|
62
63
|
<li className="flex items-center gap-3 border-b border-gray-100 py-2 last:border-b-0" data-testid="item-row">
|
|
63
64
|
<div className="min-w-0 flex-1">
|
|
@@ -36,7 +36,10 @@ export function dueCell(item: Pick<Commitment, 'dueAt' | 'status'>, now: number,
|
|
|
36
36
|
if (!day) return { text: '–', tone: 'none' };
|
|
37
37
|
const days = daysBetween(localDate(now, timeZone), day);
|
|
38
38
|
const finished = item.status === 'done' || item.status === 'dropped';
|
|
39
|
+
// A suggestion is the engine's guess, not a commitment: it is never "late", only dated.
|
|
40
|
+
const suggested = item.status === 'suggested';
|
|
39
41
|
const date = new Date(`${day}T00:00:00Z`).toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });
|
|
42
|
+
if (suggested) return { text: date, tone: 'plain', exact: day };
|
|
40
43
|
if (days < 0) return { text: finished ? date : `${plural(-days, 'day')} late`, tone: finished ? 'plain' : 'overdue', exact: day };
|
|
41
44
|
if (days === 0) return { text: 'Today', tone: 'plain', exact: day };
|
|
42
45
|
if (days === 1) return { text: 'Tomorrow', tone: 'plain', exact: day };
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* said on that same weekday (today or a week on?), "next <weekday>" (two
|
|
16
16
|
* readings), past references ("last Friday", "3 days ago"), a bare month,
|
|
17
17
|
* an impossible date, a yearless date that is far from the meeting (the year
|
|
18
|
-
* would be a guess), and any text that states two DIFFERENT dates.
|
|
18
|
+
* would be a guess), a date before the meeting day, and any text that states two DIFFERENT dates.
|
|
19
19
|
*
|
|
20
20
|
* Distinct from `spoken-time.ts`, which resolves a voice note's phrases for the
|
|
21
21
|
* speaker and is deliberately willing to approximate ("next week" -> Friday).
|
|
@@ -143,6 +143,12 @@ function relativeHits(text: string, today: string): Hit[] {
|
|
|
143
143
|
/** Past references anywhere in the text make a relative phrase's tense uncertain. */
|
|
144
144
|
const PAST_REFERENCE = /\b(?:last|previous|yesterday|ago)\b/;
|
|
145
145
|
|
|
146
|
+
const DEADLINE_CUE = /(?:\b(?:by|before|until|till|due|deadline|no later than)\b[ :,]*(?:on |the )?)$/;
|
|
147
|
+
function hasDeadlineCue(lower: string, phrase: string): boolean {
|
|
148
|
+
const at = lower.indexOf(phrase.toLowerCase());
|
|
149
|
+
return at >= 0 && DEADLINE_CUE.test(lower.slice(0, at).trimEnd() + ' ');
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
export function resolveStatedDate(text: string, anchor: string | number | Date | null | undefined, options: StatedDateOptions = {}): StatedDate | null {
|
|
147
153
|
const flat = (text ?? '').replace(/\*\*/g, '').replace(/\s+/g, ' ').trim();
|
|
148
154
|
if (!flat) return null;
|
|
@@ -162,6 +168,10 @@ export function resolveStatedDate(text: string, anchor: string | number | Date |
|
|
|
162
168
|
const dates = new Set(hits.map((h) => h.date));
|
|
163
169
|
if (dates.size > 1) return null;
|
|
164
170
|
|
|
171
|
+
// A date before the meeting is history ("sent Oct 31") unless the words make it a deadline
|
|
172
|
+
// ("signed by 29th July"): otherwise it would show as late on day one.
|
|
173
|
+
if (today && hits.some((h) => h.date < today && !hasDeadlineCue(lower, h.phrase))) return null;
|
|
174
|
+
|
|
165
175
|
const top = hits.sort((a, b) => b.confidence - a.confidence)[0];
|
|
166
176
|
const instant = new Date(zonedInstant(top.date, '23:59', timeZone) + 59_000).toISOString().replace('.000Z', 'Z');
|
|
167
177
|
return {
|
|
@@ -27,6 +27,8 @@ export function priorityLabel(priority?: number): string | null {
|
|
|
27
27
|
export function isOverdue(item: Pick<Commitment, 'dueAt' | 'status'>, now: number): boolean {
|
|
28
28
|
if (!item.dueAt) return false;
|
|
29
29
|
if (item.status === 'done' || item.status === 'dropped') return false;
|
|
30
|
+
// A suggestion is a guess, not something owed: it is never overdue.
|
|
31
|
+
if (item.status === 'suggested') return false;
|
|
30
32
|
return Date.parse(item.dueAt) < now;
|
|
31
33
|
}
|
|
32
34
|
|