@cognite/reveal-components 1.0.0 → 1.0.2

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.
Files changed (153) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/poi-markers/poi-create-cursor.js +4 -0
  3. package/dist/common/i18n/en/reveal-components.js +183 -178
  4. package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
  5. package/dist/data-providers/FdmSDK.d.ts +8 -0
  6. package/dist/data-providers/FdmSDK.js +34 -21
  7. package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
  8. package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
  9. package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
  10. package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
  11. package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
  12. package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
  13. package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
  14. package/dist/data-providers/cache/annotationModelUtils.js +8 -6
  15. package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
  16. package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +9 -6
  17. package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
  18. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
  19. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
  20. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
  21. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
  22. package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
  23. package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
  24. package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
  25. package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
  26. package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
  27. package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
  28. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
  29. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
  30. package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
  31. package/dist/data-providers/index.d.ts +2 -1
  32. package/dist/data-providers/index.js +2 -0
  33. package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
  34. package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
  35. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
  36. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
  37. package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
  38. package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
  39. package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
  40. package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
  41. package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
  42. package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
  43. package/dist/domains/index.d.ts +4 -2
  44. package/dist/domains/index.js +3 -1
  45. package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
  46. package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
  47. package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
  48. package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
  49. package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
  50. package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
  51. package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
  52. package/dist/foundation/renderTarget/CdfCaches.js +24 -14
  53. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
  54. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
  55. package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
  56. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
  57. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
  58. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +2 -5
  59. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
  60. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
  61. package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
  62. package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
  63. package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
  64. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
  65. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
  66. package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
  67. package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
  68. package/dist/ui/components/RevealContext/RevealContext.js +6 -6
  69. package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
  70. package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
  71. package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
  72. package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
  73. package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
  74. package/dist/ui/components/Widget/RevealWidget.js +35 -20
  75. package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
  76. package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
  77. package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
  78. package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
  79. package/dist/ui/components/Widget/index.d.ts +1 -1
  80. package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
  81. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
  82. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
  83. package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
  84. package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
  85. package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
  86. package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
  87. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
  88. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
  89. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
  90. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
  91. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
  92. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
  93. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
  94. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
  95. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +27 -13
  96. package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
  97. package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
  98. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
  99. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
  100. package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
  101. package/dist/ui/components/i18n/I18n.js +3 -3
  102. package/dist/ui/components/index.d.ts +1 -1
  103. package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
  104. package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
  105. package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
  106. package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
  107. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
  108. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
  109. package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
  110. package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
  111. package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
  112. package/dist/ui/query/index.d.ts +1 -0
  113. package/dist/ui/query/index.js +17 -16
  114. package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
  115. package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
  116. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
  117. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
  118. package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
  119. package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
  120. package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
  121. package/dist/ui/query/useCadNode3DInfo.js +24 -0
  122. package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
  123. package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
  124. package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
  125. package/dist/ui/query/useInstanceNames.d.ts +11 -0
  126. package/dist/ui/query/useInstanceNames.js +17 -0
  127. package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
  128. package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
  129. package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
  130. package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
  131. package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
  132. package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
  133. package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
  134. package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
  135. package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
  136. package/dist/utilities/externalIndex.d.ts +2 -0
  137. package/dist/utilities/externalIndex.js +3 -1
  138. package/dist/utilities/getInstancesFromClick.js +9 -9
  139. package/dist/utilities/index.d.ts +2 -1
  140. package/dist/utilities/index.js +12 -9
  141. package/dist/utilities/queryKeys.d.ts +2 -0
  142. package/dist/utilities/queryKeys.js +7 -0
  143. package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
  144. package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
  145. package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
  146. package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
  147. package/dist/utilities/usageMetricsTracker.d.ts +4 -0
  148. package/dist/utilities/usageMetricsTracker.js +4 -0
  149. package/package.json +7 -3
  150. package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
  151. package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
  152. package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
  153. package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
@@ -1,37 +1,25 @@
1
- import { isDmsInstance as e, isIdEither as t } from "../../../utilities/instanceIds/typeGuards.js";
1
+ import { createInstanceReferenceKey as e } from "../../../utilities/instanceIds/toKey.js";
2
2
  import "../../../utilities/instanceIds/index.js";
