@startsimpli/integrations 0.2.112 → 0.2.114

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/README.md CHANGED
@@ -186,7 +186,7 @@ One command does step 1: `simpli ios new "Acme Go" --tenant-url https://acme.ai.
186
186
 
187
187
  1. Copy `~/Repos/tandem-ios` to `<foundry>-ios`. Change `app.json` (`name`, `slug`, `scheme`, `ios.bundleIdentifier`, microphone strings), `src/config.ts` (the Foundry's tenant URL; central auth is `https://api.startsimpli.com`), `src/strings.ts` and the theme in `App.tsx`.
188
188
  2. `pnpm install`. It depends on published `@startsimpli/{auth,integrations,ui-native,utils}`, so nothing is linked.
189
- 3. The recording path is in this package (`native/recording`: `createRecorder`, `createRecorderAudio`, `createPermissionFlow`, `recoverOrphans`, `createDeepLink`, `createDiagnostics`, `createSession`, `createNotes`, level helpers). The shell keeps only the device bindings, injected through `AudioDriver`, `SessionInspector`, `PermissionsApi` and `RecordingFile`: `src/native.ts` (expo-audio, expo-file-system) and `modules/tandem-audio-session` (bd startsim-ij1lw.9). `createDeepLink({ scheme })`, `createDiagnostics({ tag })` and `createSession({ app })` default to the Tandem Go values.
189
+ 3. The recording path is in this package (`native/recording`: `createRecorder`, `createRecorderAudio`, `createPermissionFlow`, `recoverOrphans`, `createDeepLink`, `createDiagnostics`, `createSession`, `createNotes`, level helpers). The shell keeps only the device bindings, injected through `AudioDriver`, `SessionInspector`, `PermissionsApi` and `RecordingFile`: `src/native.ts` (expo-audio, expo-file-system) and `modules/foundry-audio-session` (bd startsim-ij1lw.9). `createDeepLink({ scheme })`, `createDiagnostics({ tag })` and `createSession({ app })` default to the Tandem Go values.
190
190
  4. `src/services.ts` builds `createNativeVoiceApi` + `createVoiceNotesController`; `App.tsx` renders `<NotesShell go={<MainScreen .../>} controller={s.notesController} />`.
191
191
  5. Check without a login: launch with `-tgFakeNotes list` (or a note id such as `n1`) to see the screens over `createFakeVoiceApi`.
192
192
  6. `npx expo prebuild --platform ios`, then `npx expo run:ios --configuration Release` (Hermes). Signing and device install are per-Apple-team, see the template README.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.112",
3
+ "version": "0.2.114",
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",
@@ -51,8 +51,8 @@
51
51
  "@startsimpli/ui-native": ">=0.1.12",
52
52
  "react-native-safe-area-context": ">=4.0.0",
53
53
  "@startsimpli/auth": "^0.4.49",
54
- "@startsimpli/ui": "^0.4.170",
55
- "@startsimpli/utils": "^0.4.17"
54
+ "@startsimpli/utils": "^0.4.17",
55
+ "@startsimpli/ui": "^0.4.170"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -100,9 +100,9 @@
100
100
  "react-native-safe-area-context": "~5.7.0",
101
101
  "@startsimpli/llm": "0.4.28",
102
102
  "@startsimpli/ui": "0.4.170",
103
+ "@startsimpli/utils": "0.4.17",
103
104
  "@startsimpli/ui-native": "0.1.14",
104
- "@startsimpli/auth": "0.4.49",
105
- "@startsimpli/utils": "0.4.17"
105
+ "@startsimpli/auth": "0.4.49"
106
106
  },
107
107
  "scripts": {
108
108
  "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
@@ -12,6 +12,7 @@ vi.mock('react-native', async () => {
12
12
  };
13
13
  });
14
14
 
15
+ import { __setColorScheme } from '../../../../../ui-native/test/rn-stub';
15
16
  import { act, allText, hostById, maybeById, press, render } from '../../../../../ui-native/test/render';
16
17
  import { FoundryApp } from '../FoundryApp';
17
18
  import type { FoundryDevice } from '../device';
