@inspectorhub/field-ui 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -138,6 +138,10 @@ signatures):
138
138
  neutral notice and counts the batch as saved, not failed.
139
139
  - `urls`: `FieldUrls`, the address builders for photos, reports, presence and
140
140
  in-app paths.
141
+ `photo()` is synchronous; a host that can only produce an address later (a photo it fetches and caches) provides the
142
+ optional `subscribe(listener)` and calls the listener whenever any photo address may have changed. The editor then asks
143
+ `photo()` again and its thumbnails, viewer and previews show the new address. Calls may be batched; `subscribe` returns
144
+ the unsubscribe function. Absent, nothing changes.
141
145
  - `resources`: `FieldResources`, optional capabilities (preferences, canned
142
146
  comments, cost items, repair items, media pool, settings sheet, AI assist,
143
147
  publish readiness, template search, version history, video). A member the
@@ -524,6 +524,12 @@ interface TagLibraryEntry {
524
524
  name: string;
525
525
  color: string;
526
526
  }
527
+ /** The tags on each checklist item of one inspection, keyed by the item's id (the editor's chips). */
528
+ type ItemTagMap = Record<string, Array<{
529
+ id: string;
530
+ name: string;
531
+ color?: string;
532
+ }>>;
527
533
  /** The loader returns `{ id, name, color }` rows. */