3
- import { COGNITE_DESCRIBABLE_SOURCE as n } from "../../../data-providers/core-dm-provider/dataModels.js";
4
- import { EMPTY_ARRAY as r } from "../../../utilities/constants.js";
5
- import { useAssetsByIdsQuery as i } from "../../query/useAssetsByIdsQuery.js";
6
- import { useDmInstancesByIds as a } from "../../query/useDmsInstanceByIdsQuery.js";
7
- import { useMemo as o } from "react";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
- import { Tooltip as l, TooltipContent as u, TooltipProvider as d, TooltipTrigger as f } from "@cognite/aura/components/tooltip";
10
- import { IconHexagon as p } from "@tabler/icons-react";
11
- import { InputGroup as m, InputGroupAddon as h, InputGroupInput as g } from "@cognite/aura/components/input-group";
3
+ import { useInstanceNames as t } from "../../query/useInstanceNames.js";
4
+ import { useMemo as n } from "react";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ import { Tooltip as a, TooltipContent as o, TooltipProvider as s, TooltipTrigger as c } from "@cognite/aura/components/tooltip";
7
+ import { IconHexagon as l } from "@tabler/icons-react";
8
+ import { InputGroup as u, InputGroupAddon as d, InputGroupInput as f } from "@cognite/aura/components/input-group";
12
9
  //#region libs/shared/reveal-components/src/ui/components/InstanceLabel/InstanceLabel.tsx