@@ -58,4 +59,39 @@ describe('FoundryApp over fakes (no sign-in, no network)', () => {
58
59
  delete launchArgs.tgFakeTabs;
59
60
  expect(() => render(<FoundryApp config={{ ...config, features: { recording: true }, tabs: undefined }} device={device()} />)).toThrow(/recording/);
60
61
  });
62
+
63
+ describe('theme.mode', () => {
64
+ const bar = (r: ReturnType<typeof render>) => r.root.findAllByType('StatusBar' as never)[0].props.barStyle;
65
+ const themed = (mode?: string) => {
66
+ launchArgs.tgFakeTabs = '1';
67
+ const r = render(<FoundryApp config={{ ...config, ...(mode ? { theme: { mode } } : {}) }} device={device()} />);
68
+ return r;
69
+ };
70
+
71
+ it('defaults to dark whatever the system says', async () => {
72
+ __setColorScheme('light');
73
+ const r = themed();
74
+ await tick();
75
+ expect(bar(r)).toBe('light-content');
76
+ });
77
+
78
+ it('light stays light under a dark system', async () => {
79
+ __setColorScheme('dark');
80
+ const r = themed('light');
81
+ await tick();
82
+ expect(bar(r)).toBe('dark-content');
83
+ });
84
+
85
+ it('system follows the system appearance', async () => {
86
+ __setColorScheme('light');
87
+ const light = themed('system');
88
+ await tick();
89
+ expect(bar(light)).toBe('dark-content');
90
+ __setColorScheme('dark');
91
+ const dark = themed('system');
92
+ await tick();
93
+ expect(bar(dark)).toBe('light-content');
94
+ __setColorScheme('light');
95
+ });
96
+ });
61
97
  });
@@ -0,0 +1,48 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { resolveFoundryApp } from '../config/validate';
3
+ import { createFoundryData } from '../data';
4
+
5
+ const neverFetch = async () => { throw new Error('fake mode must not fetch'); };
6
+
7
+ function fakeData(extra: Record<string, unknown> = {}, scenario?: 'empty') {
8
+ const config = resolveFoundryApp({
9
+ app: { name: 'Hours Go' }, tenant: { url: 'http://x' },
10
+ tabs: [{ screen: 'home' }, { key: 'time', screen: 'entity', options: { entityType: 'time_entry' } }],
11
+ entityTypes: { time_entry: { label: 'Time entry', titleField: 'task', subtitleFields: ['client'], statusField: 'state' } },
12
+ ...extra,
13
+ } as never);
14
+ return createFoundryData({ config, authorizedFetch: neverFetch as never, fake: true, scenario });
15
+ }
16
+
17
+ describe('fake mode over a config with entity tabs', () => {
18
+ it('seeds a few rows for every entity tab type, filled from the type\'s own fields', async () => {
19
+ const { corpus } = fakeData();
20
+ const list = corpus.lists.entities({ type: 'time_entry' });
21
+ await list.refresh();
22
+ const rows = list.getState().items;
23
+ expect(rows.map((r) => r.id).sort()).toEqual(['time_entry-fake-1', 'time_entry-fake-2', 'time_entry-fake-3']);
24
+ expect(rows.find((r) => r.id === 'time_entry-fake-1')!.data).toMatchObject({ task: 'Time entry 1', client: 'Time entry 1 client', state: 'active' });
25
+ expect((await corpus.entities.get('time_entry-fake-2')).name).toBe('Time entry 2');
26
+ });
27
+
28
+ it('keeps the built-in sample rows and leaves the empty scenario empty', async () => {
29
+ const full = fakeData().corpus.lists.entities({ type: 'focus' });
30
+ await full.refresh();
31
+ expect(full.getState().items.length).toBeGreaterThan(0);
32
+ const none = fakeData({}, 'empty').corpus.lists.entities({ type: 'time_entry' });
33
+ await none.refresh();
34
+ expect(none.getState().items).toEqual([]);
35
+ });
36
+ });
37
+
38
+ describe('shellLabel for entity tabs', () => {
39
+ it('names a tab by its type plural, else the label pluralised, never the generic "Records"', async () => {
40
+ const { shellLabel } = await import('../config/validate');
41
+ const config = resolveFoundryApp({
42
+ app: { name: 'A' }, tenant: { url: 'http://x' },
43
+ tabs: [{ key: 'a', screen: 'entity', options: { entityType: 'project' } }, { key: 'b', screen: 'entity', options: { entityType: 'time_entry' } }, { key: 'c', screen: 'entity', label: 'Mine', options: { entityType: 'project' } }, { key: 'd', screen: 'entity', options: { entityType: 'unknown' } }],
44
+ entityTypes: { project: { label: 'Project' }, time_entry: { label: 'Time entry', plural: 'Time entries' } },
45
+ } as never);
46
+ expect(config.tabs.map((t) => shellLabel(config, t))).toEqual(['Projects', 'Time entries', 'Mine', 'Records']);
47
+ });
48
+ });
@@ -229,3 +229,10 @@ export function tabForEntityType(config: FoundryAppConfig, type: string): string
229
229
  export function tabLabel(tab: FoundryTabConfig): string {
230
230
  return tab.label ?? SCREEN_DEFAULTS[tab.screen]?.label ?? tab.key;
231
231
  }