528
534
  interface DefectCategory {
529
535
  id: string;
@@ -1364,6 +1370,13 @@ interface CollabConnector {
1364
1370
  }
1365
1371
  interface FieldUrls {
1366
1372
  photo(inspectionId: string, key: string): string;
1373
+ /**
1374
+ * Optional. `photo()` is synchronous, so a host that can only produce an address later (a photo it fetches and
1375
+ * caches, a signed address it renews) calls the listener whenever any photo address may have changed; the editor then
1376
+ * asks `photo()` again and its thumbnails, viewer and previews show the new address. Calls may be batched. Returns
1377
+ * the unsubscribe function. Absent: addresses are read when the editor renders, as before.
1378
+ */
1379
+ subscribe?(listener: () => void): () => void;
1367
1380
  reportPreview(tenantSlug: string, inspectionId: string): string | null;
1368
1381
  reportPdf(inspectionId: string): string | null;
1369
1382
  /**
@@ -1431,6 +1444,20 @@ interface FieldResources {
1431
1444
  id?: string;
1432
1445
  }>>;
1433
1446
  };
1447
+ /**
1448
+ * The tags on each checklist item of one inspection (the web host serves it from
1449
+ * `/resources/inspection-item-tags`). `list` never rejects: `null` means the host could not read it, and the
1450
+ * editor then shows what it already has. `add` and `remove` never reject either: a not-ok answer means the host
1451
+ * did not store the change, and the editor takes it back. Both are idempotent (adding a tag that is attached, or
1452
+ * removing one that is not, changes nothing), and the tag must be one of the company's own (`EditorData.tagLibrary`).
1453
+ * Absent means the host cannot keep item tags: the editor holds them in memory for the session only, as it did
1454
+ * before this member existed.
1455
+ */
1456
+ itemTags?: {
1457
+ list(inspectionId: string): Promise<ItemTagMap | null>;
1458
+ add(inspectionId: string, itemId: string, tagId: string): Promise<CommandResult>;
1459
+ remove(inspectionId: string, itemId: string, tagId: string): Promise<CommandResult>;
1460
+ };
1434
1461
  /** The tenant's repair-item catalogue (it is not per inspection). `list` never rejects: a failed read answers none. */
1435
1462
  repairItems?: {
1436
1463
  list(): Promise<RepairItemOption[]>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldCommand, C as CommandResult, a as CommandData, b as FieldDataSource, E as EditorData, I as InspectionPrefs } from './data-source-IaWUdrIc.js';
2
- export { A as AiAssistInput, c as AiAssistResult, d as AutoAdvanceMode, e as AutofillReason, B as BulkCreateUnitsBody, f as CollabConnector, g as CommandDataMap, h as CommandKey, i as CommentsLibraryEntry, j as CommentsLibraryQuery, k as CommentsLibraryRow, l as CommercialPresets, m as ComplianceCommand, n as CompliancePanelData, o as CostItemView, p as CostItemWrite, q as CostItemsListing, r as CoverPhotoOption, D as DateFormat, s as DecodeImage, t as DecodeImageError, u as DecodeImageOptions, v as DecodedImage, w as DefectCategory, x as DocumentReviewItemView, y as EditorInspection, z as ExecuteOptions, G as FieldResources, H as FieldUrls, J as GalleryPhoto, K as InspectionUnit, M as METADATA_PRESETS, L as MediaFileResult, N as MediaPoolListing, O as MediaUploader, P as NotifyOptions, Q as NotifyVariant, R as OutboundCoolingWindow, S as PcaNarrative, T as PcaNarrativeData, U as PendingMediaRecord, V as PendingMediaStore, W as PhotoAnnotateMeta, X as PhotoCropMeta, Y as PhotoCropTransform, Z as PhotoUploadMeta, _ as PropertyMetaField, $ as PsqView, a0 as PublishBlockingDefect, a1 as PublishReadiness, a2 as RatingLevel, a3 as RelianceText, a4 as RepairItemOption, a5 as ReportLinkTtl, a6 as ReportProfileOption, a7 as ReportSignoffView, a8 as ResultMap, a9 as ResultsDocHandle, aa as RevisionStatus, ab as SaveStructureTemplateCommand, ac as SchemaItem, ad as SchemaSection, ae as SessionInfo, af as SettingsSheetData, ag as StatutoryCoverage, ah as StatutoryDetails, ai as TagLibraryEntry, aj as TemplateItemBody, ak as TemplateSchema, al as TemplateSearchResult, am as TemplateSnapshot, an as TemplateSummary, ao as TimeFormat, ap as UnitCommand, aq as UnitProgress, ar as VersionSnapshotContent, as as VersionSnapshotEntry, at as VideoFinalizeInput, au as VideoUploadRef, av as VideoUploadTicket, aw as isDecodeImageError, ax as resolvePcaNarrative } from './data-source-IaWUdrIc.js';
1
+ import { F as FieldCommand, C as CommandResult, a as CommandData, b as FieldDataSource, E as EditorData, I as InspectionPrefs } from './data-source-B3NrVs6i.js';
2
+ export { A as AiAssistInput, c as AiAssistResult, d as AutoAdvanceMode, e as AutofillReason, B as BulkCreateUnitsBody, f as CollabConnector, g as CommandDataMap, h as CommandKey, i as CommentsLibraryEntry, j as CommentsLibraryQuery, k as CommentsLibraryRow, l as CommercialPresets, m as ComplianceCommand, n as CompliancePanelData, o as CostItemView, p as CostItemWrite, q as CostItemsListing, r as CoverPhotoOption, D as DateFormat, s as DecodeImage, t as DecodeImageError, u as DecodeImageOptions, v as DecodedImage, w as DefectCategory, x as DocumentReviewItemView, y as EditorInspection, z as ExecuteOptions, G as FieldResources, H as FieldUrls, J as GalleryPhoto, K as InspectionUnit, M as METADATA_PRESETS, L as MediaFileResult, N as MediaPoolListing, O as MediaUploader, P as NotifyOptions, Q as NotifyVariant, R as OutboundCoolingWindow, S as PcaNarrative, T as PcaNarrativeData, U as PendingMediaRecord, V as PendingMediaStore, W as PhotoAnnotateMeta, X as PhotoCropMeta, Y as PhotoCropTransform, Z as PhotoUploadMeta, _ as PropertyMetaField, $ as PsqView, a0 as PublishBlockingDefect, a1 as PublishReadiness, a2 as RatingLevel, a3 as RelianceText, a4 as RepairItemOption, a5 as ReportLinkTtl, a6 as ReportProfileOption, a7 as ReportSignoffView, a8 as ResultMap, a9 as ResultsDocHandle, aa as RevisionStatus, ab as SaveStructureTemplateCommand, ac as SchemaItem, ad as SchemaSection, ae as SessionInfo, af as SettingsSheetData, ag as StatutoryCoverage, ah as StatutoryDetails, ai as TagLibraryEntry, aj as TemplateItemBody, ak as TemplateSchema, al as TemplateSearchResult, am as TemplateSnapshot, an as TemplateSummary, ao as TimeFormat, ap as UnitCommand, aq as UnitProgress, ar as VersionSnapshotContent, as as VersionSnapshotEntry, at as VideoFinalizeInput, au as VideoUploadRef, av as VideoUploadTicket, aw as isDecodeImageError, ax as resolvePcaNarrative } from './data-source-B3NrVs6i.js';
3
3
  import * as React from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  import * as Y from 'yjs';