@cosmoops/connect-sdk 0.21.0 → 0.24.0

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.
@@ -597,13 +597,30 @@ export interface GrievanceChannel {
597
597
  */
598
598
  export interface CompanyProfile {
599
599
  legalName: string;
600
- /** Trading name, for prose the full registered name reads oddly in. */
600
+ /**
601
+ * Trading name, for prose the full registered name reads oddly in.
602
+ *
603
+ * Editable by the platform operator since SDK 0.23. It was a hardcoded
604
+ * constant on Connect's side before that - the one company fact no
605
+ * operator could correct without a deploy.
606
+ */
601
607
  brandName: string;
602
608
  registeredAddress: string;
603
609
  contactEmail: string;
604
610
  website: string | null;
605
611
  /** GSTIN, `null` if the operating entity is not GST-registered. */
606
612
  gstNumber: string | null;
613
+ /**
614
+ * The seat a governing-law clause names - `"Chennai, Tamil Nadu"`.
615
+ *
616
+ * **Not the registered address**, and the distinction is the reason it is
617
+ * its own field: an entity registered in one state routinely names another
618
+ * as the venue for disputes, and the two copies of this that applications
619
+ * used to keep disagreed about which. `null` when the operator has not
620
+ * published one, in which case a terms page should omit the venue rather
621
+ * than reach for `registeredAddress` instead.
622
+ */
623
+ legalJurisdiction: string | null;
607
624
  grievance: GrievanceChannel;
608
625
  }
609
626
  export interface CompanyProfileResponse {
@@ -1153,6 +1170,71 @@ export interface ConnectWorkspaceMember {
1153
1170
  granted: string[];
1154
1171
  role: string | null;
1155
1172
  }
1173
+ /**
1174
+ * How many member seats the workspace has, and whether there is another.
1175
+ *
1176
+ * The number is the **workspace's**, not your plan's: a baseline plus
1177
+ * `allowances.members` from every subscription it holds, folded across
1178
+ * applications - so a seat bought through another product is a seat you may
1179
+ * fill. `included: null` means unlimited. `used` counts active members *and*
1180
+ * pending invitations, because an invitation is a seat already spoken for.
1181
+ *
1182
+ * Advisory. The authoritative check runs inside `invite`, which is where two
1183
+ * people claiming the last seat at once is settled.
1184
+ */
1185
+ export interface ConnectMemberCapacity {
1186
+ included: number | null;
1187
+ used: number;
1188
+ canAdd: boolean;
1189
+ /**
1190
+ * `no_allowance` - nothing the workspace subscribes to grants member seats,
1191
+ * and the answer is a plan. `exhausted` - every seat is taken, and the
1192
+ * answer is an upgrade or a removal. They read alike and need different
1193
+ * next steps, so word them differently.
1194
+ */
1195
+ reason: "no_allowance" | "exhausted" | "hard_ceiling" | null;
1196
+ }
1197
+ /**
1198
+ * What the **signed-in caller** may do with the roster, from their Connect
1199
+ * permissions - not your application's.
1200
+ *
1201
+ * Render your Invite and Change-role controls from this. Without it the only
1202
+ * way to find out is to try, which is a button that exists to fail.
1203
+ */
1204
+ export interface ConnectMemberViewer {
1205
+ canInvite: boolean;
1206
+ canManageAccess: boolean;
1207
+ }
1208
+ /** An invitation that has been sent and not yet accepted - and is holding a seat. */
1209
+ export interface ConnectPendingInvitation {
1210
+ invitationId: string;
1211
+ inviteeEmail: string;
1212
+ /** The role on *your* application it carries, or `null`. */
1213
+ roleKey: string | null;
1214
+ /** ISO 8601. Seven days from when it was sent. */
1215
+ expiresAt: string;
1216
+ }
1217
+ export interface ConnectMemberAccess {
1218
+ capacity: ConnectMemberCapacity;
1219
+ viewer: ConnectMemberViewer;
1220
+ invitations: ConnectPendingInvitation[];
1221
+ }
1222
+ export interface ConnectInvitation {
1223
+ invitationId: string;
1224
+ inviteeEmail: string;
1225
+ /** ISO 8601. */
1226
+ expiresAt: string;
1227
+ /** Always present, so you can offer copy/share when the email did not go out. */
1228
+ inviteUrl: string;
1229
+ emailSent: boolean;
1230
+ }
1231
+ export interface ConnectMemberAccessResult {
1232
+ userId: string;
1233
+ /** The role on your application after the change - `null` when access was revoked. */
1234
+ roleKey: string | null;
1235
+ /** Your application's permissions this member now holds, re-resolved. */
1236
+ granted: string[];
1237
+ }
1156
1238
  /**
1157
1239
  * One bookable thing a workspace offers - "15-minute intro call", "site
1158
1240
  * survey".
@@ -1282,6 +1364,95 @@ export interface ConnectContact {
1282
1364
  createdAt: string;
1283
1365
  updatedAt: string;
1284
1366
  }
1367
+ /** Coarse on purpose - a headcount read off a homepage is a claim, not a measurement. */
1368
+ export type CompanySizeBand = "1-10" | "11-50" | "51-200" | "201-500" | "500+";
1369
+ /**
1370
+ * Where a value came from.
1371
+ *
1372
+ * - `domain` - the input itself. `url` is `null`, because there is no page.
1373
+ * - `website` - a page on the company's own site, at `url`.
1374
+ * - `registry` - a statutory register. Reserved; nothing returns it yet.
1375
+ */
1376
+ export type EnrichmentSource = "domain" | "registry" | "website";
1377
+ export interface EnrichmentCitation {
1378
+ source: EnrichmentSource;
1379
+ /** The exact page read. `null` only for `domain`. */
1380
+ url: string | null;
1381
+ /** ISO-8601. */
1382
+ retrievedAt: string;
1383
+ }
1384
+ /**
1385
+ * Every field nullable, including the ones your own record calls required.
1386
+ *
1387
+ * An enrichment is partial by nature: a site with no address printed on it
1388
+ * yields no address. A shape that demanded a city would only be forcing one to
1389
+ * be invented.
1390
+ */
1391
+ export interface EnrichedAddress {
1392
+ line1: string | null;
1393
+ line2: string | null;
1394
+ city: string | null;
1395
+ /** The state or region's *name* as written, not a code. */
1396
+ state: string | null;
1397
+ postalCode: string | null;
1398
+ /** ISO 3166-1 alpha-2, uppercase. */
1399
+ country: string | null;
1400
+ }
1401
+ /**
1402
+ * What Connect read about a company, and where each part came from.
1403
+ *
1404
+ * Every value is a claim from a page named in `citations`. Nothing here is
1405
+ * recalled by a model: a field the pages did not state is `null`, which is why
1406
+ * `null` is common and should be rendered as "not found" rather than as an
1407
+ * empty input somebody has to notice.
1408
+ */
1409
+ export interface EnrichedCompany {
1410
+ /** Normalised - lowercase, no scheme, no `www.`. */
1411
+ domain: string;
1412
+ name: string | null;
1413
+ /**
1414
+ * The registered entity name.
1415
+ *
1416
+ * Always `null` today. It is reserved for a statutory register, and
1417
+ * deliberately never filled from a website - a footer says "Acme" where the
1418
+ * register says "Acme Industries Private Limited", and this is the one field
1419
+ * here that would end up on a contract.
1420
+ */
1421
+ legalName: string | null;
1422
+ description: string | null;
1423
+ industry: string | null;
1424
+ sizeBand: CompanySizeBand | null;
1425
+ phone: string | null;
1426
+ email: string | null;
1427
+ website: string | null;
1428
+ address: EnrichedAddress | null;
1429
+ /**
1430
+ * Derived from how many fields the pages actually supported - not the
1431
+ * model's opinion of itself, which reflects the confidence of the prose it
1432
+ * read. Treat `low` as "offer this", `high` as "safe to pre-fill".
1433
+ */
1434
+ confidence: "high" | "medium" | "low";
1435
+ citations: EnrichmentCitation[];
1436
+ /** ISO-8601. Age the profile against this. */
1437
+ retrievedAt: string;
1438
+ }
1439
+ /**
1440
+ * Why there is nothing to report. A normal outcome, not an error - most
1441
+ * records legitimately have nothing to enrich.
1442
+ *
1443
+ * `consumer_domain` and `blocked_domain` will never succeed on retry.
1444
+ * `unreachable` and `no_signal` may, later.
1445
+ */
1446
+ export type EnrichmentSkipReason = "no_domain" | "consumer_domain" | "blocked_domain" | "unreachable" | "no_signal";
1447
+ export type CompanyEnrichmentResult = {
1448
+ status: "enriched";
1449
+ profile: EnrichedCompany;
1450
+ /** Whether Connect served this from its platform-wide cache. The profile is the same either way. */
1451
+ cached: boolean;
1452
+ } | {
1453
+ status: "skipped";
1454
+ reason: EnrichmentSkipReason;
1455
+ };
1285
1456
  /**
1286
1457
  * What kind of conversation a channel carries. `voice` is the only kind
1287
1458
  * Connect stocks inventory for today - `whatsapp` and `meeting` are modelled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmoops/connect-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.24.0",
4
4
  "description": "Official server-side SDK for the CosmoOps Connect platform API - Login with Connect, entitlements, billing and metering.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "commonjs",