232
+
233
+ /** What the shell's bar and More list print for a tab: an `entity` tab falls back to its type's plural before the screen default. */
234
+ export function shellLabel(config: Pick<FoundryAppConfig, 'entityTypes'>, tab: FoundryTabConfig): string {
235
+ if (tab.screen !== 'entity') return tabLabel(tab);
236
+ const spec = config.entityTypes[String(tab.options?.entityType)];
237
+ return tab.label ?? spec?.plural ?? (spec ? `${spec.label}s` : tabLabel(tab));
238
+ }
@@ -4,6 +4,7 @@ import type { MemberConnectionsApi } from '../../components/pages/types';
4
4
  import { createNativeCorpusApi, type NativeCorpusApi } from '../corpus/api';
5
5
  import { createFakeNativeCorpusApi } from '../corpus/fake';
6
6
  import { withScenario, type FakeScenario } from '../corpus/fake-scenarios';
7
+ import { fakeEntityRows } from './fakeEntities';
7
8
  import { createFakeConnectionsApi } from '../screens/connections/fake';
8
9
  import { createFakeMcpTokensApi } from '../screens/connect-claude/fake';
9
10
  import { createFakeVoiceApi } from '../voice/fake';
@@ -28,7 +29,7 @@ export function createFoundryData(deps: { config: FoundryAppConfig; authorizedFe
28
29
  const wantsNotes = config.tabs.some((t) => t.screen === 'notes');
29
30
  if (fake) {
30
31
  return {
31
- corpus: createFakeNativeCorpusApi({ scenario }),
32
+ corpus: createFakeNativeCorpusApi({ scenario, extraEntities: fakeEntityRows(config) }),
32
33
  notes: wantsNotes ? createVoiceNotesController({ api: createFakeVoiceApi({ scenario }) }) : null,
33
34
  member: {
34
35
  connections: withScenario(createFakeConnectionsApi({ connections: scenario === 'empty' ? [] : undefined }), scenario),
@@ -0,0 +1,28 @@
1
+ import type { TenantEntity } from '../../corpus/entities';
2
+ import type { FoundryAppConfig } from './config/types';
3
+
4
+ const ROWS_PER_TYPE = 3;
5
+
6
+ /**
7
+ * Fake rows for every `entity` tab type, shaped by the type's own config (`titleField`, `subtitleFields`,
8
+ * `statusField`), so a simulator check of a new Foundry's app has a list and a detail to open without a tenant.
9
+ * Ids are `<type>-fake-<n>`; the title is `<label> <n>`.
10
+ */
11
+ export function fakeEntityRows(config: Pick<FoundryAppConfig, 'tabs' | 'entityTypes'>): TenantEntity[] {
12
+ const types = [...new Set(config.tabs.filter((t) => t.screen === 'entity').map((t) => String(t.options?.entityType)))];
13
+ return types.flatMap((type) => {
14
+ const spec = config.entityTypes[type];
15
+ const label = spec?.label ?? type.replace(/[_-]+/g, ' ').replace(/^./, (c) => c.toUpperCase());
16
+ return Array.from({ length: ROWS_PER_TYPE }, (_, i): TenantEntity => {
17
+ const n = i + 1;
18
+ const name = `${label} ${n}`;
19
+ const data: Record<string, unknown> = { [spec?.titleField ?? 'name']: name };
20
+ for (const field of spec?.subtitleFields ?? []) data[field] = `${name} ${field}`;
21
+ if (spec?.statusField) data[spec.statusField] = 'active';
22
+ return {
23
+ id: `${type}-fake-${n}`, entity_type: type, external_id: `fake:${type}:${n}`, name,
24
+ created_at: `2026-11-0${n}T10:00:00Z`, org_id: 'tandem', data,
25
+ };
26
+ });
27
+ });
28
+ }
@@ -13,7 +13,7 @@ import { askTab, libraryTab } from '../screens/tabs';
13
13
  import { trackerTab } from '../tracker/tab';
14
14
  import type { VoiceNotesController } from '../voice/controller';
15
15
  import { SCREEN_DEFAULTS } from './config/defaults';
16
- import { tabForEntityType, tabLabel } from './config/validate';
16
+ import { shellLabel, tabForEntityType, tabLabel } from './config/validate';
17
17
  import type { FoundryAppConfig, FoundryTabConfig } from './config/types';
18
18
  import { entityTab } from './entity/EntityTab';
19
19
  import { glyphIcon } from './icon';
@@ -69,7 +69,7 @@ export const BUILTIN_FACTORIES: Record<string, ScreenFactory> = {
69
69
  const type = String(tab.options?.entityType);
70
70
  // A type the config does not describe is labelled from its key until the tenant schema fills it in.
71
71
  const spec = config.entityTypes[type] ?? { label: type.replace(/[_-]+/g, ' ').replace(/^./, (c) => c.toUpperCase()) };
72
- return entityTab({ api: corpus, tab: { key: tab.key, label: tab.label ?? spec.plural ?? tabLabel(tab) }, type, spec });
72
+ return entityTab({ api: corpus, tab: { key: tab.key, label: shellLabel(config, tab) }, type, spec });
73
73
  },
74
74
  };
75
75
 
@@ -22,10 +22,10 @@ const lengthen = (e: TenantEntity): TenantEntity => ({
22
22
  data: Object.fromEntries(Object.entries(e.data ?? {}).map(([k, v]) => [k, (k === 'title' || k === 'summary') && typeof v === 'string' ? longText(v) : v])),
23
23
  });
24
24
 
25
- export function createFakeNativeCorpusApi(options: FakeTenantOptions & { scenario?: FakeScenario } = {}): FakeNativeCorpusApi {
26
- const { scenario, ...tenantOptions } = options;
25
+ export function createFakeNativeCorpusApi(options: FakeTenantOptions & { scenario?: FakeScenario; /** Rows added to the built-in sample (not in the empty scenario). */ extraEntities?: TenantEntity[] } = {}): FakeNativeCorpusApi {
26
+ const { scenario, extraEntities = [], ...tenantOptions } = options;
27
27
  const tenant = createFakeTenantHttp({
28
- entities: scenario === 'empty' ? [] : scenario === 'long' ? sampleTenantEntities().map(lengthen) : sampleTenantEntities(),
28
+ entities: scenario === 'empty' ? [] : scenario === 'long' ? [...sampleTenantEntities(), ...extraEntities].map(lengthen) : [...sampleTenantEntities(), ...extraEntities],
29
29
  relationships: scenario === 'empty' ? [] : sampleTenantRelationships(),
30
30
  ...(scenario === 'refresh' ? { newRowOnReread: true } : {}),
31
31
  ...tenantOptions,
@@ -25,7 +25,7 @@ export interface SessionInfo {
25
25
  inputs: Array<{ type: string; name: string }>;
26
26
  }
27
27
 
28
- /** AVAudioSession facts and events (real binding: the local tandem-audio-session module). */
28
+ /** AVAudioSession facts and events (real binding: the local foundry-audio-session module). */
29
29
  export interface SessionInspector {
30
30
  info(): Promise<SessionInfo>;
31
31
  onInterruption(cb: (e: { type: 'began' | 'ended'; shouldResume?: boolean }) => void): () => void;