@itwin/reports-config-widget-react 0.6.0 → 0.7.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.
Files changed (116) hide show
  1. package/CHANGELOG.json +30 -1
  2. package/CHANGELOG.md +15 -2
  3. package/api/reports-config-widget-react.api.md +11 -15
  4. package/api/reports-config-widget-react.exports.csv +1 -1
  5. package/api/temp/reports-config-widget-react.api.md +11 -15
  6. package/coverage/clover.xml +133 -134
  7. package/coverage/coverage-final.json +9 -9
  8. package/coverage/lcov-report/index.html +14 -14
  9. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +2 -2
  10. package/coverage/lcov-report/src/index.html +1 -1
  11. package/coverage/lcov-report/src/test/index.html +1 -1
  12. package/coverage/lcov-report/src/test/test-utils.tsx.html +1 -1
  13. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +11 -26
  14. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +1 -1
  15. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +3 -3
  16. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +7 -10
  17. package/coverage/lcov-report/src/widget/components/Constants.ts.html +1 -1
  18. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +1 -1
  19. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +1 -1
  20. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +1 -1
  21. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +1 -1
  22. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +1 -1
  23. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +1 -1
  24. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
  25. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +1 -1
  26. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +1 -1
  27. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +3 -3
  28. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +1 -1
  29. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +1 -1
  30. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +15 -15
  31. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +1 -1
  32. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +4 -4
  33. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +6 -6
  34. package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +112 -13
  35. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +8 -17
  36. package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +1 -1
  37. package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +1 -1
  38. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +1 -1
  39. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +1 -1
  40. package/coverage/lcov-report/src/widget/components/index.html +1 -1
  41. package/coverage/lcov-report/src/widget/components/utils.tsx.html +1 -1
  42. package/coverage/lcov-report/src/widget/context/BulkExtractorContext.tsx.html +1 -1
  43. package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +7 -4
  44. package/coverage/lcov-report/src/widget/context/index.html +1 -1
  45. package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
  46. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +1 -1
  47. package/coverage/lcov-report/src/widget/index.html +13 -13
  48. package/coverage/lcov.info +240 -242
  49. package/lib/cjs/reports-config-widget-react.d.ts +1 -0
  50. package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
  51. package/lib/cjs/reports-config-widget-react.js +1 -0
  52. package/lib/cjs/reports-config-widget-react.js.map +1 -1
  53. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  54. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +3 -4
  55. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  56. package/lib/cjs/widget/ReportsConfigUiProvider.js +3 -4
  57. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
  58. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  59. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  60. package/lib/cjs/widget/components/BulkExtractor.d.ts +2 -2
  61. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  62. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  63. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  64. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  65. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  66. package/lib/cjs/widget/components/Reports.js.map +1 -1
  67. package/lib/cjs/widget/components/ReportsConfigContext.d.ts +26 -4
  68. package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -1
  69. package/lib/cjs/widget/components/ReportsConfigContext.js +15 -5
  70. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
  71. package/lib/cjs/widget/components/ReportsContainer.d.ts +3 -6
  72. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
  73. package/lib/cjs/widget/components/ReportsContainer.js +6 -2
  74. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  75. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +3 -3
  76. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  77. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -1
  78. package/lib/esm/reports-config-widget-react.d.ts +1 -0
  79. package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
  80. package/lib/esm/reports-config-widget-react.js +1 -0
  81. package/lib/esm/reports-config-widget-react.js.map +1 -1
  82. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  83. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +3 -4
  84. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  85. package/lib/esm/widget/ReportsConfigUiProvider.js +3 -4
  86. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
  87. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  88. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  89. package/lib/esm/widget/components/BulkExtractor.d.ts +2 -2
  90. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  91. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  92. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  93. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  94. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  95. package/lib/esm/widget/components/Reports.js.map +1 -1
  96. package/lib/esm/widget/components/ReportsConfigContext.d.ts +26 -4
  97. package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -1
  98. package/lib/esm/widget/components/ReportsConfigContext.js +15 -5
  99. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
  100. package/lib/esm/widget/components/ReportsContainer.d.ts +3 -6
  101. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
  102. package/lib/esm/widget/components/ReportsContainer.js +6 -2
  103. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  104. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +3 -3
  105. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  106. package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -1
  107. package/package.json +1 -1
  108. package/src/reports-config-widget-react.ts +1 -0
  109. package/src/widget/ReportsConfigUiProvider.tsx +3 -8
  110. package/src/widget/components/AddMappingsModal.tsx +2 -2
  111. package/src/widget/components/BulkExtractor.ts +5 -6
  112. package/src/widget/components/ReportMappings.tsx +3 -3
  113. package/src/widget/components/Reports.tsx +2 -2
  114. package/src/widget/components/ReportsConfigContext.tsx +42 -9
  115. package/src/widget/components/ReportsContainer.tsx +5 -8
  116. package/src/widget/context/ReportsConfigApiContext.tsx +3 -2