13
- var _ = [n], v = 20, y = ({ instance: y }) => {
14
- let [b, x] = o(() => [t(y) ? [y] : r, e(y) ? [y] : r], [y]), { data: S } = i(b), { data: C } = a(x, _), w = o(() => {
15
- if (S !== void 0 || C !== void 0) {
16
- if (S !== void 0 && S.length > 0) return S[0].name;
17
- if (C !== void 0 && C.length > 0) {
18
- let e = `${n.externalId}/${n.version}`;
19
- return C[0].properties.cdf_cdm?.[e]?.name ?? C[0].externalId;
20
- }
21
- return "Unknown";
22
- }
23
- }, [S, C])?.toString(), T = w?.length !== void 0 && w.length > v, E = T ? `${w?.slice(0, v)}...` : w;
24
- return /* @__PURE__ */ s(d, { children: /* @__PURE__ */ c(l, {
25
- open: T ? void 0 : !1,
26
- children: [/* @__PURE__ */ s(f, { render: /* @__PURE__ */ c(m, { children: [/* @__PURE__ */ s(h, {
10
+ var p = 20, m = ({ instance: m }) => {
11
+ let { data: h } = t(n(() => [m], [m])), g = (h?.get(e(m)))?.toString(), _ = g?.length !== void 0 && g.length > p, v = _ ? `${g?.slice(0, p)}...` : g;
12
+ return /* @__PURE__ */ r(s, { children: /* @__PURE__ */ i(a, {
13
+ open: _ ? void 0 : !1,
14
+ children: [/* @__PURE__ */ r(c, { render: /* @__PURE__ */ i(u, { children: [/* @__PURE__ */ r(d, {
27
15
  align: "inline-start",
28
- children: /* @__PURE__ */ s(p, {})
29
- }), /* @__PURE__ */ s(g, {
30
- value: E,
16
+ children: /* @__PURE__ */ r(l, {})
17
+ }), /* @__PURE__ */ r(f, {
18
+ value: v,
31
19
  disabled: !0,
32
20
  readOnly: !0
33
- })] }) }), /* @__PURE__ */ s(u, { children: w })]
34
- }, w) });
21
+ })] }) }), /* @__PURE__ */ r(o, { children: g })]
22
+ }, g) });
35
23
  };
36
24
  //#endregion
37
- export { y as InstanceLabel };
25
+ export { m as InstanceLabel };
@@ -1,33 +1,33 @@
1
- import { EMPTY_ARRAY as e } from "../../../utilities/constants.js";
2
- import { is360ImageEventsAddOptions as t, isDM3DModelIdentifier as n } from "../../../utilities/modelIds/typeGuards.js";
3
- import { convertAndSeparateResources as r, convertAndSeparateToNewResources as i } from "../../../data-providers/types/typeAdapters.js";
4
- import { getModelKeys as a } from "../../../utilities/getModelKeys.js";
1
+ import { is360ImageEventsAddOptions as e, isDM3DModelIdentifier as t } from "../../../utilities/modelIds/typeGuards.js";
2
+ import { convertAndSeparateResources as n, convertAndSeparateToNewResources as r } from "../../../data-providers/types/typeAdapters.js";
3
+ import { getModelKeys as i } from "../../../utilities/getModelKeys.js";
4
+ import { EMPTY_ARRAY as a } from "../../../utilities/constants.js";
5
5
  import { use3DResourcesViewModel as o } from "./Reveal3DResources.viewmodel.js";
6
6
  import { useEffect as s, useMemo as c } from "react";
7
7
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
8
8
  //#region libs/shared/reveal-components/src/ui/components/Reveal3DResources/Reveal3DResources.tsx
9
9
  var f = ({ resources: f, defaultResourceStyling: p, instanceStyling: m, mappedCadStylingMode: h = "base", onResourcesAdded: g, onResourceLoadError: _, onResourceIsLoaded: v, image360Settings: y }) => {
10
- let { CadModelContainer: b, Image360CollectionContainer: x, PointCloudContainer: S, ...C } = o(), w = C.useRenderTarget(), T = C.useReveal(), { modelResources: E, image360Resources: D } = c(() => i(f), [f]), O = c(() => [...E, ...D], [E, D]), { image360Resources: k } = c(() => r(f), [f]), { data: A } = C.useTypedModels(T, O, _), j = c(() => k.map((e) => ({
10
+ let { CadModelContainer: b, Image360CollectionContainer: x, PointCloudContainer: S, ...C } = o(), w = C.useRenderTarget(), T = C.useReveal(), { modelResources: E, image360Resources: D } = c(() => r(f), [f]), O = c(() => [...E, ...D], [E, D]), { image360Resources: k } = c(() => n(f), [f]), { data: A } = C.useTypedModels(T, O, _), j = c(() => k.map((e) => ({
11
11
  ...y,
12
12
  ...e
13
13
  })), [k, y]);
14
- C.useRemoveNonReferencedModels(A ?? e, k, w), C.useSetExpectedLoadCount(O), C.useCallCallbackOnFinishedLoading(O, g);
15
- let M = c(() => A === void 0 ? e : A.filter((e) => e.type === "cad"), [A]), { styledModels: N, isModelMappingsLoading: P } = C.useCalculateCadStyling(M, m ?? e, p, h), F = C.useReveal3DResourcesStylingLoadingSetter();
14
+ C.useRemoveNonReferencedModels(A ?? a, k, w), C.useSetExpectedLoadCount(O), C.useCallCallbackOnFinishedLoading(O, g);
15
+ let M = c(() => A === void 0 ? a : A.filter((e) => e.type === "cad"), [A]), { styledModels: N, isModelMappingsLoading: P } = C.useCalculateCadStyling(M, m ?? a, p, h), F = C.useReveal3DResourcesStylingLoadingSetter();
16
16
  s(() => {
17
17
  F(P);
18
18
  }, [P, F]);
19
- let I = C.useCalculatePointCloudStyling(A ?? e, m ?? e, p), L = C.useCalculateImage360Styling(m);
19
+ let I = C.useCalculatePointCloudStyling(A ?? a, m ?? a, p), L = C.useCalculateImage360Styling(m);
20
20
  return /* @__PURE__ */ d(l, { children: [
21
- N.map(({ styleGroups: e, model: t }, r) => {
21
+ N.map(({ styleGroups: e, model: n }, r) => {
22
22
  let i = {
23
- defaultStyle: t.styling?.default ?? p?.cad?.default,
23
+ defaultStyle: n.styling?.default ?? p?.cad?.default,
24
24
  groups: e
25
- }, a = n(t) ? `${t.revisionExternalId}/${t.revisionSpace}/${r}` : `${t.modelId}/${t.revisionId}/${r}`;
25
+ }, a = t(n) ? `${n.revisionExternalId}/${n.revisionSpace}/${r}` : `${n.modelId}/${n.revisionId}/${r}`;
26
26
  return /* @__PURE__ */ u(b, {
27
- addModelOptions: t,
27
+ addModelOptions: n,
28
28
  styling: i,
29
- transform: t.transform,
30
- defaultVisible: t.defaultVisible,
29
+ transform: n.transform,
30
+ defaultVisible: n.defaultVisible,
31
31
  onLoad: v,
32
32
  onLoadError: _
33
33
  }, a);
@@ -36,7 +36,7 @@ var f = ({ resources: f, defaultResourceStyling: p, instanceStyling: m, mappedCa
36
36
  let r = {
37
37
  defaultStyle: t.styling?.default ?? p?.pointcloud?.default,
38
38
  groups: e
39
- }, i = a([t])[0] + `/${n}`;
39
+ }, a = i([t])[0] + `/${n}`;
40
40
  return /* @__PURE__ */ u(S, {
41
41
  addModelOptions: t,
42
42
  styling: r,
@@ -44,17 +44,17 @@ var f = ({ resources: f, defaultResourceStyling: p, instanceStyling: m, mappedCa
44
44
  transform: t.transform,
45
45
  onLoad: v,
46
46
  onLoadError: _
47
- }, i);
47
+ }, a);
48
48
  }),
49
- j.map((e) => {
49
+ j.map((t) => {
50
50
  let n = {
51
51
  defaultStyle: p?.image360?.default,
52
52
  groups: L
53
- }, r = t(e) ? e.siteId : `${e.externalId}/${e.space}`;
53
+ }, r = e(t) ? t.siteId : `${t.externalId}/${t.space}`;
54
54
  return /* @__PURE__ */ u(x, {
55
- addImage360CollectionOptions: e,
55
+ addImage360CollectionOptions: t,
56
56
  styling: n,
57
- defaultVisible: e.defaultVisible,
57
+ defaultVisible: t.defaultVisible,
58
58
  onLoad: v,
59
59
  onLoadError: _
60
60
  }, r);
@@ -1,16 +1,16 @@
1
1
  import { FdmSDK as e } from "../../../data-providers/FdmSDK.js";
2
- import { FdmSdkContext as t } from "./FdmDataProviderContext.js";
3
- import { FeatureDataLoadPerformanceMetricsContext as n } from "./FeatureDataLoadPerformanceMetricsContext.js";
2
+ import { FeatureDataLoadPerformanceMetricsContext as t } from "./FeatureDataLoadPerformanceMetricsContext.js";
3
+ import { FdmSdkContext as n } from "./FdmDataProviderContext.js";
4
4
  import { createContext as r, useContext as i, useMemo as a } from "react";
5
5
  import { jsx as o } from "react/jsx-runtime";
6
6
  //#region libs/shared/reveal-components/src/ui/components/RevealCanvas/SDKProvider.tsx
7
7
  var s = r(null);
8
- s.displayName = "CogniteSdkProvider", t.displayName = "FdmSdkProvider";
8
+ s.displayName = "CogniteSdkProvider", n.displayName = "FdmSdkProvider";
9
9
  function c({ sdk: r, children: c }) {
10
- let l = i(n), u = a(() => ({ fdmSdk: new e(r, { featureDataLoadPerformanceMetrics: l }) }), [r, l]);
10
+ let l = i(t), u = a(() => ({ fdmSdk: new e(r, { featureDataLoadPerformanceMetrics: l }) }), [r, l]);
11
11
  return /* @__PURE__ */ o(s.Provider, {
12
12
  value: r,
13
- children: /* @__PURE__ */ o(t.Provider, {
13
+ children: /* @__PURE__ */ o(n.Provider, {
14
14
  value: u,
15
15
  children: c
16
16
  })
@@ -24,7 +24,7 @@ var l = (e) => {
24
24
  }
25
25
  return t;
26
26
  }, u = () => {
27
- let e = i(t);
27
+ let e = i(n);
28
28
  if (e === null) throw Error("FdmSdkContext not found, add '<SDKProvider value={sdk}>' around your component/app");
29
29
  return e.fdmSdk;
30
30
  };
@@ -0,0 +1,3 @@
1
+ import { Context } from 'react';
2
+ import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
3
+ export declare const UsageMetricsTrackerContext: Context<UsageMetricsTracker>;
@@ -0,0 +1,6 @@
1
+ import { noopUsageMetricsTracker as e } from "../../../utilities/usageMetricsTracker.js";
2
+ import { createContext as t } from "react";
3
+ //#region libs/shared/reveal-components/src/ui/components/RevealCanvas/UsageMetricsTrackerContext.tsx
4
+ var n = t(e);
5
+ //#endregion
6
+ export { n as UsageMetricsTrackerContext };
@@ -1,5 +1,6 @@
1
1
  import { Context, ReactElement, ReactNode } from 'react';
2
2
  import { DataSourceType, Cognite3DViewer } from '@cognite/reveal';
3
+ import { CdfCaches } from '../../../foundation/renderTarget/CdfCaches';
3
4
  import { RevealRenderTarget } from '../../../foundation/renderTarget/RevealRenderTarget';
4
5
  export declare const ViewerContext: Context<RevealRenderTarget | undefined>;
5
6
  export type ViewerContextProviderProps = {
@@ -8,4 +9,5 @@ export type ViewerContextProviderProps = {
8
9
  };
9
10
  export declare const ViewerContextProvider: ({ renderTarget: value, children, }: ViewerContextProviderProps) => ReactElement;
10
11
  export declare const useReveal: () => Cognite3DViewer<DataSourceType>;
12
+ export declare const useCdfCaches: () => CdfCaches;
11
13
  export declare const useRenderTarget: () => RevealRenderTarget;
@@ -2,22 +2,22 @@ import { createContext as e, useContext as t, useEffect as n } from "react";
2
2
  import { remove as r } from "lodash-es";
3
3
  import { jsx as i } from "react/jsx-runtime";
4
4
  //#region libs/shared/reveal-components/src/ui/components/RevealCanvas/ViewerContext.tsx
5
- var a = e(void 0), o = ({ renderTarget: e, children: t }) => (u(e ?? void 0), l(e ?? void 0), /* @__PURE__ */ i(a.Provider, {
5
+ var a = e(void 0), o = ({ renderTarget: e, children: t }) => (d(e ?? void 0), u(e ?? void 0), /* @__PURE__ */ i(a.Provider, {
6
6
  value: e,
7
7
  children: t
8
- })), s = () => c().viewer, c = () => {
8
+ })), s = () => l().viewer, c = () => l().cdfCaches, l = () => {
9
9
  let e = t(a);
10
10
  if (e === void 0) throw Error("useRenderTarget must be used within a ViewerProvider");
11
11
  return e;
12
12
  };
13
- function l(e) {
13
+ function u(e) {
14
14
  n(() => {
15
15
  if (e !== void 0) return window.renderTargets === void 0 ? window.renderTargets = [e] : window.renderTargets.push(e), () => {
16
16
  window.renderTargets !== void 0 && r(window.renderTargets, (t) => t === e);
17
17
  };
18
18
  }, [e]);
19
19
  }
20
- function u(e) {
20
+ function d(e) {
21
21
  n(() => {
22
22
  if (e !== void 0 && window.renderTarget === void 0 && window.viewer === void 0) return window.renderTarget = e, window.viewer = e.viewer, () => {
23
23
  window.renderTarget?.viewer === e.viewer && (window.viewer = void 0), window.renderTarget === e && (window.renderTarget = void 0);
@@ -25,4 +25,4 @@ function u(e) {
25
25
  }, [e]);
26
26
  }
27
27
  //#endregion
28
- export { a as ViewerContext, o as ViewerContextProvider, c as useRenderTarget, s as useReveal };
28
+ export { a as ViewerContext, o as ViewerContextProvider, c as useCdfCaches, l as useRenderTarget, s as useReveal };
@@ -1,9 +1,9 @@
1
1
  import { ViewerContextProvider as e } from "../RevealCanvas/ViewerContext.js";
2
2
  import { I18nContextProvider as t } from "../i18n/I18n.js";
3
3
  import { Reveal3DResourcesInfoContextProvider as n } from "../Reveal3DResources/Reveal3DResourcesInfoContext.js";
4
- import { FeatureDataLoadPerformanceMetricsContext as r } from "../RevealCanvas/FeatureDataLoadPerformanceMetricsContext.js";
5
- import { SDKProvider as i } from "../RevealCanvas/SDKProvider.js";
6
- import { ComponentFactoryContextProvider as a } from "../RevealCanvas/ComponentFactoryContext.js";
4
+ import { ComponentFactoryContextProvider as r } from "../RevealCanvas/ComponentFactoryContext.js";
5
+ import { FeatureDataLoadPerformanceMetricsContext as i } from "../RevealCanvas/FeatureDataLoadPerformanceMetricsContext.js";
6
+ import { SDKProvider as a } from "../RevealCanvas/SDKProvider.js";
7
7
  import { useRevealKeepAlive as o } from "../RevealKeepAlive/RevealKeepAliveContext.js";
8
8
  import { LoadedSceneProvider as s } from "../SceneContainer/LoadedSceneContext.js";
9
9
  import { RevealContextDepsContext as c } from "./RevealContext.context.js";
@@ -13,15 +13,15 @@ import { QueryClient as g, QueryClientProvider as _ } from "@tanstack/react-quer
13
13
  //#region libs/shared/reveal-components/src/ui/components/RevealContext/RevealContext.tsx
14
14
  var v = (o) => {
15
15
  let c = b(o), l = d(() => new g({ defaultOptions: { queries: { refetchOnWindowFocus: !1 } } }), []);
16
- return c === null ? /* @__PURE__ */ m(p, {}) : /* @__PURE__ */ m(r.Provider, {
16
+ return c === null ? /* @__PURE__ */ m(p, {}) : /* @__PURE__ */ m(i.Provider, {
17
17
  value: o.featureDataLoadPerformanceMetrics,
18
- children: /* @__PURE__ */ m(i, {
18
+ children: /* @__PURE__ */ m(a, {
19
19
  sdk: o.sdk,
20
20
  children: /* @__PURE__ */ m(_, {
21
21
  client: l,
22
22
  children: /* @__PURE__ */ m(t, {
23
23
  appLanguage: o.appLanguage,
24
- children: /* @__PURE__ */ m(s, { children: /* @__PURE__ */ m(a, { children: /* @__PURE__ */ h(e, {
24
+ children: /* @__PURE__ */ m(s, { children: /* @__PURE__ */ m(r, { children: /* @__PURE__ */ h(e, {
25
25
  renderTarget: c,
26
26
  children: [/* @__PURE__ */ m(y, {
27
27
  cameraState: o.cameraState,
@@ -23,7 +23,7 @@ var p = {
23
23
  return /* @__PURE__ */ o(u, { children: /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ o(d, { render: /* @__PURE__ */ o(f, {
24
24
  variant: S,
25
25
  size: "icon-sm",
26
- "aria-label": "Reset camera to home",
26
+ "aria-label": h(x),
27
27
  onClick: E,
28
28
  children: /* @__PURE__ */ o(t, {
29
29
  iconName: "AssetsIcon",
@@ -1,11 +1,11 @@
1
1
  import { createFdmKey as e } from "../../../../data-providers/cache/idAndKeyTranslation.js";
2
2
  import { restrictToDmsId as t } from "../../../../utilities/restrictToDmsId.js";
3
- import { executeParallel as n } from "../../../../utilities/executeParallel.js";
3
+ import { queryKeys as n } from "../../../../utilities/queryKeys.js";
4
4
  import { isDefined as r } from "../../../../utilities/isDefined.js";
5
- import { inspectNodes as i } from "../../../../data-providers/cache/requests.js";
6
- import { EMPTY_ARRAY as a } from "../../../../utilities/constants.js";
7
- import { queryKeys as o } from "../../../../utilities/queryKeys.js";
8
5
  import "../../../../data-providers/cache/index.js";
6
+ import { executeParallel as i } from "../../../../utilities/executeParallel.js";
7
+ import { inspectNodes as a } from "../../../../data-providers/cache/requests.js";
8
+ import { EMPTY_ARRAY as o } from "../../../../utilities/constants.js";
9
9
  import { UseGetDMConnectionWithNodeFromHybridMappingsQueryContext as s } from "./useGetDMConnectionWithNodeFromHybridMappingsQuery.context.js";
10
10
  import { useContext as c, useMemo as l } from "react";
11
11
  import { uniqBy as u } from "lodash-es";
@@ -14,16 +14,16 @@ import { useQuery as d } from "@tanstack/react-query";
14
14
  function f(e, t) {
15
15
  let { useClassicCadAssetMappingCache: f, useFdmSdk: h } = c(s), g = f(), _ = h(), v = l(() => e.map((e) => e.instanceId).filter(r), [e]);
16
16
  return d({
17
- queryKey: o.fdmConnectionWithNode(v, t),
17
+ queryKey: n.fdmConnectionWithNode(v, t),
18
18
  queryFn: async () => {
19
- if (v.length === 0 || t.length === 0) return a;
20
- let e = await i(_, v);
21
- if (e.items.length === 0) return a;
22
- let o = await n(t.map(({ modelId: t, revisionId: n }) => async () => {
19
+ if (v.length === 0 || t.length === 0) return o;
20
+ let e = await a(_, v);
21
+ if (e.items.length === 0) return o;
22
+ let n = await i(t.map(({ modelId: t, revisionId: n }) => async () => {
23
23
  let r = await g.getNodesForInstanceIds(t, n, v);
24
- return r.size === 0 ? a : m(e, r, t, n);
24
+ return r.size === 0 ? o : m(e, r, t, n);
25
25
  }), 2);
26
- return u(o.filter(r).flat(), p);
26
+ return u(n.filter(r).flat(), p);
27
27
  },
28
28
  enabled: v.length > 0 && t.length > 0,
29
29
  staleTime: Infinity
@@ -1,9 +1,10 @@
1
1
  import { Context } from 'react';
2
2
  import { RevealRenderTarget } from '../../../domains';
3
+ import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
3
4
  import { RevealCanvas, useRenderTarget } from '../RevealCanvas';
4
5
  import { RevealContext } from '../RevealContext';
5
6
  import { RevealWidgetController } from './RevealWidgetController';
6
- type RevealWidgetFactory = (renderTarget: RevealRenderTarget) => RevealWidgetController;
7
+ type RevealWidgetFactory = (renderTarget: RevealRenderTarget, usageMetricsTracker: UsageMetricsTracker) => RevealWidgetController;
7
8
  export type RevealWidgetDependencies = {
8
9
  createRevealWidgetController: RevealWidgetFactory;
9
10
  RevealCanvas: typeof RevealCanvas;
@@ -7,7 +7,7 @@ import { RevealWidgetController as r } from "./RevealWidgetController.js";
7
7
  import { createContext as i } from "react";
8
8
  //#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidget.context.ts
9
9
  var a = {
10
- createRevealWidgetController: (e) => new r(e),
10
+ createRevealWidgetController: (e, t) => new r(e, void 0, t),
11
11
  RevealCanvas: t,
12
12
  RevealContext: n,
13
13
  useRenderTarget: e
@@ -1,6 +1,8 @@
1
1
  import { PropsWithChildren, ReactElement } from 'react';
2
2
  import { Cognite3DViewerOptions } from '@cognite/reveal';
3
3
  import { RevealWidgetController } from './RevealWidgetController';
4
+ import { RevealWidgetTrackingProps } from './useRevealWidgetMetricsTracking';
5
+ export type { RevealWidgetTrackingProps };
4
6
  /**
5
7
  * React-properties for the RevealWidget
6
8
  */
@@ -25,12 +27,19 @@ export type RevealWidgetProps = {
25
27
  * The widget calls this with `undefined` when the component unmounts or this callback changes
26
28
  */
27
29
  setControllerRef?: (controller: RevealWidgetController | undefined) => void;
30
+ /**
31
+ * Reports which application is using the widget and which of its features are being triggered
32
+ * (e.g. adding a resource, moving the camera). See `RevealWidgetTrackingProps` for the options.
33
+ */
34
+ tracking?: RevealWidgetTrackingProps;
35
+ /** Identifies the host application */
36
+ appIdentifier: string;
28
37
  };
29
38
  /**
30
39
  * RevealWidget component - the React entry point for the Reveal Widget.
31
40
  * An example with some custom UI components:
32
41
  * ```
33
- * <RevealWidget setControllerRef={setControllerRef} viewerOptions={{ sdk, useCoreDm: true }}>
42
+ * <RevealWidget setControllerRef={setControllerRef} viewerOptions={{ sdk, useCoreDm: true }} appIdentifier="YourAppId">
34
43
  * <RevealToolbar
35
44
  * toolBarContent={
36
45
  * <CommandButtons
@@ -59,4 +68,4 @@ export type RevealWidgetProps = {
59
68
  * }, []);
60
69
  * ```
61
70
  */
62
- export declare function RevealWidget({ viewerOptions, setControllerRef, children, }: PropsWithChildren<RevealWidgetProps>): ReactElement;
71
+ export declare function RevealWidget({ viewerOptions, setControllerRef, tracking, appIdentifier, children, }: PropsWithChildren<RevealWidgetProps>): ReactElement;
@@ -1,31 +1,46 @@
1
1
  import { ToolUI as e } from "../commandBased/main/ToolUI.js";
2
2
  import "../commandBased/index.js";
3
- import { RevealWidgetContext as t } from "./RevealWidget.context.js";
4
- import { useContext as n, useEffect as r, useMemo as i } from "react";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import { UsageMetricsTrackerContext as t } from "../RevealCanvas/UsageMetricsTrackerContext.js";
4
+ import { RevealWidgetContext as n } from "./RevealWidget.context.js";
5
+ import { useRevealWidgetMetricsTracking as r } from "./useRevealWidgetMetricsTracking.js";
6
+ import { useContext as i, useEffect as a, useMemo as o, useRef as s } from "react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
8
  //#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidget.tsx
7
- function s({ viewerOptions: e, setControllerRef: r, children: i }) {
8
- let { RevealContext: o } = n(t);
9
- if ("inheritFromRevealContext" in e) return /* @__PURE__ */ a(c, {
10
- setControllerRef: r,
11
- children: i
9
+ function u({ viewerOptions: e, setControllerRef: t, tracking: a, appIdentifier: o, children: s }) {
10
+ let { RevealContext: l } = i(n), u = r(o, a);
11
+ if ("inheritFromRevealContext" in e) return /* @__PURE__ */ c(d, {
12
+ setControllerRef: t,
13
+ usageMetricsTracker: u,
14
+ children: s
12
15
  });
13
16
  {
14
- let { sdk: t, useCoreDm: n, ...s } = e;
15
- return /* @__PURE__ */ a(o, {
16
- viewerOptions: s,
17
- sdk: t,
18
- useCoreDm: n,
19
- children: /* @__PURE__ */ a(c, {
20
- setControllerRef: r,
21
- children: i
17
+ let { sdk: n, useCoreDm: r, ...i } = e;
18
+ return /* @__PURE__ */ c(l, {
19
+ viewerOptions: i,
20
+ sdk: n,
21
+ useCoreDm: r,
22
+ children: /* @__PURE__ */ c(d, {
23
+ setControllerRef: t,
24
+ usageMetricsTracker: u,
25
+ children: s
22
26
  })
23
27
  });
24
28
  }
25
29
  }
26
- function c({ setControllerRef: s, children: c }) {
27
- let { createRevealWidgetController: l, RevealCanvas: u, useRenderTarget: d } = n(t), f = d(), p = i(() => l(f), [f, l]);
28
- return r(() => (s?.(p), () => s?.(void 0)), [s, p]), /* @__PURE__ */ o(u, { children: [c, /* @__PURE__ */ a(e, {})] });
30
+ function d({ setControllerRef: r, usageMetricsTracker: u, children: d }) {
31
+ let { createRevealWidgetController: f, RevealCanvas: p, useRenderTarget: m } = i(n), h = m(), g = s(u);
32
+ a(() => {
33
+ g.current = u;
34
+ }, [u]);
35
+ let _ = o(() => ({ track: (e, t) => g.current.track(e, t) }), []), v = o(() => f(h, _), [
36
+ h,
37
+ f,
38
+ _
39
+ ]);
40
+ return a(() => (r?.(v), () => r?.(void 0)), [r, v]), /* @__PURE__ */ c(t.Provider, {
41
+ value: _,
42
+ children: /* @__PURE__ */ l(p, { children: [d, /* @__PURE__ */ c(e, {})] })
43
+ });
29
44
  }
30
45
  //#endregion
31
- export { s as RevealWidget };
46
+ export { u as RevealWidget };
@@ -1,12 +1,14 @@
1
1
  import { CameraState } from '@cognite/reveal';
2
2
  import { RevealDomainObject, RevealRenderTarget } from '../../../domains';
3
+ import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
3
4
  /**
4
5
  * Controller class for simple camera manipulation in
5
6
  * the RevealWidget
6
7
  */
7
8
  export declare class RevealWidgetCameraController {
8
9
  private _renderTarget;
9
- constructor(_renderTarget: RevealRenderTarget);
10
+ private readonly _usageMetricsTracker;
11
+ constructor(_renderTarget: RevealRenderTarget, _usageMetricsTracker?: UsageMetricsTracker);
10
12
  /**
11
13
  * Focus all visible models in the scene
12
14
  */
@@ -1,27 +1,29 @@
1
- import { enterNearby360Image as e } from "../../../utilities/navigation/enterNearby360Image.js";
1
+ import { noopUsageMetricsTracker as e } from "../../../utilities/usageMetricsTracker.js";
2
+ import { enterNearby360Image as t } from "../../../utilities/navigation/enterNearby360Image.js";
2
3
  import "../../../utilities/navigation/index.js";
3
- import { CDF_TO_VIEWER_TRANSFORMATION as t } from "@cognite/reveal";
4
+ import { CDF_TO_VIEWER_TRANSFORMATION as n } from "@cognite/reveal";
4
5
  //#region libs/shared/reveal-components/src/ui/components/Widget/RevealWidgetCameraController.ts
5
- var n = class {
6
+ var r = class {
6
7
  _renderTarget;
7
- constructor(e) {
8
- this._renderTarget = e;
8
+ _usageMetricsTracker;
9
+ constructor(t, n = e) {
10
+ this._renderTarget = t, this._usageMetricsTracker = n;
9
11
  }
10
12
  focusCameraAll() {
11
- this._renderTarget.fitView();
13
+ this._usageMetricsTracker.track("reveal-widget.camera.focusCameraAll"), this._renderTarget.fitView();
12
14
  }
13
15
  focusModel(e) {
14
- this._renderTarget.viewer.fitCameraToBoundingBox(e.getBoundingBox().applyMatrix4(t));
16
+ this._usageMetricsTracker.track("reveal-widget.camera.focusModel"), this._renderTarget.viewer.fitCameraToBoundingBox(e.getBoundingBox().applyMatrix4(n));
15
17
  }
16
18
  getCameraState() {
17
19
  return this._renderTarget.viewer.cameraManager.getCameraState();
18
20
  }
19
21
  setCameraState(e) {
20
- return this._renderTarget.viewer.cameraManager.setCameraState(e);
22
+ return this._usageMetricsTracker.track("reveal-widget.camera.setCameraState"), this._renderTarget.viewer.cameraManager.setCameraState(e);
21
23
  }
22
24
  enterNearby360Image() {
23
- return e(this._renderTarget.viewer);
25
+ return this._usageMetricsTracker.track("reveal-widget.camera.enterNearby360Image"), t(this._renderTarget.viewer);
24
26
  }
25
27
  };
26
28
  //#endregion
27
- export { n as RevealWidgetCameraController };
29
+ export { r as RevealWidgetCameraController };
@@ -8,6 +8,7 @@ import { RevealDomainObjectUtils } from '../../../domains/reveal/RevealDomainObj
8
8
  import { SceneDomainObject } from '../../../domains/scene/SceneDomainObject';
9
9
  import { InstanceId } from '../../../utilities/instanceIds';
10
10
  import { InstanceStylingGroup } from '../../../utilities/modelIds';
11
+ import { UsageMetricsTracker } from '../../../utilities/usageMetricsTracker';
11
12
  import { RevealWidgetCameraController } from './RevealWidgetCameraController';
12
13
  import { applyCadDefaultStyling } from './styling/applyCadDefaultStyling';
13
14
  import { applyPointCloudDefaultStyling } from './styling/applyPointCloudDefaultStyling';
@@ -28,8 +29,9 @@ export declare const defaultRevealWidgetControllerDependencies: RevealWidgetCont
28
29
  export declare class RevealWidgetController {
29
30
  private readonly _renderTarget;
30
31
  private readonly _dependencies;
32
+ private readonly _usageMetricsTracker;
31
33
  private readonly _cameraController;
32
- constructor(_renderTarget: RevealRenderTarget, _dependencies?: RevealWidgetControllerDependencies);
34
+ constructor(_renderTarget: RevealRenderTarget, _dependencies?: RevealWidgetControllerDependencies, _usageMetricsTracker?: UsageMetricsTracker);
33
35
  /**
34
36
  * Access the RevealWidgetCameraController for camera controls
35
37
  */