@collabdt/core 0.17.0 → 0.18.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 +1 -1
- package/dist/core/components/AppSidebarContent.d.ts +2 -2
- package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
- package/dist/core/components/AppSidebarContent.js +5 -4
- package/dist/core/components/AppSidebarContent.js.map +1 -1
- package/dist/core/components/Logo.d.ts +2 -0
- package/dist/core/components/Logo.d.ts.map +1 -1
- package/dist/core/components/Logo.js +8 -14
- package/dist/core/components/Logo.js.map +1 -1
- package/dist/core/components/Toolbar.d.ts +2 -2
- package/dist/core/components/Toolbar.d.ts.map +1 -1
- package/dist/core/components/Toolbar.js +4 -4
- package/dist/core/components/Toolbar.js.map +1 -1
- package/dist/core/components/authentication/AuthPage.d.ts +2 -2
- package/dist/core/components/authentication/AuthPage.d.ts.map +1 -1
- package/dist/core/components/authentication/AuthPage.js +6 -36
- package/dist/core/components/authentication/AuthPage.js.map +1 -1
- package/dist/core/components/authentication/Signin.d.ts +2 -2
- package/dist/core/components/authentication/Signin.d.ts.map +1 -1
- package/dist/core/components/authentication/Signin.js +2 -2
- package/dist/core/components/authentication/Signin.js.map +1 -1
- package/dist/core/components/settings/index.d.ts +2 -2
- package/dist/core/components/settings/index.d.ts.map +1 -1
- package/dist/core/components/settings/index.js +2 -2
- package/dist/core/components/settings/index.js.map +1 -1
- package/dist/core/components/settings/src/OrganizationSettingsPanel.d.ts +2 -2
- package/dist/core/components/settings/src/OrganizationSettingsPanel.d.ts.map +1 -1
- package/dist/core/components/settings/src/OrganizationSettingsPanel.js +3 -3
- package/dist/core/components/settings/src/OrganizationSettingsPanel.js.map +1 -1
- package/dist/core/components/settings/src/SettingsContent.d.ts +2 -2
- package/dist/core/components/settings/src/SettingsContent.d.ts.map +1 -1
- package/dist/core/components/settings/src/SettingsContent.js +2 -2
- package/dist/core/components/settings/src/SettingsContent.js.map +1 -1
- package/dist/core/components/ui/AppSidebar.d.ts +3 -1
- package/dist/core/components/ui/AppSidebar.d.ts.map +1 -1
- package/dist/core/components/ui/AppSidebar.js +2 -2
- package/dist/core/components/ui/AppSidebar.js.map +1 -1
- package/dist/core/components/ui/NavUser.d.ts +3 -1
- package/dist/core/components/ui/NavUser.d.ts.map +1 -1
- package/dist/core/components/ui/NavUser.js +15 -11
- package/dist/core/components/ui/NavUser.js.map +1 -1
- package/dist/core/components/ui/Sidebar.d.ts +1 -1
- package/dist/core/components/ui/Sidebar.d.ts.map +1 -1
- package/dist/core/components/ui/Sidebar.js +3 -3
- package/dist/core/components/ui/Sidebar.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/index.d.ts +2 -2
- package/dist/core/components/ui/ViewerSidebar/index.d.ts.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/index.js +2 -2
- package/dist/core/components/ui/ViewerSidebar/index.js.map +1 -1
- package/dist/core/components/usage/SortHeader.d.ts +18 -0
- package/dist/core/components/usage/SortHeader.d.ts.map +1 -0
- package/dist/core/components/usage/SortHeader.js +25 -0
- package/dist/core/components/usage/SortHeader.js.map +1 -0
- package/dist/core/components/usage/StatCard.d.ts +9 -0
- package/dist/core/components/usage/StatCard.d.ts.map +1 -0
- package/dist/core/components/usage/StatCard.js +18 -0
- package/dist/core/components/usage/StatCard.js.map +1 -0
- package/dist/core/components/usage/UsagePanels.d.ts +15 -0
- package/dist/core/components/usage/UsagePanels.d.ts.map +1 -0
- package/dist/core/components/usage/UsagePanels.js +43 -0
- package/dist/core/components/usage/UsagePanels.js.map +1 -0
- package/dist/core/components/usage/UserUsageTable.d.ts +14 -0
- package/dist/core/components/usage/UserUsageTable.d.ts.map +1 -0
- package/dist/core/components/usage/UserUsageTable.js +64 -0
- package/dist/core/components/usage/UserUsageTable.js.map +1 -0
- package/dist/core/components/usage/VolumeOverview.d.ts +5 -0
- package/dist/core/components/usage/VolumeOverview.d.ts.map +1 -0
- package/dist/core/components/usage/VolumeOverview.js +81 -0
- package/dist/core/components/usage/VolumeOverview.js.map +1 -0
- package/dist/core/components/usage/usagePalette.d.ts +21 -0
- package/dist/core/components/usage/usagePalette.d.ts.map +1 -0
- package/dist/core/components/usage/usagePalette.js +10 -0
- package/dist/core/components/usage/usagePalette.js.map +1 -0
- package/dist/core/components/viewers/Data/siteDetails/AssociatedBuildings.js.map +1 -1
- package/dist/core/components/viewers/Viewer.d.ts +2 -2
- package/dist/core/components/viewers/Viewer.d.ts.map +1 -1
- package/dist/core/components/viewers/Viewer.js +3 -3
- package/dist/core/components/viewers/Viewer.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/RowActions.js +9 -9
- package/dist/core/components/viewers/map/datasets/RowActions.js.map +1 -1
- package/dist/core/components/viewers/map/datasets/src/orgFileDatasets.d.ts +4 -0
- package/dist/core/components/viewers/map/datasets/src/orgFileDatasets.d.ts.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/{minioDatasets.js → orgFileDatasets.js} +5 -5
- package/dist/core/components/viewers/map/datasets/src/orgFileDatasets.js.map +1 -0
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.d.ts +1 -1
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js +4 -4
- package/dist/core/components/viewers/map/datasets/src/useOrganizationalDatasets.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/siteGeometry.d.ts +3 -3
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/siteGeometry.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/siteGeometry.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/useShowSitesOnMap.d.ts +1 -1
- package/dist/core/components/viewers/map/src/MapLayers/src/SiteLayer/useShowSitesOnMap.js.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.d.ts +2 -2
- package/dist/core/components/viewers/map/src/MapSidebar/index.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.js +1 -1
- package/dist/core/components/viewers/map/src/MapSidebar/index.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.d.ts +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddDataset/DatasetAdder.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddFile/utils/uploadToPresignedURLS.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/AddTools/AddSite/persistSite.d.ts +3 -3
- package/dist/core/components/viewers/map/src/tools/AddTools/AddSite/persistSite.js.map +1 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.d.ts +1 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.d.ts.map +1 -1
- package/dist/core/components/viewers/map/src/tools/mapTools.js.map +1 -1
- package/dist/core/hooks/ports/apiAdapter.d.ts +3 -0
- package/dist/core/hooks/ports/apiAdapter.d.ts.map +1 -1
- package/dist/core/hooks/provider.d.ts +2 -0
- package/dist/core/hooks/provider.d.ts.map +1 -1
- package/dist/core/hooks/provider.js +3 -1
- package/dist/core/hooks/provider.js.map +1 -1
- package/dist/core/hooks/usage/createUsageHooks.d.ts +15 -0
- package/dist/core/hooks/usage/createUsageHooks.d.ts.map +1 -0
- package/dist/core/hooks/usage/createUsageHooks.js +16 -0
- package/dist/core/hooks/usage/createUsageHooks.js.map +1 -0
- package/dist/core/hooks/usage/usage.d.ts +11 -0
- package/dist/core/hooks/usage/usage.d.ts.map +1 -0
- package/dist/core/hooks/usage/usage.js +11 -0
- package/dist/core/hooks/usage/usage.js.map +1 -0
- package/dist/core/hooks/useFirstLoadableImage.d.ts +3 -0
- package/dist/core/hooks/useFirstLoadableImage.d.ts.map +1 -0
- package/dist/core/hooks/useFirstLoadableImage.js +46 -0
- package/dist/core/hooks/useFirstLoadableImage.js.map +1 -0
- package/dist/core/i18n/messages/en.json +31 -0
- package/dist/core/i18n/messages/es.json +31 -0
- package/dist/core/i18n/messages/fr.json +31 -0
- package/dist/core/store/AppConfig/context.d.ts +1 -1
- package/dist/core/store/AppConfig/context.d.ts.map +1 -1
- package/dist/core/store/AppConfig/context.js.map +1 -1
- package/dist/core/store/MapSites/reducer.d.ts +2 -2
- package/dist/core/store/MapSites/reducer.d.ts.map +1 -1
- package/dist/core/store/MapSites/reducer.js.map +1 -1
- package/dist/core/types/usage.d.ts +36 -0
- package/dist/core/types/usage.d.ts.map +1 -0
- package/dist/core/types/usage.js +1 -0
- package/dist/core/types/usage.js.map +1 -0
- package/dist/core/utils/csv.d.ts +7 -0
- package/dist/core/utils/csv.d.ts.map +1 -0
- package/dist/core/utils/csv.js +23 -0
- package/dist/core/utils/csv.js.map +1 -0
- package/dist/core/utils/orgLogo.d.ts +6 -0
- package/dist/core/utils/orgLogo.d.ts.map +1 -0
- package/dist/core/utils/orgLogo.js +15 -0
- package/dist/core/utils/orgLogo.js.map +1 -0
- package/dist/core/utils/usageCsv.d.ts +3 -0
- package/dist/core/utils/usageCsv.d.ts.map +1 -0
- package/dist/core/utils/usageCsv.js +14 -0
- package/dist/core/utils/usageCsv.js.map +1 -0
- package/dist/core/utils/usageFormat.d.ts +6 -0
- package/dist/core/utils/usageFormat.d.ts.map +1 -0
- package/dist/core/utils/usageFormat.js +34 -0
- package/dist/core/utils/usageFormat.js.map +1 -0
- package/package.json +1 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts +0 -4
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.d.ts.map +0 -1
- package/dist/core/components/viewers/map/datasets/src/minioDatasets.js.map +0 -1
|
@@ -9,10 +9,10 @@ export interface PersistedSite {
|
|
|
9
9
|
/**
|
|
10
10
|
* Persist a freshly drawn site:
|
|
11
11
|
* 1. create the DB Site (via the injected `createSite` hook trigger),
|
|
12
|
-
* 2. upload the polygon GeoJSON to
|
|
13
|
-
* 3. create a File row attached to the site that references the
|
|
12
|
+
* 2. upload the polygon GeoJSON to object storage (presigned PUT),
|
|
13
|
+
* 3. create a File row attached to the site that references the stored object.
|
|
14
14
|
*
|
|
15
|
-
* The polygon geometry lives in
|
|
15
|
+
* The polygon geometry lives in object storage (there is no geometry column on Site);
|
|
16
16
|
* the File row links it to the site via `attachedFilesSiteId` + the geometry tag.
|
|
17
17
|
*/
|
|
18
18
|
export declare const persistDrawnSite: (params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/tools/AddTools/AddSite/persistSite.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { ringToFeatureCollection, type Ring } from '../../../MapLayers/src/SiteLayer/siteGeometry'\nimport { uploadToPresignedUrl } from '../AddFile/utils/uploadToPresignedURLS'\n\n/** Tag stored on the File row so the site's boundary geojson can be found later. */\nexport const SITE_GEOMETRY_TAG = 'site-geometry'\n\nexport interface PersistedSite {\n siteId: number\n assetId: string\n fileId?: number\n}\n\n/**\n * Persist a freshly drawn site:\n * 1. create the DB Site (via the injected `createSite` hook trigger),\n * 2. upload the polygon GeoJSON to
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/core/components/viewers/map/src/tools/AddTools/AddSite/persistSite.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { ringToFeatureCollection, type Ring } from '../../../MapLayers/src/SiteLayer/siteGeometry'\nimport { uploadToPresignedUrl } from '../AddFile/utils/uploadToPresignedURLS'\n\n/** Tag stored on the File row so the site's boundary geojson can be found later. */\nexport const SITE_GEOMETRY_TAG = 'site-geometry'\n\nexport interface PersistedSite {\n siteId: number\n assetId: string\n fileId?: number\n}\n\n/**\n * Persist a freshly drawn site:\n * 1. create the DB Site (via the injected `createSite` hook trigger),\n * 2. upload the polygon GeoJSON to object storage (presigned PUT),\n * 3. create a File row attached to the site that references the stored object.\n *\n * The polygon geometry lives in object storage (there is no geometry column on Site);\n * the File row links it to the site via `attachedFilesSiteId` + the geometry tag.\n */\nexport const persistDrawnSite = async (params: {\n name: string\n ring: Ring\n centroid: [number, number]\n createSite: (arg: any) => Promise<any>\n}): Promise<PersistedSite> => {\n const { name, ring, centroid, createSite } = params\n\n const site = await createSite({\n siteName: name,\n siteLongitude: centroid[0],\n siteLatitude: centroid[1],\n })\n const siteId = site?.id\n if (!siteId) throw new Error('Site creation did not return an id')\n\n const assetId = `${crypto.randomUUID()}.geojson`\n const fc = ringToFeatureCollection(ring, name)\n const file = new File([JSON.stringify(fc)], `${name || 'site'}.geojson`, {\n type: 'application/geo+json',\n })\n\n const presRes = await fetch(`/api/presigned-url-upload?asset=${encodeURIComponent(assetId)}`)\n if (!presRes.ok) throw new Error('Failed to get an upload URL')\n const { presignedUrl } = await presRes.json()\n await uploadToPresignedUrl(presignedUrl, file)\n\n const fileRes = await fetch(`/api/files/site/${siteId}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n type: 'map-file',\n name: `${name || 'site'}.geojson`,\n assetId,\n mimeType: 'application/geo+json',\n extension: 'geojson',\n sizeBytes: file.size,\n tag: SITE_GEOMETRY_TAG,\n isVisible: false,\n }),\n })\n // The DB link is required: without it the boundary is orphaned in object storage and\n // can never be re-shown. Treat failure as fatal so the caller can retry.\n if (!fileRes.ok) throw new Error('Failed to attach the geometry file to the site')\n const data = await fileRes.json().catch(() => null)\n const fileId: number | undefined = data?.newFile?.id\n\n return { siteId, assetId, fileId }\n}\n"],"mappings":"AAGA,SAAS,+BAA0C;AACnD,SAAS,4BAA4B;AAG9B,MAAM,oBAAoB;AAiB1B,MAAM,mBAAmB,OAAO,WAKT;AA7B9B;AA8BE,QAAM,EAAE,MAAM,MAAM,UAAU,WAAW,IAAI;AAE7C,QAAM,OAAO,MAAM,WAAW;AAAA,IAC5B,UAAU;AAAA,IACV,eAAe,SAAS,CAAC;AAAA,IACzB,cAAc,SAAS,CAAC;AAAA,EAC1B,CAAC;AACD,QAAM,SAAS,6BAAM;AACrB,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,oCAAoC;AAEjE,QAAM,UAAU,GAAG,OAAO,WAAW,CAAC;AACtC,QAAM,KAAK,wBAAwB,MAAM,IAAI;AAC7C,QAAM,OAAO,IAAI,KAAK,CAAC,KAAK,UAAU,EAAE,CAAC,GAAG,GAAG,QAAQ,MAAM,YAAY;AAAA,IACvE,MAAM;AAAA,EACR,CAAC;AAED,QAAM,UAAU,MAAM,MAAM,mCAAmC,mBAAmB,OAAO,CAAC,EAAE;AAC5F,MAAI,CAAC,QAAQ,GAAI,OAAM,IAAI,MAAM,6BAA6B;AAC9D,QAAM,EAAE,aAAa,IAAI,MAAM,QAAQ,KAAK;AAC5C,QAAM,qBAAqB,cAAc,IAAI;AAE7C,QAAM,UAAU,MAAM,MAAM,mBAAmB,MAAM,IAAI;AAAA,IACvD,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM,KAAK,UAAU;AAAA,MACnB,MAAM;AAAA,MACN,MAAM,GAAG,QAAQ,MAAM;AAAA,MACvB;AAAA,MACA,UAAU;AAAA,MACV,WAAW;AAAA,MACX,WAAW,KAAK;AAAA,MAChB,KAAK;AAAA,MACL,WAAW;AAAA,IACb,CAAC;AAAA,EACH,CAAC;AAGD,MAAI,CAAC,QAAQ,GAAI,OAAM,IAAI,MAAM,gDAAgD;AACjF,QAAM,OAAO,MAAM,QAAQ,KAAK,EAAE,MAAM,MAAM,IAAI;AAClD,QAAM,UAA6B,kCAAM,YAAN,mBAAe;AAElD,SAAO,EAAE,QAAQ,SAAS,OAAO;AACnC;","names":[]}
|
|
@@ -3,7 +3,7 @@ import type { Tool } from '../../../../../types/tools';
|
|
|
3
3
|
export type MapToolbarToolType = 'map-dimensions' | 'map-media' | 'map-compare' | 'map-database' | 'map-add' | 'map-add-comment' | 'map-add-dataset' | 'map-add-site' | 'map-add-building' | 'map-add-sensor' | 'map-add-file' | 'map-measure' | 'map-share' | 'map-compare-buildings' | 'open-building-page' | 'open-bim-viewer' | 'map-edit-footprint';
|
|
4
4
|
type MapToolsConfig = {
|
|
5
5
|
martinBaseUrl?: string;
|
|
6
|
-
|
|
6
|
+
storageBaseUrl?: string;
|
|
7
7
|
organization?: Organization;
|
|
8
8
|
geocodeEarthApiKey?: string;
|
|
9
9
|
geocoderUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapTools.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/map/src/tools/mapTools.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAOtD,MAAM,MAAM,kBAAkB,GAC9B,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,cAAc,GACd,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,WAAW,GACX,uBAAuB,GACvB,oBAAoB,GACpB,iBAAiB,GACjB,oBAAoB,CAAA;AAEpB,KAAK,cAAc,GAAG;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,
|
|
1
|
+
{"version":3,"file":"mapTools.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/components/viewers/map/src/tools/mapTools.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAOtD,MAAM,MAAM,kBAAkB,GAC9B,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,cAAc,GACd,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,WAAW,GACX,uBAAuB,GACvB,oBAAoB,GACpB,iBAAiB,GACjB,oBAAoB,CAAA;AAEpB,KAAK,cAAc,GAAG;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAGD,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,IAAI,EAAE,CA2ClE;AAED,gGAAgG;AAChG,eAAO,MAAM,eAAe,2BAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/core/components/viewers/map/src/tools/mapTools.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { usePluginToolbarTools } from '../../../../../plugins/host/usePluginToolbarTools'\nimport { useMapViewer } from '../../../../../plugins/sdk/mapViewer'\n// Utilities\nimport Compare from '../compare'\n\nimport AddToMap from './AddTools/AddToMap'\nimport DatasetMapTool from './DatasetMapTool'\nimport { MeasureMapTool } from './measureMapTool'\nimport { ShareMapTool } from './shareMapTool'\n\nimport type { Organization } from '../../../../../types/dbTypes'\nimport type { Tool } from '../../../../../types/tools'\n\n// Icons\n\n// Custom toolbar buttons\n\n\nexport type MapToolbarToolType =\n'map-dimensions' |\n'map-media' |\n'map-compare' |\n'map-database' |\n'map-add' |\n'map-add-comment' |\n'map-add-dataset' |\n'map-add-site' |\n'map-add-building' |\n'map-add-sensor' |\n'map-add-file' |\n'map-measure' |\n'map-share' |\n'map-compare-buildings' |\n'open-building-page' |\n'open-bim-viewer' |\n'map-edit-footprint'\n\ntype MapToolsConfig = {\n martinBaseUrl?: string\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/core/components/viewers/map/src/tools/mapTools.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\nimport { useTranslations } from 'next-intl'\nimport * as React from 'react'\n\nimport { usePluginToolbarTools } from '../../../../../plugins/host/usePluginToolbarTools'\nimport { useMapViewer } from '../../../../../plugins/sdk/mapViewer'\n// Utilities\nimport Compare from '../compare'\n\nimport AddToMap from './AddTools/AddToMap'\nimport DatasetMapTool from './DatasetMapTool'\nimport { MeasureMapTool } from './measureMapTool'\nimport { ShareMapTool } from './shareMapTool'\n\nimport type { Organization } from '../../../../../types/dbTypes'\nimport type { Tool } from '../../../../../types/tools'\n\n// Icons\n\n// Custom toolbar buttons\n\n\nexport type MapToolbarToolType =\n'map-dimensions' |\n'map-media' |\n'map-compare' |\n'map-database' |\n'map-add' |\n'map-add-comment' |\n'map-add-dataset' |\n'map-add-site' |\n'map-add-building' |\n'map-add-sensor' |\n'map-add-file' |\n'map-measure' |\n'map-share' |\n'map-compare-buildings' |\n'open-building-page' |\n'open-bim-viewer' |\n'map-edit-footprint'\n\ntype MapToolsConfig = {\n martinBaseUrl?: string\n storageBaseUrl?: string\n organization?: Organization\n geocodeEarthApiKey?: string\n geocoderUrl?: string\n}\n\n// Export toolbar configuration\nexport function useMapToolbarTools(config?: MapToolsConfig): Tool[] {\n // Translation\n const t = useTranslations('mapToolbarTools')\n\n const extraProps = (config ?? {}) as unknown as Record<string, unknown>\n\n // Map plugin tools get the MapLibre handle as `MapToolProps`, alongside the\n // same config core tools receive. Imported from `sdk/mapViewer`, not the\n // `sdk/viewer` barrel, so the BIM engine stays out of this eager bundle.\n // Memoized: a fresh object every render would recompute the tool list each time.\n const viewer = useMapViewer()\n const pluginProps = React.useMemo(\n () => ({ ...extraProps, ...viewer }),\n [extraProps, viewer],\n )\n const pluginTools = usePluginToolbarTools('map.tools', pluginProps)\n\n return [\n { id: 'map-compare', title: t('compareTitle'), url: '/', icon: LR.Columns3, component: Compare },\n { id: 'map-database', title: t('datasetsTitle'), url: '/', icon: LR.Database, component: DatasetMapTool, extraProps },\n {\n id: 'map-add',\n title: t('addTitle'),\n icon: LR.Plus,\n component: AddToMap,\n extraProps,\n },\n {\n id: 'map-measure',\n title: t('measureTitle'),\n icon: LR.Ruler,\n cursor: 'crosshair',\n stayActive: true,\n component: MeasureMapTool,\n },\n { id: 'map-share',\n title: t('shareTitle'),\n icon: LR.Share2,\n component: ShareMapTool,\n },\n // Plugin-contributed tools come last, after everything core ships.\n ...pluginTools,\n ]\n}\n\n/** @deprecated Renamed to useMapToolbarTools; it is a hook and must be called during render. */\nexport const mapToolbarTools = useMapToolbarTools\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,YAAY,QAAQ;AACpB,SAAS,uBAAuB;AAChC,YAAY,WAAW;AAEvB,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAE7B,OAAO,aAAa;AAEpB,OAAO,cAAc;AACrB,OAAO,oBAAoB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAsCtB,SAAS,mBAAmB,QAAiC;AAElE,QAAM,IAAI,gBAAgB,iBAAiB;AAE3C,QAAM,aAAc,0BAAU,CAAC;AAM/B,QAAM,SAAS,aAAa;AAC5B,QAAM,cAAc,MAAM;AAAA,IACxB,MAAO,kCAAK,aAAe;AAAA,IAC3B,CAAC,YAAY,MAAM;AAAA,EACrB;AACA,QAAM,cAAc,sBAAsB,aAAa,WAAW;AAElE,SAAO;AAAA,IACL,EAAE,IAAI,eAAe,OAAO,EAAE,cAAc,GAAG,KAAK,KAAK,MAAM,GAAG,UAAU,WAAW,QAAQ;AAAA,IAC/F,EAAE,IAAI,gBAAgB,OAAO,EAAE,eAAe,GAAG,KAAK,KAAK,MAAM,GAAG,UAAU,WAAW,gBAAgB,WAAW;AAAA,IACpH;AAAA,MACE,IAAI;AAAA,MACJ,OAAO,EAAE,UAAU;AAAA,MACnB,MAAM,GAAG;AAAA,MACT,WAAW;AAAA,MACX;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI;AAAA,MACJ,OAAO,EAAE,cAAc;AAAA,MACvB,MAAM,GAAG;AAAA,MACT,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,IACA;AAAA,MAAE,IAAI;AAAA,MACJ,OAAO,EAAE,YAAY;AAAA,MACrB,MAAM,GAAG;AAAA,MACT,WAAW;AAAA,IACb;AAAA;AAAA,IAEA,GAAG;AAAA,EACL;AACF;AAGO,MAAM,kBAAkB;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Building, DbFile, Site, OpenDataPortal, DatasetGroup, User, Role, Organization, Comment, Sensor, Infrastructure, SensorType } from '../../../core/types/dbTypes';
|
|
2
2
|
import type { PluginInstallation, PluginRecord, PluginUserSetting } from '../../../core/types/plugins';
|
|
3
|
+
import type { UserUsageReport, VolumeReport } from '../../../core/types/usage';
|
|
3
4
|
export interface ApiAdapter {
|
|
4
5
|
getBuildings(): Promise<Building[]>;
|
|
5
6
|
getBuilding(id: number): Promise<Building | null>;
|
|
@@ -61,6 +62,8 @@ export interface ApiAdapter {
|
|
|
61
62
|
updateOrganization(id: string, patch: Partial<Organization>): Promise<Organization>;
|
|
62
63
|
getOrganizationByName(name: string): Promise<Organization | null>;
|
|
63
64
|
getOrganizationRoles(orgId: string): Promise<Role[]>;
|
|
65
|
+
getMyUsage(): Promise<VolumeReport>;
|
|
66
|
+
getOrganizationUsage(): Promise<UserUsageReport>;
|
|
64
67
|
getComments(): Promise<Comment[]>;
|
|
65
68
|
getCommentsByBuilding(buildingId: number): Promise<Comment[]>;
|
|
66
69
|
getComment(id: number): Promise<Comment>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiAdapter.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/ports/apiAdapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE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AAC;IAGrF,kBAAkB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9D,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1F,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9E,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAE7D"}
|
|
@@ -9,6 +9,7 @@ import { createPluginHooks } from "./plugins/createPluginHooks";
|
|
|
9
9
|
import { createSensorHooks } from "./sensors/createSensorHooks";
|
|
10
10
|
import { createSensorTypeHooks } from "./sensorTypes/createSensorTypeHooks";
|
|
11
11
|
import { createSiteHooks } from "./sites/createSiteHooks";
|
|
12
|
+
import { createUsageHooks } from "./usage/createUsageHooks";
|
|
12
13
|
import { createUserHooks } from "./users/createUserHooks";
|
|
13
14
|
import type { ApiAdapter } from "./ports/apiAdapter";
|
|
14
15
|
export type HooksBag = {
|
|
@@ -23,6 +24,7 @@ export type HooksBag = {
|
|
|
23
24
|
sensor: ReturnType<typeof createSensorHooks>;
|
|
24
25
|
sensorType: ReturnType<typeof createSensorTypeHooks>;
|
|
25
26
|
plugin: ReturnType<typeof createPluginHooks>;
|
|
27
|
+
usage: ReturnType<typeof createUsageHooks>;
|
|
26
28
|
};
|
|
27
29
|
export declare const HooksCtx: React.Context<HooksBag>;
|
|
28
30
|
export declare function CoreHooksProvider({ adapter, children }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/provider.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA6C,MAAM,OAAO,CAAC;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C,CAAC;IACzC,YAAY,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACzD,OAAO,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAC/C,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,UAAU,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IACrD,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAC5C,CAAC;AACF,eAAO,MAAM,QAAQ,yBAAuC,CAAC;AAE7D,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAC;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAiBzG;AAED,wBAAgB,YAAY,aAI3B"}
|
|
@@ -13,6 +13,7 @@ import { createPluginHooks } from "./plugins/createPluginHooks";
|
|
|
13
13
|
import { createSensorHooks } from "./sensors/createSensorHooks";
|
|
14
14
|
import { createSensorTypeHooks } from "./sensorTypes/createSensorTypeHooks";
|
|
15
15
|
import { createSiteHooks } from "./sites/createSiteHooks";
|
|
16
|
+
import { createUsageHooks } from "./usage/createUsageHooks";
|
|
16
17
|
import { createUserHooks } from "./users/createUserHooks";
|
|
17
18
|
const HooksCtx = createContext(null);
|
|
18
19
|
function CoreHooksProvider({ adapter, children }) {
|
|
@@ -27,7 +28,8 @@ function CoreHooksProvider({ adapter, children }) {
|
|
|
27
28
|
comment: createCommentHooks(adapter),
|
|
28
29
|
sensor: createSensorHooks(adapter),
|
|
29
30
|
sensorType: createSensorTypeHooks(adapter),
|
|
30
|
-
plugin: createPluginHooks(adapter)
|
|
31
|
+
plugin: createPluginHooks(adapter),
|
|
32
|
+
usage: createUsageHooks(adapter)
|
|
31
33
|
}), [adapter]);
|
|
32
34
|
return /* @__PURE__ */ jsx(HooksCtx.Provider, { value: hooks, children });
|
|
33
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/hooks/provider.tsx"],"sourcesContent":["\"use client\";\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nimport { createBuildingHooks } from \"./buildings/createBuildingHooks\";\nimport { createCommentHooks } from \"./comments/createCommentHooks\";\nimport { createFileHooks } from \"./files/createFileHooks\";\nimport { createInfrastructureHooks } from './infrastructures/createInfrastructureHooks';\nimport { createOpenDataPortalHooks } from \"./openDataPortals/createOpenDataPortalHooks\";\nimport { createOrganizationHooks } from \"./organizations/createOrganizationHooks\";\nimport { createPluginHooks } from \"./plugins/createPluginHooks\";\nimport { createSensorHooks } from \"./sensors/createSensorHooks\";\nimport { createSensorTypeHooks } from \"./sensorTypes/createSensorTypeHooks\";\nimport { createSiteHooks } from \"./sites/createSiteHooks\";\nimport { createUserHooks } from \"./users/createUserHooks\";\n\nimport type { ApiAdapter } from \"./ports/apiAdapter\";\n\n// CoreHooksProvider takes an ApiAdapter (the object that knows how to fetch data) and\n// creates all the app's data-fetching hooks from it. Mount it once at the root so every\n// page has access. Inside any component, call useCoreHooks() to get the hooks, or import\n// from the per-domain convenience wrappers (e.g. useGetBuildings from hooks/buildings/buildings.ts).\n\nexport type HooksBag = {\n building: ReturnType<typeof createBuildingHooks>;\n file: ReturnType<typeof createFileHooks>;\n openData: ReturnType<typeof createOpenDataPortalHooks>;\n site: ReturnType<typeof createSiteHooks>;\n infrastructure: ReturnType<typeof createInfrastructureHooks>;\n user: ReturnType<typeof createUserHooks>;\n organization: ReturnType<typeof createOrganizationHooks>;\n comment: ReturnType<typeof createCommentHooks>;\n sensor: ReturnType<typeof createSensorHooks>;\n sensorType: ReturnType<typeof createSensorTypeHooks>;\n plugin: ReturnType<typeof createPluginHooks>;\n};\nexport const HooksCtx = createContext<HooksBag | null>(null);\n\nexport function CoreHooksProvider({ adapter, children }:{ adapter: ApiAdapter; children: React.ReactNode }) {\n // Build the bound hook set exactly once per adapter instance\n const hooks = useMemo<HooksBag>(() => ({\n building: createBuildingHooks(adapter),\n file: createFileHooks(adapter),\n openData: createOpenDataPortalHooks(adapter),\n site: createSiteHooks(adapter),\n infrastructure: createInfrastructureHooks(adapter),\n user: createUserHooks(adapter),\n organization: createOrganizationHooks(adapter),\n comment: createCommentHooks(adapter),\n sensor: createSensorHooks(adapter),\n sensorType: createSensorTypeHooks(adapter),\n plugin: createPluginHooks(adapter),\n }), [adapter]);\n return <HooksCtx.Provider value={hooks}>{children}</HooksCtx.Provider>;\n}\n\nexport function useCoreHooks() {\n const ctx = useContext(HooksCtx);\n if (!ctx) throw new Error(\"useCoreHooks must be used inside <CoreHooksProvider>\");\n return ctx;\n}"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../../src/core/hooks/provider.tsx"],"sourcesContent":["\"use client\";\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nimport { createBuildingHooks } from \"./buildings/createBuildingHooks\";\nimport { createCommentHooks } from \"./comments/createCommentHooks\";\nimport { createFileHooks } from \"./files/createFileHooks\";\nimport { createInfrastructureHooks } from './infrastructures/createInfrastructureHooks';\nimport { createOpenDataPortalHooks } from \"./openDataPortals/createOpenDataPortalHooks\";\nimport { createOrganizationHooks } from \"./organizations/createOrganizationHooks\";\nimport { createPluginHooks } from \"./plugins/createPluginHooks\";\nimport { createSensorHooks } from \"./sensors/createSensorHooks\";\nimport { createSensorTypeHooks } from \"./sensorTypes/createSensorTypeHooks\";\nimport { createSiteHooks } from \"./sites/createSiteHooks\";\nimport { createUsageHooks } from \"./usage/createUsageHooks\";\nimport { createUserHooks } from \"./users/createUserHooks\";\n\nimport type { ApiAdapter } from \"./ports/apiAdapter\";\n\n// CoreHooksProvider takes an ApiAdapter (the object that knows how to fetch data) and\n// creates all the app's data-fetching hooks from it. Mount it once at the root so every\n// page has access. Inside any component, call useCoreHooks() to get the hooks, or import\n// from the per-domain convenience wrappers (e.g. useGetBuildings from hooks/buildings/buildings.ts).\n\nexport type HooksBag = {\n building: ReturnType<typeof createBuildingHooks>;\n file: ReturnType<typeof createFileHooks>;\n openData: ReturnType<typeof createOpenDataPortalHooks>;\n site: ReturnType<typeof createSiteHooks>;\n infrastructure: ReturnType<typeof createInfrastructureHooks>;\n user: ReturnType<typeof createUserHooks>;\n organization: ReturnType<typeof createOrganizationHooks>;\n comment: ReturnType<typeof createCommentHooks>;\n sensor: ReturnType<typeof createSensorHooks>;\n sensorType: ReturnType<typeof createSensorTypeHooks>;\n plugin: ReturnType<typeof createPluginHooks>;\n usage: ReturnType<typeof createUsageHooks>;\n};\nexport const HooksCtx = createContext<HooksBag | null>(null);\n\nexport function CoreHooksProvider({ adapter, children }:{ adapter: ApiAdapter; children: React.ReactNode }) {\n // Build the bound hook set exactly once per adapter instance\n const hooks = useMemo<HooksBag>(() => ({\n building: createBuildingHooks(adapter),\n file: createFileHooks(adapter),\n openData: createOpenDataPortalHooks(adapter),\n site: createSiteHooks(adapter),\n infrastructure: createInfrastructureHooks(adapter),\n user: createUserHooks(adapter),\n organization: createOrganizationHooks(adapter),\n comment: createCommentHooks(adapter),\n sensor: createSensorHooks(adapter),\n sensorType: createSensorTypeHooks(adapter),\n plugin: createPluginHooks(adapter),\n usage: createUsageHooks(adapter),\n }), [adapter]);\n return <HooksCtx.Provider value={hooks}>{children}</HooksCtx.Provider>;\n}\n\nexport function useCoreHooks() {\n const ctx = useContext(HooksCtx);\n if (!ctx) throw new Error(\"useCoreHooks must be used inside <CoreHooksProvider>\");\n return ctx;\n}"],"mappings":";AA2DS;AAtDT,SAAgB,eAAe,YAAY,eAAe;AAE1D,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,+BAA+B;AACxC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAuBzB,MAAM,WAAW,cAA+B,IAAI;AAEpD,SAAS,kBAAkB,EAAE,SAAS,SAAS,GAAsD;AAE1G,QAAM,QAAQ,QAAkB,OAAO;AAAA,IACrC,UAAU,oBAAoB,OAAO;AAAA,IACrC,MAAM,gBAAgB,OAAO;AAAA,IAC7B,UAAU,0BAA0B,OAAO;AAAA,IAC3C,MAAM,gBAAgB,OAAO;AAAA,IAC7B,gBAAgB,0BAA0B,OAAO;AAAA,IACjD,MAAM,gBAAgB,OAAO;AAAA,IAC7B,cAAc,wBAAwB,OAAO;AAAA,IAC7C,SAAS,mBAAmB,OAAO;AAAA,IACnC,QAAQ,kBAAkB,OAAO;AAAA,IACjC,YAAY,sBAAsB,OAAO;AAAA,IACzC,QAAQ,kBAAkB,OAAO;AAAA,IACjC,OAAO,iBAAiB,OAAO;AAAA,EACjC,IAAI,CAAC,OAAO,CAAC;AACb,SAAO,oBAAC,SAAS,UAAT,EAAkB,OAAO,OAAQ,UAAS;AACpD;AAEO,SAAS,eAAe;AAC7B,QAAM,MAAM,WAAW,QAAQ;AAC/B,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,sDAAsD;AAChF,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UserUsageReport, VolumeReport } from '../../types/usage';
|
|
2
|
+
import type { ApiAdapter } from '../ports/apiAdapter';
|
|
3
|
+
export declare function createUsageHooks(adapter: ApiAdapter): {
|
|
4
|
+
useMyUsage: () => {
|
|
5
|
+
report: VolumeReport;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
isError: unknown;
|
|
8
|
+
};
|
|
9
|
+
useOrganizationUsage: () => {
|
|
10
|
+
report: UserUsageReport;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
isError: unknown;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=createUsageHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUsageHooks.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/usage/createUsageHooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU;;;;iBAGY,OAAO;;;;;iBAKP,OAAO;;EAItE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import useSWR from "swr";
|
|
2
|
+
function createUsageHooks(adapter) {
|
|
3
|
+
const useMyUsage = () => {
|
|
4
|
+
const { data, error, isLoading } = useSWR(["usage", "me"], () => adapter.getMyUsage());
|
|
5
|
+
return { report: data != null ? data : null, isLoading, isError: error };
|
|
6
|
+
};
|
|
7
|
+
const useOrganizationUsage = () => {
|
|
8
|
+
const { data, error, isLoading } = useSWR(["usage", "organization"], () => adapter.getOrganizationUsage());
|
|
9
|
+
return { report: data != null ? data : null, isLoading, isError: error };
|
|
10
|
+
};
|
|
11
|
+
return { useMyUsage, useOrganizationUsage };
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
createUsageHooks
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=createUsageHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/hooks/usage/createUsageHooks.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport useSWR from 'swr'\n\nimport type { UserUsageReport, VolumeReport } from '../../types/usage'\nimport type { ApiAdapter } from '../ports/apiAdapter'\n\nexport function createUsageHooks(adapter: ApiAdapter) {\n const useMyUsage = () => {\n const { data, error, isLoading } = useSWR<VolumeReport>(['usage', 'me'], () => adapter.getMyUsage())\n return { report: data ?? null, isLoading, isError: error as unknown }\n }\n\n const useOrganizationUsage = () => {\n const { data, error, isLoading } = useSWR<UserUsageReport>(['usage', 'organization'], () => adapter.getOrganizationUsage())\n return { report: data ?? null, isLoading, isError: error as unknown }\n }\n\n return { useMyUsage, useOrganizationUsage }\n}\n"],"mappings":"AAGA,OAAO,YAAY;AAKZ,SAAS,iBAAiB,SAAqB;AACpD,QAAM,aAAa,MAAM;AACvB,UAAM,EAAE,MAAM,OAAO,UAAU,IAAI,OAAqB,CAAC,SAAS,IAAI,GAAG,MAAM,QAAQ,WAAW,CAAC;AACnG,WAAO,EAAE,QAAQ,sBAAQ,MAAM,WAAW,SAAS,MAAiB;AAAA,EACtE;AAEA,QAAM,uBAAuB,MAAM;AACjC,UAAM,EAAE,MAAM,OAAO,UAAU,IAAI,OAAwB,CAAC,SAAS,cAAc,GAAG,MAAM,QAAQ,qBAAqB,CAAC;AAC1H,WAAO,EAAE,QAAQ,sBAAQ,MAAM,WAAW,SAAS,MAAiB;AAAA,EACtE;AAEA,SAAO,EAAE,YAAY,qBAAqB;AAC5C;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useMyUsage: () => {
|
|
2
|
+
report: import("../../types/usage").VolumeReport;
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
isError: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare const useOrganizationUsage: () => {
|
|
7
|
+
report: import("../../types/usage").UserUsageReport;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
isError: unknown;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/usage/usage.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU;;;;CAA0C,CAAC;AAClE,eAAO,MAAM,oBAAoB;;;;CAAoD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import { useCoreHooks } from "../provider";
|
|
5
|
+
const useMyUsage = () => useCoreHooks().usage.useMyUsage();
|
|
6
|
+
const useOrganizationUsage = () => useCoreHooks().usage.useOrganizationUsage();
|
|
7
|
+
export {
|
|
8
|
+
useMyUsage,
|
|
9
|
+
useOrganizationUsage
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/hooks/usage/usage.ts"],"sourcesContent":["\"use client\";\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useCoreHooks } from \"../provider\";\n\nexport const useMyUsage = () => useCoreHooks().usage.useMyUsage();\nexport const useOrganizationUsage = () => useCoreHooks().usage.useOrganizationUsage();\n"],"mappings":";AAKA,SAAS,oBAAoB;AAEtB,MAAM,aAAa,MAAM,aAAa,EAAE,MAAM,WAAW;AACzD,MAAM,uBAAuB,MAAM,aAAa,EAAE,MAAM,qBAAqB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFirstLoadableImage.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/useFirstLoadableImage.ts"],"names":[],"mappings":"AAcA,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,CAsCvG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
const SEPARATOR = "\n";
|
|
6
|
+
function isUsable(image, src) {
|
|
7
|
+
return image.naturalWidth > 0 || src.toLowerCase().endsWith(".svg");
|
|
8
|
+
}
|
|
9
|
+
function useFirstLoadableImage(candidates) {
|
|
10
|
+
const candidatesKey = candidates.filter(Boolean).join(SEPARATOR);
|
|
11
|
+
const [loaded, setLoaded] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setLoaded(null);
|
|
14
|
+
const sources = candidatesKey ? candidatesKey.split(SEPARATOR) : [];
|
|
15
|
+
let cancelled = false;
|
|
16
|
+
let probe = null;
|
|
17
|
+
const probeFrom = (index) => {
|
|
18
|
+
if (cancelled || index >= sources.length) return;
|
|
19
|
+
const src = sources[index];
|
|
20
|
+
const image = new Image();
|
|
21
|
+
probe = image;
|
|
22
|
+
image.onload = () => {
|
|
23
|
+
if (cancelled) return;
|
|
24
|
+
if (isUsable(image, src)) setLoaded(src);
|
|
25
|
+
else probeFrom(index + 1);
|
|
26
|
+
};
|
|
27
|
+
image.onerror = () => {
|
|
28
|
+
if (!cancelled) probeFrom(index + 1);
|
|
29
|
+
};
|
|
30
|
+
image.src = src;
|
|
31
|
+
};
|
|
32
|
+
probeFrom(0);
|
|
33
|
+
return () => {
|
|
34
|
+
cancelled = true;
|
|
35
|
+
if (probe) {
|
|
36
|
+
probe.onload = null;
|
|
37
|
+
probe.onerror = null;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, [candidatesKey]);
|
|
41
|
+
return loaded;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
useFirstLoadableImage
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=useFirstLoadableImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/core/hooks/useFirstLoadableImage.ts"],"sourcesContent":["'use client'\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { useEffect, useState } from 'react'\n\nconst SEPARATOR = '\\n'\n\nfunction isUsable(image: HTMLImageElement, src: string): boolean {\n // An SVG with no intrinsic size reports naturalWidth 0 yet renders fine.\n return image.naturalWidth > 0 || src.toLowerCase().endsWith('.svg')\n}\n\n/** First candidate URL that loads, or null while probing and when none do. */\nexport function useFirstLoadableImage(candidates: readonly (string | null | undefined)[]): string | null {\n const candidatesKey = candidates.filter(Boolean).join(SEPARATOR)\n const [loaded, setLoaded] = useState<string | null>(null)\n\n // A detached Image() avoids the SSR race where a rendered <img> errors before React attaches onError.\n useEffect(() => {\n setLoaded(null)\n const sources = candidatesKey ? candidatesKey.split(SEPARATOR) : []\n let cancelled = false\n let probe: HTMLImageElement | null = null\n\n const probeFrom = (index: number) => {\n if (cancelled || index >= sources.length) return\n const src = sources[index]\n const image = new Image()\n probe = image\n image.onload = () => {\n if (cancelled) return\n if (isUsable(image, src)) setLoaded(src)\n else probeFrom(index + 1)\n }\n image.onerror = () => {\n if (!cancelled) probeFrom(index + 1)\n }\n image.src = src\n }\n\n probeFrom(0)\n return () => {\n cancelled = true\n if (probe) {\n probe.onload = null\n probe.onerror = null\n }\n }\n }, [candidatesKey])\n\n return loaded\n}\n"],"mappings":";AAKA,SAAS,WAAW,gBAAgB;AAEpC,MAAM,YAAY;AAElB,SAAS,SAAS,OAAyB,KAAsB;AAE/D,SAAO,MAAM,eAAe,KAAK,IAAI,YAAY,EAAE,SAAS,MAAM;AACpE;AAGO,SAAS,sBAAsB,YAAmE;AACvG,QAAM,gBAAgB,WAAW,OAAO,OAAO,EAAE,KAAK,SAAS;AAC/D,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAwB,IAAI;AAGxD,YAAU,MAAM;AACd,cAAU,IAAI;AACd,UAAM,UAAU,gBAAgB,cAAc,MAAM,SAAS,IAAI,CAAC;AAClE,QAAI,YAAY;AAChB,QAAI,QAAiC;AAErC,UAAM,YAAY,CAAC,UAAkB;AACnC,UAAI,aAAa,SAAS,QAAQ,OAAQ;AAC1C,YAAM,MAAM,QAAQ,KAAK;AACzB,YAAM,QAAQ,IAAI,MAAM;AACxB,cAAQ;AACR,YAAM,SAAS,MAAM;AACnB,YAAI,UAAW;AACf,YAAI,SAAS,OAAO,GAAG,EAAG,WAAU,GAAG;AAAA,YAClC,WAAU,QAAQ,CAAC;AAAA,MAC1B;AACA,YAAM,UAAU,MAAM;AACpB,YAAI,CAAC,UAAW,WAAU,QAAQ,CAAC;AAAA,MACrC;AACA,YAAM,MAAM;AAAA,IACd;AAEA,cAAU,CAAC;AACX,WAAO,MAAM;AACX,kBAAY;AACZ,UAAI,OAAO;AACT,cAAM,SAAS;AACf,cAAM,UAAU;AAAA,MAClB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO;AACT;","names":[]}
|
|
@@ -2386,5 +2386,36 @@
|
|
|
2386
2386
|
"moreStyle": "More style",
|
|
2387
2387
|
"moreEntries": "+{count, number} more",
|
|
2388
2388
|
"lessStyle": "Less style"
|
|
2389
|
+
},
|
|
2390
|
+
"UsageReport": {
|
|
2391
|
+
"loading": "Loading usage…",
|
|
2392
|
+
"loadFailed": "Could not load the usage report.",
|
|
2393
|
+
"exportCsv": "Export CSV",
|
|
2394
|
+
"stats": {
|
|
2395
|
+
"stored": "Stored",
|
|
2396
|
+
"files": "Files",
|
|
2397
|
+
"latestMonth": "Uploaded this month",
|
|
2398
|
+
"unsized": "{count, plural, one {# file has} other {# files have}} no recorded size"
|
|
2399
|
+
},
|
|
2400
|
+
"chart": {
|
|
2401
|
+
"title": "Uploads per month",
|
|
2402
|
+
"description": "Size of the files uploaded each month that are still stored.",
|
|
2403
|
+
"uploaded": "Uploaded"
|
|
2404
|
+
},
|
|
2405
|
+
"byType": {
|
|
2406
|
+
"title": "By file type",
|
|
2407
|
+
"files": "{count, plural, one {# file} other {# files}}"
|
|
2408
|
+
},
|
|
2409
|
+
"table": {
|
|
2410
|
+
"title": "Per user",
|
|
2411
|
+
"user": "User",
|
|
2412
|
+
"organization": "Organization",
|
|
2413
|
+
"stored": "Stored",
|
|
2414
|
+
"files": "Files",
|
|
2415
|
+
"lastUpload": "Last upload",
|
|
2416
|
+
"unattributed": "Unattributed (uploaded before tracking)",
|
|
2417
|
+
"deletedUser": "Unknown user",
|
|
2418
|
+
"empty": "No uploads match."
|
|
2419
|
+
}
|
|
2389
2420
|
}
|
|
2390
2421
|
}
|
|
@@ -2383,5 +2383,36 @@
|
|
|
2383
2383
|
"moreStyle": "Más estilo",
|
|
2384
2384
|
"moreEntries": "+{count, number} más",
|
|
2385
2385
|
"lessStyle": "Menos estilo"
|
|
2386
|
+
},
|
|
2387
|
+
"UsageReport": {
|
|
2388
|
+
"loading": "Cargando el uso…",
|
|
2389
|
+
"loadFailed": "No se pudo cargar el informe de uso.",
|
|
2390
|
+
"exportCsv": "Exportar CSV",
|
|
2391
|
+
"stats": {
|
|
2392
|
+
"stored": "Almacenado",
|
|
2393
|
+
"files": "Archivos",
|
|
2394
|
+
"latestMonth": "Subido este mes",
|
|
2395
|
+
"unsized": "{count, plural, one {# archivo no tiene} other {# archivos no tienen}} tamaño registrado"
|
|
2396
|
+
},
|
|
2397
|
+
"chart": {
|
|
2398
|
+
"title": "Subidas por mes",
|
|
2399
|
+
"description": "Tamaño de los archivos subidos cada mes que siguen almacenados.",
|
|
2400
|
+
"uploaded": "Subido"
|
|
2401
|
+
},
|
|
2402
|
+
"byType": {
|
|
2403
|
+
"title": "Por tipo de archivo",
|
|
2404
|
+
"files": "{count, plural, one {# archivo} other {# archivos}}"
|
|
2405
|
+
},
|
|
2406
|
+
"table": {
|
|
2407
|
+
"title": "Por usuario",
|
|
2408
|
+
"user": "Usuario",
|
|
2409
|
+
"organization": "Organización",
|
|
2410
|
+
"stored": "Almacenado",
|
|
2411
|
+
"files": "Archivos",
|
|
2412
|
+
"lastUpload": "Última subida",
|
|
2413
|
+
"unattributed": "Sin atribuir (subido antes del seguimiento)",
|
|
2414
|
+
"deletedUser": "Usuario desconocido",
|
|
2415
|
+
"empty": "Ninguna subida coincide."
|
|
2416
|
+
}
|
|
2386
2417
|
}
|
|
2387
2418
|
}
|
|
@@ -2383,5 +2383,36 @@
|
|
|
2383
2383
|
"moreStyle": "Plus de style",
|
|
2384
2384
|
"moreEntries": "+{count, number} de plus",
|
|
2385
2385
|
"lessStyle": "Moins de style"
|
|
2386
|
+
},
|
|
2387
|
+
"UsageReport": {
|
|
2388
|
+
"loading": "Chargement de l’utilisation…",
|
|
2389
|
+
"loadFailed": "Impossible de charger le rapport d’utilisation.",
|
|
2390
|
+
"exportCsv": "Exporter en CSV",
|
|
2391
|
+
"stats": {
|
|
2392
|
+
"stored": "Stocké",
|
|
2393
|
+
"files": "Fichiers",
|
|
2394
|
+
"latestMonth": "Téléversé ce mois-ci",
|
|
2395
|
+
"unsized": "{count, plural, one {# fichier n’a} other {# fichiers n’ont}} pas de taille enregistrée"
|
|
2396
|
+
},
|
|
2397
|
+
"chart": {
|
|
2398
|
+
"title": "Téléversements par mois",
|
|
2399
|
+
"description": "Taille des fichiers téléversés chaque mois et toujours stockés.",
|
|
2400
|
+
"uploaded": "Téléversé"
|
|
2401
|
+
},
|
|
2402
|
+
"byType": {
|
|
2403
|
+
"title": "Par type de fichier",
|
|
2404
|
+
"files": "{count, plural, one {# fichier} other {# fichiers}}"
|
|
2405
|
+
},
|
|
2406
|
+
"table": {
|
|
2407
|
+
"title": "Par utilisateur",
|
|
2408
|
+
"user": "Utilisateur",
|
|
2409
|
+
"organization": "Organisation",
|
|
2410
|
+
"stored": "Stocké",
|
|
2411
|
+
"files": "Fichiers",
|
|
2412
|
+
"lastUpload": "Dernier téléversement",
|
|
2413
|
+
"unattributed": "Non attribué (téléversé avant le suivi)",
|
|
2414
|
+
"deletedUser": "Utilisateur inconnu",
|
|
2415
|
+
"empty": "Aucun téléversement ne correspond."
|
|
2416
|
+
}
|
|
2386
2417
|
}
|
|
2387
2418
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/core/store/AppConfig/context.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IAC1B,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/core/store/AppConfig/context.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,cAAc,CAAA;IACzB,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AAoBD,eAAO,MAAM,gBAAgB;WACpB,gBAAgB;cACb,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;EAI1C,CAAA;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAAE,aAAa,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,CAQlG,CAAA;AAED,eAAO,MAAM,mBAAmB;WAjBvB,gBAAgB;cACb,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CAgB+B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/store/AppConfig/context.tsx"],"sourcesContent":["\"use client\"\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from \"react\";\n\nimport { detectTimeZone } from '../../utils/timeUtils'\n\nimport { AppConfigReducer } from './reducer'\n\nimport type { AppConfigActions, AppConfigState } from './reducer';\n\nexport type RuntimeConfig = {\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/store/AppConfig/context.tsx"],"sourcesContent":["\"use client\"\n\n// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as React from \"react\";\n\nimport { detectTimeZone } from '../../utils/timeUtils'\n\nimport { AppConfigReducer } from './reducer'\n\nimport type { AppConfigActions, AppConfigState } from './reducer';\n\nexport type RuntimeConfig = {\n storageUrl?: string\n martinUrl?: string\n recaptchaSiteKey?: string\n pointcloudApiUrl?: string\n geocodeEarthApiKey?: string\n geocoderUrl?: string\n photonUrl?: string\n nominatimUrl?: string\n maptilerKey?: string\n}\n\ntype InitialStateType = {\n appConfig: AppConfigState\n runtimeConfig: RuntimeConfig\n}\n\nconst initialState: InitialStateType = {\n appConfig: {\n organization: null,\n user: null,\n displayTimeZone: detectTimeZone(),\n displayTimeZoneUserSet: false,\n },\n runtimeConfig: {},\n}\n\nconst reducer = (\n { appConfig, runtimeConfig }: InitialStateType,\n action: AppConfigActions,\n): InitialStateType => ({\n appConfig: AppConfigReducer(appConfig, action),\n runtimeConfig,\n})\n\nexport const AppConfigContext = React.createContext<{\n state: InitialStateType\n dispatch: React.Dispatch<AppConfigActions>\n}>({\n state: initialState,\n dispatch: () => null,\n})\n\nexport const AppConfigProvider: React.FC<React.PropsWithChildren<{ runtimeConfig?: RuntimeConfig }>> = ({ children, runtimeConfig = {} }) => {\n const [state, dispatch] = React.useReducer(reducer, { ...initialState, runtimeConfig })\n const value = React.useMemo(() => ({ state, dispatch }), [state])\n return (\n <AppConfigContext.Provider value={value}>\n {children}\n </AppConfigContext.Provider>\n )\n}\n\nexport const useAppConfigContext = () => React.useContext(AppConfigContext)"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4DI;AAvDJ,YAAY,WAAW;AAEvB,SAAS,sBAAsB;AAE/B,SAAS,wBAAwB;AAqBjC,MAAM,eAAiC;AAAA,EACrC,WAAW;AAAA,IACT,cAAc;AAAA,IACd,MAAM;AAAA,IACN,iBAAiB,eAAe;AAAA,IAChC,wBAAwB;AAAA,EAC1B;AAAA,EACA,eAAe,CAAC;AAClB;AAEA,MAAM,UAAU,CACd,EAAE,WAAW,cAAc,GAC3B,YACsB;AAAA,EACtB,WAAW,iBAAiB,WAAW,MAAM;AAAA,EAC7C;AACF;AAEO,MAAM,mBAAmB,MAAM,cAGnC;AAAA,EACD,OAAO;AAAA,EACP,UAAU,MAAM;AAClB,CAAC;AAEM,MAAM,oBAA0F,CAAC,EAAE,UAAU,gBAAgB,CAAC,EAAE,MAAM;AAC3I,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,WAAW,SAAS,iCAAK,eAAL,EAAmB,cAAc,EAAC;AACtF,QAAM,QAAQ,MAAM,QAAQ,OAAO,EAAE,OAAO,SAAS,IAAI,CAAC,KAAK,CAAC;AAChE,SACE,oBAAC,iBAAiB,UAAjB,EAA0B,OACxB,UACH;AAEJ;AAEO,MAAM,sBAAsB,MAAM,MAAM,WAAW,gBAAgB;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActionMap } from '../ActionMap';
|
|
2
2
|
/**
|
|
3
3
|
* A site polygon currently shown on the map. The polygon geometry itself is
|
|
4
|
-
* persisted as a GeoJSON file in
|
|
4
|
+
* persisted as a GeoJSON file in object storage (referenced by `assetId`/`fileId`); this
|
|
5
5
|
* is the in-memory representation that drives the SiteLayer rendering.
|
|
6
6
|
*/
|
|
7
7
|
export interface ShownSite {
|
|
@@ -10,7 +10,7 @@ export interface ShownSite {
|
|
|
10
10
|
name: string;
|
|
11
11
|
/** Outer ring vertices [lng, lat], open (no repeated closing point) */
|
|
12
12
|
ring: [number, number][];
|
|
13
|
-
/**
|
|
13
|
+
/** Object-storage key of the geometry geojson, for re-upload when edited */
|
|
14
14
|
assetId?: string;
|
|
15
15
|
/** DB file id of the geometry geojson, for deletion */
|
|
16
16
|
fileId?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/core/store/MapSites/reducer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,uEAAuE;IACvE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IACxB,
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/core/store/MapSites/reducer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,uEAAuE;IACvE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IACxB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,sEAAsE;IACtE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAA;IAClC,CAAC,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7B,CAAC,kBAAkB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;KAAE,CAAA;IAC9D,CAAC,kBAAkB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAClD,CAAC,uBAAuB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5E,CAAC,kBAAkB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;IAC3C,CAAC,aAAa,CAAC,EAAE,SAAS,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GACvB,SAAS,CAAC,eAAe,CAAC,CAAC,MAAM,SAAS,CAAC,eAAe,CAAC,CAAC,CAAA;AAEhE,eAAO,MAAM,oBAAoB,EAAE,aAGlC,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,OAAO,aAAa,EACpB,QAAQ,eAAe,KACtB,aA6CF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/store/MapSites/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport type { ActionMap } from '../ActionMap'\n\n/**\n * A site polygon currently shown on the map. The polygon geometry itself is\n * persisted as a GeoJSON file in
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/store/MapSites/reducer.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport type { ActionMap } from '../ActionMap'\n\n/**\n * A site polygon currently shown on the map. The polygon geometry itself is\n * persisted as a GeoJSON file in object storage (referenced by `assetId`/`fileId`); this\n * is the in-memory representation that drives the SiteLayer rendering.\n */\nexport interface ShownSite {\n /** DB site id */\n id: number\n name: string\n /** Outer ring vertices [lng, lat], open (no repeated closing point) */\n ring: [number, number][]\n /** Object-storage key of the geometry geojson, for re-upload when edited */\n assetId?: string\n /** DB file id of the geometry geojson, for deletion */\n fileId?: number\n}\n\nexport interface MapSitesState {\n /** Sites currently rendered on the map. */\n sites: ShownSite[]\n /** Site whose vertices are currently being dragged/edited, if any. */\n editingSiteId: number | null\n}\n\nexport type MapSitesPayload = {\n ['SHOW_SITE']: { site: ShownSite }\n ['HIDE_SITE']: { id: number }\n ['UPDATE_SITE_RING']: { id: number, ring: [number, number][] }\n ['UPDATE_SITE_NAME']: { id: number, name: string }\n ['SET_SITE_GEOMETRY_REF']: { id: number, assetId?: string, fileId?: number }\n ['SET_EDITING_SITE']: { id: number | null }\n ['CLEAR_SITES']: undefined\n}\n\nexport type MapSitesActions\n = ActionMap<MapSitesPayload>[keyof ActionMap<MapSitesPayload>]\n\nexport const initialMapSitesState: MapSitesState = {\n sites: [],\n editingSiteId: null,\n}\n\nexport const MapSitesReducer = (\n state: MapSitesState,\n action: MapSitesActions,\n): MapSitesState => {\n switch (action.type) {\n case 'SHOW_SITE': {\n const { site } = action.payload!\n const others = state.sites.filter(s => s.id !== site.id)\n return { ...state, sites: [...others, site] }\n }\n case 'HIDE_SITE': {\n const { id } = action.payload!\n return {\n ...state,\n sites: state.sites.filter(s => s.id !== id),\n editingSiteId: state.editingSiteId === id ? null : state.editingSiteId,\n }\n }\n case 'UPDATE_SITE_RING': {\n const { id, ring } = action.payload!\n return {\n ...state,\n sites: state.sites.map(s => (s.id === id ? { ...s, ring } : s)),\n }\n }\n case 'UPDATE_SITE_NAME': {\n const { id, name } = action.payload!\n return {\n ...state,\n sites: state.sites.map(s => (s.id === id ? { ...s, name } : s)),\n }\n }\n case 'SET_SITE_GEOMETRY_REF': {\n const { id, assetId, fileId } = action.payload!\n return {\n ...state,\n sites: state.sites.map(s => (s.id === id ? { ...s, assetId, fileId } : s)),\n }\n }\n case 'SET_EDITING_SITE': {\n const { id } = action.payload!\n return { ...state, editingSiteId: id }\n }\n case 'CLEAR_SITES':\n return { ...state, sites: [], editingSiteId: null }\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0CO,MAAM,uBAAsC;AAAA,EACjD,OAAO,CAAC;AAAA,EACR,eAAe;AACjB;AAEO,MAAM,kBAAkB,CAC7B,OACA,WACkB;AAClB,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,aAAa;AAChB,YAAM,EAAE,KAAK,IAAI,OAAO;AACxB,YAAM,SAAS,MAAM,MAAM,OAAO,OAAK,EAAE,OAAO,KAAK,EAAE;AACvD,aAAO,iCAAK,QAAL,EAAY,OAAO,CAAC,GAAG,QAAQ,IAAI,EAAE;AAAA,IAC9C;AAAA,IACA,KAAK,aAAa;AAChB,YAAM,EAAE,GAAG,IAAI,OAAO;AACtB,aAAO,iCACF,QADE;AAAA,QAEL,OAAO,MAAM,MAAM,OAAO,OAAK,EAAE,OAAO,EAAE;AAAA,QAC1C,eAAe,MAAM,kBAAkB,KAAK,OAAO,MAAM;AAAA,MAC3D;AAAA,IACF;AAAA,IACA,KAAK,oBAAoB;AACvB,YAAM,EAAE,IAAI,KAAK,IAAI,OAAO;AAC5B,aAAO,iCACF,QADE;AAAA,QAEL,OAAO,MAAM,MAAM,IAAI,OAAM,EAAE,OAAO,KAAK,iCAAK,IAAL,EAAQ,KAAK,KAAI,CAAE;AAAA,MAChE;AAAA,IACF;AAAA,IACA,KAAK,oBAAoB;AACvB,YAAM,EAAE,IAAI,KAAK,IAAI,OAAO;AAC5B,aAAO,iCACF,QADE;AAAA,QAEL,OAAO,MAAM,MAAM,IAAI,OAAM,EAAE,OAAO,KAAK,iCAAK,IAAL,EAAQ,KAAK,KAAI,CAAE;AAAA,MAChE;AAAA,IACF;AAAA,IACA,KAAK,yBAAyB;AAC5B,YAAM,EAAE,IAAI,SAAS,OAAO,IAAI,OAAO;AACvC,aAAO,iCACF,QADE;AAAA,QAEL,OAAO,MAAM,MAAM,IAAI,OAAM,EAAE,OAAO,KAAK,iCAAK,IAAL,EAAQ,SAAS,OAAO,KAAI,CAAE;AAAA,MAC3E;AAAA,IACF;AAAA,IACA,KAAK,oBAAoB;AACvB,YAAM,EAAE,GAAG,IAAI,OAAO;AACtB,aAAO,iCAAK,QAAL,EAAY,eAAe,GAAG;AAAA,IACvC;AAAA,IACA,KAAK;AACH,aAAO,iCAAK,QAAL,EAAY,OAAO,CAAC,GAAG,eAAe,KAAK;AAAA,IACpD;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface VolumeTotals {
|
|
2
|
+
storedGB: number;
|
|
3
|
+
fileCount: number;
|
|
4
|
+
unsizedCount: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MonthlyUploads {
|
|
7
|
+
month: string;
|
|
8
|
+
uploadedGB: number;
|
|
9
|
+
fileCount: number;
|
|
10
|
+
}
|
|
11
|
+
export interface TypeVolume {
|
|
12
|
+
type: string;
|
|
13
|
+
storedGB: number;
|
|
14
|
+
fileCount: number;
|
|
15
|
+
}
|
|
16
|
+
/** What a set of uploaded files adds up to: totals, uploads per `YYYY-MM` month, and storage per file type. */
|
|
17
|
+
export interface VolumeReport {
|
|
18
|
+
totals: VolumeTotals;
|
|
19
|
+
byMonth: MonthlyUploads[];
|
|
20
|
+
byType: TypeVolume[];
|
|
21
|
+
}
|
|
22
|
+
/** One uploader within one organization; `userId` is null for files uploaded before uploads were attributed. */
|
|
23
|
+
export interface UserUsageRow {
|
|
24
|
+
userId: number | null;
|
|
25
|
+
name: string | null;
|
|
26
|
+
email: string | null;
|
|
27
|
+
organizationName: string;
|
|
28
|
+
organizationTitle: string | null;
|
|
29
|
+
storedGB: number;
|
|
30
|
+
fileCount: number;
|
|
31
|
+
lastUploadAt: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface UserUsageReport extends VolumeReport {
|
|
34
|
+
rows: UserUsageRow[];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/core/types/usage.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,+GAA+G;AAC/G,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,MAAM,EAAE,UAAU,EAAE,CAAA;CACrB;AAED,gHAAgH;AAChH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,IAAI,EAAE,YAAY,EAAE,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type CsvCell = string | number | null | undefined;
|
|
2
|
+
/** Quotes when needed and prefixes `'` to text that a spreadsheet would run as a formula. */
|
|
3
|
+
export declare function csvCell(value: CsvCell): string;
|
|
4
|
+
export declare function toCsv(header: readonly string[], rows: readonly CsvCell[][]): string;
|
|
5
|
+
/** Starts a browser download of text; the BOM makes Excel read UTF-8 names correctly. */
|
|
6
|
+
export declare function downloadText(content: string, filename: string, type?: string): void;
|
|
7
|
+
//# sourceMappingURL=csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../src/core/utils/csv.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAExD,6FAA6F;AAC7F,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK9C;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,EAAE,GAAG,MAAM,CAEnF;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,SAA2B,QAO9F"}
|