@startsimpli/integrations 0.2.101 → 0.2.102
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.102",
|
|
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.0",
|
|
52
52
|
"react-native-safe-area-context": ">=4.0.0",
|
|
53
|
-
"@startsimpli/utils": "^0.4.17",
|
|
54
53
|
"@startsimpli/ui": "^0.4.170",
|
|
55
|
-
"@startsimpli/auth": "^0.4.49"
|
|
54
|
+
"@startsimpli/auth": "^0.4.49",
|
|
55
|
+
"@startsimpli/utils": "^0.4.17"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"react": {
|
|
@@ -8,11 +8,19 @@ describe('validateFoundryApp', () => {
|
|
|
8
8
|
const c = resolveFoundryApp(minimal);
|
|
9
9
|
expect(c.app).toEqual({ name: 'Acme Go', slug: 'acme-go', scheme: 'acmego', bundleId: 'com.startsimpli.acmego' });
|
|
10
10
|
expect(c.tenant).toEqual({ url: 'https://acme.ai.startsimpli.com', centralUrl: 'https://api.startsimpli.com' });
|
|
11
|
-
expect(c.brand).toMatchObject({ name: 'Acme Go', authApp: '
|
|
11
|
+
expect(c.brand).toMatchObject({ name: 'Acme Go', authApp: 'acme', logTag: 'acmego' });
|
|
12
12
|
expect(c.tabs.map((t) => t.key)).toEqual(['home', 'go', 'notes', 'tracker', 'library', 'ask', 'planning', 'connections', 'connect-claude']);
|
|
13
13
|
expect(c.maxVisibleTabs).toBe(5);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
it('the auth app is the tenant slug: explicit, else the *.ai.startsimpli.com host, else the scheme', () => {
|
|
17
|
+
const auth = (input: object) => resolveFoundryApp(input).brand.authApp;
|
|
18
|
+
expect(auth({ app: { name: 'A Go' }, tenant: { url: 'http://localhost:4300', slug: 'hours' } })).toBe('hours');
|
|
19
|
+
expect(auth({ app: { name: 'A Go' }, tenant: { url: 'https://hours.ai.startsimpli.com' } })).toBe('hours');
|
|
20
|
+
expect(auth({ app: { name: 'A Go' }, tenant: { url: 'http://localhost:4300' } })).toBe('ago');
|
|
21
|
+
expect(auth({ app: { name: 'A Go' }, brand: { authApp: 'x' }, tenant: { url: 'http://localhost', slug: 'hours' } })).toBe('x');
|
|
22
|
+
});
|
|
23
|
+
|
|
16
24
|
it('features drive the default tab list', () => {
|
|
17
25
|
const c = resolveFoundryApp({ ...minimal, features: { recording: false, ask: false, connectClaude: false, planning: false } });
|
|
18
26
|
expect(c.tabs.map((t) => t.screen)).toEqual(['home', 'notes', 'tracker', 'library', 'connections']);
|
|
@@ -78,7 +78,7 @@ export interface FoundryAppConfig {
|
|
|
78
78
|
/** The Foundry's product name: Home title, sign-in title. */
|
|
79
79
|
name: string;
|
|
80
80
|
tagline: string;
|
|
81
|
-
/** The app slug central auth signs in against. */
|
|
81
|
+
/** The app slug central auth signs in against: it picks the token's audience, so it must be the tenant's slug. */
|
|
82
82
|
authApp: string;
|
|
83
83
|
/** Prefix of the diagnostics log. */
|
|
84
84
|
logTag: string;
|
|
@@ -86,6 +86,8 @@ export interface FoundryAppConfig {
|
|
|
86
86
|
tenant: {
|
|
87
87
|
/** The Foundry's tenant API origin. */
|
|
88
88
|
url: string;
|
|
89
|
+
/** The tenant slug. Central auth mints the token for this audience, so `brand.authApp` defaults to it (else to the host's first label on *.ai.startsimpli.com, else the scheme). */
|
|
90
|
+
slug?: string;
|
|
89
91
|
/** Central auth + member-level APIs. */
|
|
90
92
|
centralUrl: string;
|
|
91
93
|
};
|
|
@@ -32,6 +32,9 @@ export function deriveAppNames(name: string): { slug: string; scheme: string; bu
|
|
|
32
32
|
return { slug, scheme, bundleId: `com.startsimpli.${scheme}` };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/** `https://acme.ai.startsimpli.com` -> `acme`. */
|
|
36
|
+
const hostSlug = (url: string): string | undefined => /^https?:\/\/([a-z][a-z0-9-]*)\.ai\.startsimpli\.com(?:[/:]|$)/i.exec(url)?.[1]?.toLowerCase();
|
|
37
|
+
|
|
35
38
|
const str = (v: unknown): v is string => typeof v === 'string' && v.trim() !== '';
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -77,7 +80,8 @@ export function validateFoundryApp(input: unknown, options: ValidateOptions = {}
|
|
|
77
80
|
|
|
78
81
|
// tenant
|
|
79
82
|
const tenant = section('tenant', true);
|
|
80
|
-
allowed(tenant, ['url', 'centralUrl'], 'tenant');
|
|
83
|
+
allowed(tenant, ['url', 'centralUrl', 'slug'], 'tenant');
|
|
84
|
+
if (tenant.slug !== undefined && !(str(tenant.slug) && KEY.test(tenant.slug))) bad('tenant.slug', 'must be lowercase letters, digits and dashes');
|
|
81
85
|
if (!str(tenant.url)) bad('tenant.url', 'is required (the Foundry tenant URL)');
|
|
82
86
|
else if (!HTTP.test(tenant.url)) bad('tenant.url', `"${tenant.url}" must start with http:// or https://`);
|
|
83
87
|
if (tenant.centralUrl !== undefined && !(str(tenant.centralUrl) && HTTP.test(tenant.centralUrl))) bad('tenant.centralUrl', 'must start with http:// or https://');
|
|
@@ -181,10 +185,10 @@ export function validateFoundryApp(input: unknown, options: ValidateOptions = {}
|
|
|
181
185
|
brand: {
|
|
182
186
|
name: resolvedBrandName,
|
|
183
187
|
tagline: (brand.tagline as string | undefined) ?? defaultBrandTagline(),
|
|
184
|
-
authApp: (brand.authApp as string | undefined) ?? scheme,
|
|
188
|
+
authApp: (brand.authApp as string | undefined) ?? (tenant.slug as string | undefined) ?? hostSlug(tenant.url as string) ?? scheme,
|
|
185
189
|
logTag: (brand.logTag as string | undefined) ?? scheme,
|
|
186
190
|
},
|
|
187
|
-
tenant: { url: trimSlash(tenant.url as string), centralUrl: trimSlash((tenant.centralUrl as string | undefined) ?? DEFAULT_CENTRAL_URL) },
|
|
191
|
+
tenant: { url: trimSlash(tenant.url as string), centralUrl: trimSlash((tenant.centralUrl as string | undefined) ?? DEFAULT_CENTRAL_URL), ...(tenant.slug ? { slug: tenant.slug as string } : {}) },
|
|
188
192
|
theme: { mode: (theme.mode as FoundryAppConfig['theme']['mode'] | undefined) ?? DEFAULT_BASE.theme.mode },
|
|
189
193
|
features,
|
|
190
194
|
tabs,
|