@@ -1,3 +1,7 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
1
5
  import React, { useCallback, useState } from "react";
2
6
  import "./ReportsContainer.scss";
3
7
  import { useActiveIModelConnection } from "@itwin/appui-react";
@@ -10,7 +14,7 @@ export var RouteStep;
10
14
  RouteStep[RouteStep["ReportAction"] = 1] = "ReportAction";
11
15
  RouteStep[RouteStep["ReportMappings"] = 2] = "ReportMappings";
12
16
  })(RouteStep || (RouteStep = {}));
13
- const ReportsContainer = ({ getAccessToken, baseUrl }) => {
17
+ const ReportsContainer = (props) => {
14
18
  const [routingHistory, setRoutingHistory] = useState([{ step: RouteStep.ReportsList, title: "iTwin Reports", reportsRoutingFields: {} }]);
15
19
  const currentRoute = routingHistory[routingHistory.length - 1];
16
20
  const iTwinId = useActiveIModelConnection()?.iTwinId ?? "";
@@ -22,7 +26,7 @@ const ReportsContainer = ({ getAccessToken, baseUrl }) => {
22
26
  updatedRouting.pop();
23
27
  setRoutingHistory(updatedRouting);
24
28
  }, [routingHistory]);
25
- return (React.createElement(ReportsConfigContext, { getAccessToken: getAccessToken, baseUrl: baseUrl, iTwinId: iTwinId },
29
+ return (React.createElement(ReportsConfigContext, { ...props, iTwinId: iTwinId },
26
30
  React.createElement("div", { className: "rcw-reports-container" },
27
31
  React.createElement(ReportsHeader, { goBack: goBack, currentRoute: currentRoute }),
28
32
  React.createElement(ReportsRouter, { currentRoute: currentRoute, navigateTo: navigateTo, goBack: goBack }))));
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,uDAAW,CAAA;IACX,yDAAY,CAAA;IACZ,6DAAc,CAAA;AAChB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAYD,MAAM,gBAAgB,GAAG,CAAC,EAAE,cAAc,EAAE,OAAO,EAAyB,EAAE,EAAE;IAC9E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAU,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACnJ,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,yBAAyB,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,OAA2C,EAAE,EAAE;QAC7E,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,MAAM,cAAc,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC;QAC3C,cAAc,CAAC,GAAG,EAAE,CAAC;QACrB,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,oBAAC,oBAAoB,IAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;QACtF,6BAAK,SAAS,EAAC,uBAAuB;YACpC,oBAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAI;YAC7D,oBAAC,aAAa,IAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAI,CACjF,CACe,CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport React, { useCallback, useState } from \"react\";\nimport \"./ReportsContainer.scss\";\nimport type { Report } from \"@itwin/insights-client\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { ReportsHeader } from \"./ReportsHeader\";\nimport { ReportsRouter } from \"./ReportsRouter\";\nimport { ReportsConfigContext } from \"./ReportsConfigContext\";\n\ninterface ReportsContainerProps {\n getAccessToken?: () => Promise<AccessToken>;\n baseUrl: string;\n}\n\nexport enum RouteStep {\n ReportsList,\n ReportAction,\n ReportMappings,\n}\n\nexport interface ReportsRouteFields {\n report?: Report;\n}\n\nexport interface Route {\n step: RouteStep;\n title: string;\n reportsRoutingFields: ReportsRouteFields;\n}\n\nconst ReportsContainer = ({ getAccessToken, baseUrl }: ReportsContainerProps) => {\n const [routingHistory, setRoutingHistory] = useState<Route[]>([{ step: RouteStep.ReportsList, title: \"iTwin Reports\", reportsRoutingFields: {} }]);\n const currentRoute = routingHistory[routingHistory.length - 1];\n const iTwinId = useActiveIModelConnection()?.iTwinId ?? \"\";\n const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {\n setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);\n }, []);\n\n const goBack = useCallback(() => {\n const updatedRouting = [...routingHistory];\n updatedRouting.pop();\n setRoutingHistory(updatedRouting);\n }, [routingHistory]);\n\n return (\n <ReportsConfigContext getAccessToken={getAccessToken} baseUrl={baseUrl} iTwinId={iTwinId}>\n <div className=\"rcw-reports-container\">\n <ReportsHeader goBack={goBack} currentRoute={currentRoute} />\n <ReportsRouter currentRoute={currentRoute} navigateTo={navigateTo} goBack={goBack} />\n </div>\n </ReportsConfigContext>\n );\n};\n\nexport default ReportsContainer;\n"]}
1
+ {"version":3,"file":"ReportsContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAI7D,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,uDAAW,CAAA;IACX,yDAAY,CAAA;IACZ,6DAAc,CAAA;AAChB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAYD,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAU,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACnJ,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,yBAAyB,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,OAA2C,EAAE,EAAE;QAC7E,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,MAAM,cAAc,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC;QAC3C,cAAc,CAAC,GAAG,EAAE,CAAC;QACrB,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,oBAAC,oBAAoB,OAAK,KAAK,EAAE,OAAO,EAAE,OAAO;QAC/C,6BAAK,SAAS,EAAC,uBAAuB;YACpC,oBAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAI;YAC7D,oBAAC,aAAa,IAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAI,CACjF,CACe,CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useCallback, useState } from \"react\";\nimport \"./ReportsContainer.scss\";\nimport type { Report } from \"@itwin/insights-client\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { ReportsHeader } from \"./ReportsHeader\";\nimport { ReportsRouter } from \"./ReportsRouter\";\nimport type { ReportsConfigContextProps } from \"./ReportsConfigContext\";\nimport { ReportsConfigContext } from \"./ReportsConfigContext\"\n\nexport type ReportsContainerProps = Omit<ReportsConfigContextProps, \"iTwinId\" | \"children\">;\n\nexport enum RouteStep {\n ReportsList,\n ReportAction,\n ReportMappings,\n}\n\nexport interface ReportsRouteFields {\n report?: Report;\n}\n\nexport interface Route {\n step: RouteStep;\n title: string;\n reportsRoutingFields: ReportsRouteFields;\n}\n\nconst ReportsContainer = (props: ReportsContainerProps) => {\n const [routingHistory, setRoutingHistory] = useState<Route[]>([{ step: RouteStep.ReportsList, title: \"iTwin Reports\", reportsRoutingFields: {} }]);\n const currentRoute = routingHistory[routingHistory.length - 1];\n const iTwinId = useActiveIModelConnection()?.iTwinId ?? \"\";\n const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {\n setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);\n }, []);\n\n const goBack = useCallback(() => {\n const updatedRouting = [...routingHistory];\n updatedRouting.pop();\n setRoutingHistory(updatedRouting);\n }, [routingHistory]);\n\n return (\n <ReportsConfigContext {...props} iTwinId={iTwinId}>\n <div className=\"rcw-reports-container\">\n <ReportsHeader goBack={goBack} currentRoute={currentRoute} />\n <ReportsRouter currentRoute={currentRoute} navigateTo={navigateTo} goBack={goBack} />\n </div>\n </ReportsConfigContext>\n );\n};\n\nexport default ReportsContainer;\n"]}
@@ -1,14 +1,14 @@
1
1
  import type { AccessToken } from "@itwin/core-bentley";
2
2
  import { IModelsClient } from "@itwin/imodels-client-management";
3
- import { MappingsClient, ReportsClient } from "@itwin/insights-client";
3
+ import type { IMappingsClient, IReportsClient } from "@itwin/insights-client";
4
4
  import * as React from "react";
5
5
  export declare type GetAccessTokenFn = () => Promise<AccessToken>;
6
6
  export interface ReportsConfigApiProps {
7
7
  getAccessToken: GetAccessTokenFn;
8
8
  iTwinId: string;
9
9
  baseUrl: string;
10
- reportsClient: ReportsClient;
11
- mappingsClient: MappingsClient;
10
+ reportsClient: IReportsClient;
11
+ mappingsClient: IMappingsClient;
12
12
  iModelsClient: IModelsClient;
13
13
  }
14
14
  export declare const ReportsConfigApiContext: React.Context<ReportsConfigApiProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsConfigApiContext.d.ts","sourceRoot":"","sources":["../../../../src/widget/context/ReportsConfigApiContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,oBAAY,gBAAgB,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,gBAAgB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,eAAO,MAAM,uBAAuB,sCAOlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,6BAM/B,CAAC"}
1
+ {"version":3,"file":"ReportsConfigApiContext.d.ts","sourceRoot":"","sources":["../../../../src/widget/context/ReportsConfigApiContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,oBAAY,gBAAgB,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,gBAAgB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,cAAc,CAAC;IAC9B,cAAc,EAAE,eAAe,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,eAAO,MAAM,uBAAuB,sCAOlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,6BAM/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsConfigApiContext.js","sourceRoot":"","sources":["../../../../src/widget/context/ReportsConfigApiContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAatC,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAwB;IAC1E,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;IAC9B,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,IAAI,aAAa,EAAE;IAClC,cAAc,EAAE,IAAI,cAAc,EAAE;IACpC,aAAa,EAAE,IAAI,aAAa,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;KACjG;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { IModelsClient } from \"@itwin/imodels-client-management\";\nimport { MappingsClient, ReportsClient } from \"@itwin/insights-client\";\nimport * as React from \"react\";\nimport { createContext } from \"react\";\n\nexport type GetAccessTokenFn = () => Promise<AccessToken>;\n\nexport interface ReportsConfigApiProps {\n getAccessToken: GetAccessTokenFn;\n iTwinId: string;\n baseUrl: string;\n reportsClient: ReportsClient;\n mappingsClient: MappingsClient;\n iModelsClient: IModelsClient;\n}\n\nexport const ReportsConfigApiContext = createContext<ReportsConfigApiProps>({\n getAccessToken: async () => \"\",\n iTwinId: \"\",\n baseUrl: \"\",\n reportsClient: new ReportsClient(),\n mappingsClient: new MappingsClient(),\n iModelsClient: new IModelsClient(),\n});\n\nexport const useReportsConfigApi = () => {\n const context = React.useContext(ReportsConfigApiContext);\n if (!context) {\n throw new Error(\"useReportsConfigApi should be used within a ReportsConfigApiContext provider\");\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"ReportsConfigApiContext.js","sourceRoot":"","sources":["../../../../src/widget/context/ReportsConfigApiContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAatC,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAwB;IAC1E,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE;IAC9B,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,IAAI,aAAa,EAAE;IAClC,cAAc,EAAE,IAAI,cAAc,EAAE;IACpC,aAAa,EAAE,IAAI,aAAa,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;KACjG;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { IMappingsClient, IReportsClient } from \"@itwin/insights-client\";\nimport { MappingsClient, ReportsClient } from \"@itwin/insights-client\";\nimport * as React from \"react\";\nimport { createContext } from \"react\";\n\nexport type GetAccessTokenFn = () => Promise<AccessToken>;\n\nexport interface ReportsConfigApiProps {\n getAccessToken: GetAccessTokenFn;\n iTwinId: string;\n baseUrl: string;\n reportsClient: IReportsClient;\n mappingsClient: IMappingsClient;\n iModelsClient: IModelsClient;\n}\n\nexport const ReportsConfigApiContext = createContext<ReportsConfigApiProps>({\n getAccessToken: async () => \"\",\n iTwinId: \"\",\n baseUrl: \"\",\n reportsClient: new ReportsClient(),\n mappingsClient: new MappingsClient(),\n iModelsClient: new IModelsClient(),\n});\n\nexport const useReportsConfigApi = () => {\n const context = React.useContext(ReportsConfigApiContext);\n if (!context) {\n throw new Error(\"useReportsConfigApi should be used within a ReportsConfigApiContext provider\");\n }\n return context;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/reports-config-widget-react",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -5,6 +5,7 @@
5
5
  /** UI Provider for iTwin Viewer Applications */
6
6
  export * from "./widget/ReportsConfigUiProvider";
7
7
  export * from "./ReportsConfigWidget";
8
+ export * from "@itwin/insights-client";
8
9
 
9
10
  export { Reports, ReportsProps } from "./widget/components/Reports";
10
11
  export { ReportMappings, ReportMappingsProps } from "./widget/components/ReportMappings";
@@ -4,10 +4,10 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import type { UiItemsProvider, Widget } from "@itwin/appui-react";
6
6
  import { StagePanelLocation, StagePanelSection, StageUsage } from "@itwin/appui-react";
7
- import type { AccessToken } from "@itwin/core-bentley";
8
7
 
9
8
  import * as React from "react";
10
9
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
10
+ import type { ReportsContainerProps } from "./components/ReportsContainer";
11
11
  import ReportsContainer from "./components/ReportsContainer";
12
12
 
13
13
  /**
@@ -21,13 +21,8 @@ export const REPORTS_CONFIG_BASE_URL = "https://api.bentley.com";
21
21
  */
22
22
  export class ReportsConfigProvider implements UiItemsProvider {
23
23
  public readonly id = "ReportsConfigProvider";
24
- private readonly _getAccessToken?: () => Promise<AccessToken>;
25
- private readonly _baseUrl: string;
26
24
 
27
- constructor(getAccessToken?: () => Promise<AccessToken>, baseUrl: string = REPORTS_CONFIG_BASE_URL) {
28
- this._getAccessToken = getAccessToken;
29
- this._baseUrl = baseUrl;
30
- }
25
+ constructor(private _props?: ReportsContainerProps) { }
31
26
 
32
27
  public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): ReadonlyArray<Widget> {
33
28
  const widgets: Widget[] = [];
@@ -35,7 +30,7 @@ export class ReportsConfigProvider implements UiItemsProvider {
35
30
  const ReportsWidget: Widget = {
36
31
  id: "reports-config-widget",
37
32
  label: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ReportsConfig"),
38
- content: <ReportsContainer getAccessToken={this._getAccessToken} baseUrl={this._baseUrl} />,
33
+ content: <ReportsContainer {...this._props} />,
39
34
  };
40
35
 
41
36
  widgets.push(ReportsWidget);
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { Modal, Table, tableFilters } from "@itwin/itwinui-react";
6
6
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
- import type { Mapping, MappingsClient } from "@itwin/insights-client";
7
+ import type { IMappingsClient, Mapping } from "@itwin/insights-client";
8
8
  import ActionPanel from "./ActionPanel";
9
9
  import "./AddMappingsModal.scss";
10
10
  import { LocalizedTablePaginator } from "./LocalizedTablePaginator";
@@ -23,7 +23,7 @@ const fetchMappings = async (
23
23
  setMappings: (mappings: Mapping[]) => void,
24
24
  iModelId: string,
25
25
  setIsLoading: (isLoading: boolean) => void,
26
- mappingsClient: MappingsClient,
26
+ mappingsClient: IMappingsClient,
27
27
  getAccessToken: () => Promise<AccessToken>,
28
28
  ) => {
29
29
  try {
@@ -6,7 +6,7 @@ import { ExtractionState } from "@itwin/insights-client";
6
6
  import { handleError } from "./utils";
7
7
  import { ExtractionStates } from "./ExtractionStatus";
8
8
  import { STATUS_CHECK_INTERVAL } from "./Constants";
9
- import type { ExtractionClient, ExtractionMapping, ExtractionRequestDetails, ReportMapping, ReportsClient } from "@itwin/insights-client";
9
+ import type { ExtractionMapping, ExtractionRequestDetails, IExtractionClient, IReportsClient, ReportMapping } from "@itwin/insights-client";
10
10
  import type { AccessToken } from "@itwin/core-bentley";
11
11
 
12
12
  export type ReportMappingAndMapping = ReportMapping & {
@@ -19,10 +19,9 @@ export type ReportMappingAndMapping = ReportMapping & {
19
19
  * @public
20
20
  */
21
21
  export class BulkExtractor {
22
- private _reportsClientApi: ReportsClient;
23
- private _extractionClientApi: ExtractionClient;
22
+ private _reportsClientApi: IReportsClient;
23
+ private _extractionClientApi: IExtractionClient;
24
24
  private _accessToken: () => Promise<string>;
25
-
26
25
  private _reportIModels = new Map<string, string[]>(); // key: reportId, value: iModels
27
26
  private _iModelStates = new Map<string, ExtractionState>(); // key: iModelId, value: state
28
27
  private _timeFetched = new Date();
@@ -34,8 +33,8 @@ export class BulkExtractor {
34
33
  private _iModels: string[] = [];
35
34
 
36
35
  constructor(
37
- reportsClient: ReportsClient,
38
- extractionClient: ExtractionClient,
36
+ reportsClient: IReportsClient,
37
+ extractionClient: IExtractionClient,
39
38
  getAccessToken: () => Promise<AccessToken>,
40
39
  successfulExtractionToast: (iModelName: string, odataFeedUrl: string) => void,
41
40
  failedExtractionToast: (iModelName: string) => void,
@@ -9,7 +9,7 @@ import type { CreateTypeFromInterface } from "./utils";
9
9
  import { EmptyMessage, generateUrl, handleError, LoadingOverlay, LoadingSpinner } from "./utils";
10
10
  import "./ReportMappings.scss";
11
11
  import DeleteModal from "./DeleteModal";
12
- import type { ExtractionRequestDetails, MappingsClient, Report, ReportMapping, ReportsClient } from "@itwin/insights-client";
12
+ import type { ExtractionRequestDetails, IMappingsClient, IReportsClient, Report, ReportMapping } from "@itwin/insights-client";
13
13
  import { REPORTING_BASE_PATH } from "@itwin/insights-client";
14
14
  import { AddMappingsModal } from "./AddMappingsModal";
15
15
  import type { GetSingleIModelParams, IModelsClient } from "@itwin/imodels-client-management";
@@ -33,8 +33,8 @@ const fetchReportMappings = async (
33
33
  setReportMappings: (mappings: ReportMappingAndMapping[]) => void,
34
34
  reportId: string,
35
35
  setIsLoading: (isLoading: boolean) => void,
36
- reportsClient: ReportsClient,
37
- mappingsClient: MappingsClient,
36
+ reportsClient: IReportsClient,
37
+ mappingsClient: IMappingsClient,
38
38
  iModelsClient: IModelsClient,
39
39
  getAccessToken: () => Promise<AccessToken>,
40
40
  ) => {
@@ -9,7 +9,7 @@ import type { CreateTypeFromInterface } from "./utils";
9
9
  import { EmptyMessage, handleError, LoadingOverlay } from "./utils";
10
10
  import "./Reports.scss";
11
11
  import DeleteModal from "./DeleteModal";
12
- import type { Report, ReportsClient } from "@itwin/insights-client";
12
+ import type { IReportsClient, Report } from "@itwin/insights-client";
13
13
  import { ReportHorizontalTile } from "./ReportHorizontalTile";
14
14
  import { SearchBar } from "./SearchBar";
15
15
  import { useReportsConfigApi } from "../context/ReportsConfigApiContext";
@@ -24,7 +24,7 @@ const fetchReports = async (
24
24
  setReports: (reports: Report[]) => void,
25
25
  iTwinId: string | undefined,
26
26
  setIsLoading: (isLoading: boolean) => void,
27
- reportsClient: ReportsClient,
27
+ reportsClient: IReportsClient,
28
28
  getAccessToken: () => Promise<AccessToken>,
29
29
  ) => {
30
30
  try {
@@ -5,6 +5,7 @@
5
5
  import { IModelApp } from "@itwin/core-frontend";
6
6
  import type { IModelsClientOptions } from "@itwin/imodels-client-management";
7
7
  import { IModelsClient } from "@itwin/imodels-client-management";
8
+ import type { IExtractionClient, IMappingsClient, IReportsClient } from "@itwin/insights-client";
8
9
  import { ExtractionClient, GROUPING_AND_MAPPING_BASE_PATH, MappingsClient, REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
9
10
  import { toaster } from "@itwin/itwinui-react";
10
11
  import React, { useCallback, useEffect, useMemo, useState } from "react";
@@ -22,13 +23,35 @@ import { generateUrl } from "./utils";
22
23
  * @public
23
24
  */
24
25
  export interface ReportsConfigContextProps {
26
+ /**
27
+ * A callback function that returns an access token for authenticating API requests.
28
+ * If not specified, it defaults to the authorizationClient of the IModelApp.
29
+ */
25
30
  getAccessToken?: GetAccessTokenFn;
31
+ /**
32
+ * The base URL for the API requests. Defaults to https://api.bentley.com.
33
+ */
26
34
  baseUrl?: string;
27
35
  iTwinId: string;
36
+ /**
37
+ * The bulk extractor instance to use for extracting data. Internal use only.
38
+ */
28
39
  bulkExtractor?: BulkExtractor;
29
- reportsClient?: ReportsClient;
30
- mappingsClient?: MappingsClient;
31
- extractionClient?: ExtractionClient;
40
+ /**
41
+ * A custom implementation of ReportsClient. If provided, baseUrl is ignored.
42
+ */
43
+ reportsClient?: IReportsClient;
44
+ /**
45
+ * A custom implementation of MappingsClient. If provided, baseUrl is ignored.
46
+ */
47
+ mappingsClient?: IMappingsClient;
48
+ /**
49
+ * A custom implementation of ExtractionClient. If provided, baseUrl is ignored.
50
+ */
51
+ extractionClient?: IExtractionClient;
52
+ /**
53
+ * A custom implementation of IModelsClient. If provided, baseUrl is ignored.
54
+ */
32
55
  iModelsClient?: IModelsClient;
33
56
  children?: React.ReactNode;
34
57
  }
@@ -48,22 +71,22 @@ export const ReportsConfigContext = (props: ReportsConfigContextProps) => {
48
71
  }),
49
72
  [props.baseUrl],
50
73
  );
51
- const [extractionClient, setExtractionClient] = useState<ExtractionClient>(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));
74
+ const [extractionClient, setExtractionClient] = useState<IExtractionClient>(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));
52
75
 
53
76
  const [apiConfig, setApiConfig] = useState<ReportsConfigApiProps>({
54
77
  getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,
55
78
  baseUrl: reportsBaseUrl(),
56
79
  iTwinId: props.iTwinId,
57
80
  reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
58
- mappingsClient: props.mappingsClient ?? new MappingsClient(groupingMappingBaseUrl()),
81
+ mappingsClient: props.mappingsClient ?? new MappingsClient(undefined, groupingMappingBaseUrl()),
59
82
  iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
60
83
  });
61
84
 
62
85
  useEffect(() => {
63
86
  if (!props.extractionClient) {
64
- setExtractionClient(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));
87
+ setExtractionClient(props.extractionClient ?? new ExtractionClient(undefined, groupingMappingBaseUrl()));
65
88
  }
66
- }, [props.extractionClient, reportsBaseUrl]);
89
+ }, [groupingMappingBaseUrl, props.extractionClient]);
67
90
 
68
91
  const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {
69
92
  toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);
@@ -88,10 +111,20 @@ export const ReportsConfigContext = (props: ReportsConfigContextProps) => {
88
111
  baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,
89
112
  iTwinId: props.iTwinId,
90
113
  reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
91
- mappingsClient: props.mappingsClient ?? new MappingsClient(reportsBaseUrl()),
114
+ mappingsClient: props.mappingsClient ?? new MappingsClient(undefined, groupingMappingBaseUrl()),
92
115
  iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
93
116
  }));
94
- }, [props.getAccessToken, props.baseUrl, props.iTwinId, props.reportsClient, props.mappingsClient, props.iModelsClient, reportsBaseUrl, iModelClientOptions]);
117
+ }, [
118
+ props.getAccessToken,
119
+ props.baseUrl,
120
+ props.iTwinId,
121
+ props.reportsClient,
122
+ props.mappingsClient,
123
+ props.iModelsClient,
124
+ reportsBaseUrl,
125
+ iModelClientOptions,
126
+ groupingMappingBaseUrl,
127
+ ]);
95
128
 
96
129
  return (
97
130
  <ReportsConfigApiContext.Provider value={apiConfig}>
@@ -2,19 +2,16 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import type { AccessToken } from "@itwin/core-bentley";
6
5
  import React, { useCallback, useState } from "react";
7
6
  import "./ReportsContainer.scss";
8
7
  import type { Report } from "@itwin/insights-client";
9
8
  import { useActiveIModelConnection } from "@itwin/appui-react";
10
9
  import { ReportsHeader } from "./ReportsHeader";
11
10
  import { ReportsRouter } from "./ReportsRouter";
12
- import { ReportsConfigContext } from "./ReportsConfigContext";
11
+ import type { ReportsConfigContextProps } from "./ReportsConfigContext";
12
+ import { ReportsConfigContext } from "./ReportsConfigContext"
13
13
 
14
- interface ReportsContainerProps {
15
- getAccessToken?: () => Promise<AccessToken>;
16
- baseUrl: string;
17
- }
14
+ export type ReportsContainerProps = Omit<ReportsConfigContextProps, "iTwinId" | "children">;
18
15
 
19
16
  export enum RouteStep {
20
17
  ReportsList,
@@ -32,7 +29,7 @@ export interface Route {
32
29
  reportsRoutingFields: ReportsRouteFields;
33
30
  }
34
31
 
35
- const ReportsContainer = ({ getAccessToken, baseUrl }: ReportsContainerProps) => {
32
+ const ReportsContainer = (props: ReportsContainerProps) => {
36
33
  const [routingHistory, setRoutingHistory] = useState<Route[]>([{ step: RouteStep.ReportsList, title: "iTwin Reports", reportsRoutingFields: {} }]);
37
34
  const currentRoute = routingHistory[routingHistory.length - 1];
38
35
  const iTwinId = useActiveIModelConnection()?.iTwinId ?? "";
@@ -47,7 +44,7 @@ const ReportsContainer = ({ getAccessToken, baseUrl }: ReportsContainerProps) =>
47
44
  }, [routingHistory]);
48
45
 
49
46
  return (
50
- <ReportsConfigContext getAccessToken={getAccessToken} baseUrl={baseUrl} iTwinId={iTwinId}>
47
+ <ReportsConfigContext {...props} iTwinId={iTwinId}>
51
48
  <div className="rcw-reports-container">
52
49
  <ReportsHeader goBack={goBack} currentRoute={currentRoute} />
53
50
  <ReportsRouter currentRoute={currentRoute} navigateTo={navigateTo} goBack={goBack} />
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import type { AccessToken } from "@itwin/core-bentley";
6
6
  import { IModelsClient } from "@itwin/imodels-client-management";
7
+ import type { IMappingsClient, IReportsClient } from "@itwin/insights-client";
7
8
  import { MappingsClient, ReportsClient } from "@itwin/insights-client";
8
9
  import * as React from "react";
9
10
  import { createContext } from "react";
@@ -14,8 +15,8 @@ export interface ReportsConfigApiProps {
14
15
  getAccessToken: GetAccessTokenFn;
15
16
  iTwinId: string;
16
17
  baseUrl: string;
17
- reportsClient: ReportsClient;
18
- mappingsClient: MappingsClient;
18
+ reportsClient: IReportsClient;
19
+ mappingsClient: IMappingsClient;
19
20
  iModelsClient: IModelsClient;
20
21
  }
21
22