@digital-ai/dot-components 3.6.1 → 3.8.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 (102) hide show
  1. package/index.esm.js +2792 -641
  2. package/package.json +1 -1
  3. package/src/lib/components/analytics/dashboard-actions/DashboardActions.d.ts +19 -0
  4. package/src/lib/components/analytics/dashboard-actions/DashboardActions.styles.d.ts +2 -0
  5. package/src/lib/components/analytics/dashboard-actions/DashboardOptionsMenu.d.ts +10 -0
  6. package/src/lib/components/analytics/dashboard-actions/DashboardOptionsMenu.styles.d.ts +1 -0
  7. package/src/lib/components/analytics/dashboard-actions/DashboardPublishConfirm.d.ts +18 -0
  8. package/src/lib/components/analytics/dashboard-actions/DashboardPublishConfirm.styles.d.ts +6 -0
  9. package/src/lib/components/analytics/dashboard-dialog/DashboardDialog.d.ts +30 -0
  10. package/src/lib/components/analytics/dashboard-dialog/DashboardDialog.styles.d.ts +3 -0
  11. package/src/lib/components/analytics/dashboard-header/DashboardHeader.d.ts +6 -0
  12. package/src/lib/components/analytics/dashboard-header/DashboardHeader.styles.d.ts +1 -0
  13. package/src/lib/components/analytics/metadata-api/MetadataApiProvider.d.ts +45 -0
  14. package/src/lib/components/analytics/metadata-api/openapi/core/ApiError.d.ts +8 -0
  15. package/src/lib/components/analytics/metadata-api/openapi/core/ApiRequestOptions.d.ts +12 -0
  16. package/src/lib/components/analytics/metadata-api/openapi/core/ApiResult.d.ts +7 -0
  17. package/src/lib/components/analytics/metadata-api/openapi/core/OpenAPI.d.ts +15 -0
  18. package/src/lib/components/analytics/metadata-api/openapi/core/request.d.ts +9 -0
  19. package/src/lib/components/analytics/metadata-api/openapi/index.d.ts +48 -0
  20. package/src/lib/components/analytics/metadata-api/openapi/models/AllCategoriesResponse.d.ts +3 -0
  21. package/src/lib/components/analytics/metadata-api/openapi/models/Author.d.ts +4 -0
  22. package/src/lib/components/analytics/metadata-api/openapi/models/BiServerResponse.d.ts +3 -0
  23. package/src/lib/components/analytics/metadata-api/openapi/models/CategoriesResponse.d.ts +3 -0
  24. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardCopyBody.d.ts +18 -0
  25. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardCreateBody.d.ts +74 -0
  26. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardPatchBody.d.ts +74 -0
  27. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardPutBody.d.ts +74 -0
  28. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardView.d.ts +106 -0
  29. package/src/lib/components/analytics/metadata-api/openapi/models/DashboardViewPagedResponse.d.ts +6 -0
  30. package/src/lib/components/analytics/metadata-api/openapi/models/Entity.d.ts +7 -0
  31. package/src/lib/components/analytics/metadata-api/openapi/models/EntityAttribute.d.ts +11 -0
  32. package/src/lib/components/analytics/metadata-api/openapi/models/EntityAttributePagedResponse.d.ts +6 -0
  33. package/src/lib/components/analytics/metadata-api/openapi/models/EntityAttributeRequest.d.ts +4 -0
  34. package/src/lib/components/analytics/metadata-api/openapi/models/EntityClass.d.ts +7 -0
  35. package/src/lib/components/analytics/metadata-api/openapi/models/EntityClassPagedResponse.d.ts +6 -0
  36. package/src/lib/components/analytics/metadata-api/openapi/models/EntityPagedResponse.d.ts +6 -0
  37. package/src/lib/components/analytics/metadata-api/openapi/models/Error.d.ts +18 -0
  38. package/src/lib/components/analytics/metadata-api/openapi/models/GuestTokenRequest.d.ts +14 -0
  39. package/src/lib/components/analytics/metadata-api/openapi/models/HealthCheckResponse.d.ts +9 -0
  40. package/src/lib/components/analytics/metadata-api/openapi/models/HelpContent.d.ts +5 -0
  41. package/src/lib/components/analytics/metadata-api/openapi/models/HelpContentCreateBody.d.ts +3 -0
  42. package/src/lib/components/analytics/metadata-api/openapi/models/HelpContentPagedResponse.d.ts +6 -0
  43. package/src/lib/components/analytics/metadata-api/openapi/models/HelpContentPutBody.d.ts +3 -0
  44. package/src/lib/components/analytics/metadata-api/openapi/models/MSTRLoginTokenResponse.d.ts +3 -0
  45. package/src/lib/components/analytics/metadata-api/openapi/models/MSTRServerResponse.d.ts +5 -0
  46. package/src/lib/components/analytics/metadata-api/openapi/models/MetadataResponse.d.ts +5 -0
  47. package/src/lib/components/analytics/metadata-api/openapi/models/Origin.d.ts +7 -0
  48. package/src/lib/components/analytics/metadata-api/openapi/models/OriginInstance.d.ts +7 -0
  49. package/src/lib/components/analytics/metadata-api/openapi/models/OriginInstancePagedResponse.d.ts +6 -0
  50. package/src/lib/components/analytics/metadata-api/openapi/models/OriginPagedResponse.d.ts +6 -0
  51. package/src/lib/components/analytics/metadata-api/openapi/models/PaginationHeaders.d.ts +7 -0
  52. package/src/lib/components/analytics/metadata-api/openapi/models/PaginationMetadata.d.ts +9 -0
  53. package/src/lib/components/analytics/metadata-api/openapi/models/SSLoginTokenResponse.d.ts +4 -0
  54. package/src/lib/components/analytics/metadata-api/openapi/models/TenantInfo.d.ts +5 -0
  55. package/src/lib/components/analytics/metadata-api/openapi/models/VersionResponse.d.ts +3 -0
  56. package/src/lib/components/analytics/metadata-api/openapi/services/BiService.d.ts +59 -0
  57. package/src/lib/components/analytics/metadata-api/openapi/services/CategoriesService.d.ts +22 -0
  58. package/src/lib/components/analytics/metadata-api/openapi/services/DashboardsService.d.ts +125 -0
  59. package/src/lib/components/analytics/metadata-api/openapi/services/EntitiesService.d.ts +57 -0
  60. package/src/lib/components/analytics/metadata-api/openapi/services/EntityAttributesService.d.ts +69 -0
  61. package/src/lib/components/analytics/metadata-api/openapi/services/EntityClassService.d.ts +56 -0
  62. package/src/lib/components/analytics/metadata-api/openapi/services/HelpContentService.d.ts +51 -0
  63. package/src/lib/components/analytics/metadata-api/openapi/services/OriginInstancesService.d.ts +56 -0
  64. package/src/lib/components/analytics/metadata-api/openapi/services/OriginsService.d.ts +56 -0
  65. package/src/lib/components/analytics/metadata-api/openapi/services/UtilityService.d.ts +46 -0
  66. package/src/lib/components/board/board/Board.context.d.ts +5 -0
  67. package/src/lib/components/board/board/Board.d.ts +8 -0
  68. package/src/lib/components/board/board/Board.styles.d.ts +8 -0
  69. package/src/lib/components/board/board/index.d.ts +2 -0
  70. package/src/lib/components/board/column/Column.context.d.ts +5 -0
  71. package/src/lib/components/board/column/Column.d.ts +7 -0
  72. package/src/lib/components/board/column/Column.styles.d.ts +7 -0
  73. package/src/lib/components/board/column/index.d.ts +2 -0
  74. package/src/lib/components/board/column-actionbar/ColumnActionBar.d.ts +2 -0
  75. package/src/lib/components/board/column-actionbar/ColumnActionBar.styles.d.ts +6 -0
  76. package/src/lib/components/board/column-actionbar/index.d.ts +1 -0
  77. package/src/lib/components/board/column-collapse/ColumnCollapse.d.ts +6 -0
  78. package/src/lib/components/board/column-collapse/index.d.ts +1 -0
  79. package/src/lib/components/board/column-expand/ColumnExpand.d.ts +6 -0
  80. package/src/lib/components/board/column-expand/index.d.ts +1 -0
  81. package/src/lib/components/board/column-header/ColumnHeader.d.ts +5 -0
  82. package/src/lib/components/board/column-header/ColumnHeader.styles.d.ts +8 -0
  83. package/src/lib/components/board/column-header/index.d.ts +1 -0
  84. package/src/lib/components/board/column-items/ColumnItems.d.ts +5 -0
  85. package/src/lib/components/board/column-items/ColumnItems.styles.d.ts +6 -0
  86. package/src/lib/components/board/column-items/index.d.ts +1 -0
  87. package/src/lib/components/board/column-summary/ColumnSummary.d.ts +5 -0
  88. package/src/lib/components/board/column-summary/ColumnSummary.styles.d.ts +8 -0
  89. package/src/lib/components/board/column-summary/index.d.ts +1 -0
  90. package/src/lib/components/board/index.d.ts +9 -0
  91. package/src/lib/components/board/interfaces.d.ts +43 -0
  92. package/src/lib/components/core-api/openapi/models/ApplicationModel.d.ts +1 -1
  93. package/src/lib/components/index.d.ts +8 -1
  94. package/src/lib/components/progress/Progress.d.ts +3 -1
  95. package/src/lib/components/progress/Progress.styles.d.ts +1 -2
  96. package/src/lib/components/progress-button/ProgressButton.d.ts +1 -1
  97. package/src/lib/components/progress-button/ProgressButton.styles.d.ts +1 -1
  98. package/src/lib/components/snackbar/SnackbarProvider.d.ts +2 -0
  99. package/src/lib/components/snackbar/index.d.ts +1 -1
  100. package/src/lib/components/snackbar/utils/helpers.d.ts +9 -0
  101. package/src/lib/utils/index.d.ts +10 -0
  102. /package/src/lib/{components/core-api → utils/cancelable-promise}/CancelablePromise.d.ts +0 -0
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useState, useRef, useEffect, createContext, useMemo, useContext, forwardRef, useCallback, createElement, Fragment as Fragment$1, useLayoutEffect } from 'react';
4
- import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, AccordionActions, InputAdornment, InputLabel, TextField, Toolbar, Fade, StyledEngineProvider, Alert, Avatar, Button, Link, List, ListSubheader, Divider, CircularProgress, Popper, MenuList, MenuItem, Paper, ClickAwayListener, Drawer, IconButton, ListItem, ListItemButton, Collapse, ListItemIcon, ListItemText, Badge, useMediaQuery, Autocomplete, Chip, AvatarGroup, Breadcrumbs, ToggleButtonGroup, ToggleButton, Card, CardContent, CardHeader, FormControlLabel, Checkbox, FormControl, FormGroup, FormLabel, FormHelperText, Dialog, DialogContent, DialogActions, useTheme as useTheme$1, RadioGroup, Radio, Switch, Skeleton, Snackbar, ButtonGroup, Stepper, Step, StepLabel, StepContent, TablePagination, TableContainer, TableBody, TableCell, TableRow, TableSortLabel, TableHead, Table, Tabs, Tab, LinearProgress, Slide } from '@mui/material';
4
+ import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, AccordionActions, InputAdornment, InputLabel, TextField, Toolbar, Fade, StyledEngineProvider, Alert, Avatar, Button, Link, List, ListSubheader, Divider, CircularProgress, Popper, MenuList, MenuItem, Paper, ClickAwayListener, Drawer, IconButton, ListItem, ListItemButton, Collapse, ListItemIcon, ListItemText, Badge, useMediaQuery, Autocomplete, Chip, AvatarGroup, Breadcrumbs, ToggleButtonGroup, ToggleButton, Card, CardContent, CardHeader, FormControlLabel, Checkbox, FormControl, FormGroup, FormLabel, FormHelperText, Dialog, DialogContent, DialogActions, useTheme as useTheme$1, Snackbar, RadioGroup, Radio, Switch, Skeleton, ButtonGroup, Stepper, Step, StepLabel, StepContent, TablePagination, TableContainer, TableBody, TableCell, TableRow, TableSortLabel, TableHead, Table, Tabs, Tab, LinearProgress, Slide } from '@mui/material';
5
5
  import '@digital-ai/dot-icons';
6
6
  import styled, { css, createGlobalStyle, ThemeProvider as ThemeProvider$1, keyframes } from 'styled-components';
7
7
  import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
@@ -15,7 +15,7 @@ import updateLocale from 'dayjs/plugin/updateLocale';
15
15
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
16
16
  import utc from 'dayjs/plugin/utc';
17
17
 
18
- class ApiError extends Error {
18
+ class ApiError$1 extends Error {
19
19
  constructor(response, message) {
20
20
  super(message);
21
21
  this.url = response.url;
@@ -1641,7 +1641,7 @@ const calculateNumberFromText = text => {
1641
1641
  };
1642
1642
  const calculateWidth = width => {
1643
1643
  if (!width) return;
1644
- return isString$1(width) ? width : `${width}px`;
1644
+ return isString$2(width) ? width : `${width}px`;
1645
1645
  };
1646
1646
  const getAvatarColorForInputText = value => {
1647
1647
  const colorOptions = [...Object.keys(avatarColors)];
@@ -1652,11 +1652,11 @@ const getAvatarColorForInputText = value => {
1652
1652
  if (index === 9) return 'default';
1653
1653
  return colorOptions[index];
1654
1654
  };
1655
- const isString$1 = str => typeof str === 'string';
1655
+ const isString$2 = str => typeof str === 'string';
1656
1656
  const isLowerCase = str => str === str.toLowerCase();
1657
1657
  const isNumber = num => typeof num === 'number';
1658
1658
  const renderNodeOrTypography = (content, typographyVariant = 'body1') => {
1659
- return isString$1(content) ? jsx(DotTypography, {
1659
+ return isString$2(content) ? jsx(DotTypography, {
1660
1660
  variant: typographyVariant,
1661
1661
  children: content
1662
1662
  }) : content;
@@ -1714,7 +1714,7 @@ const DotAlertBanner = ({
1714
1714
  }) => {
1715
1715
  const rootClasses = useStylesWithRootClass(rootClassName$16, severity, className);
1716
1716
  /* For simple string use default component, for everything else use 'div' */
1717
- const typographyComponent = isString$1(children) ? undefined : 'div';
1717
+ const typographyComponent = isString$2(children) ? undefined : 'div';
1718
1718
  return jsx(StyledAlertBanner, {
1719
1719
  action: action,
1720
1720
  "aria-label": ariaLabel,
@@ -1797,7 +1797,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1797
1797
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1798
1798
  };
1799
1799
 
1800
- const OpenAPI = {
1800
+ const OpenAPI$1 = {
1801
1801
  BASE: '',
1802
1802
  VERSION: '1 (local)',
1803
1803
  WITH_CREDENTIALS: false,
@@ -1828,30 +1828,30 @@ var ApplicationModel;
1828
1828
  })(ApplicationModel.instance_state || (ApplicationModel.instance_state = {}));
1829
1829
  })(ApplicationModel || (ApplicationModel = {}));
1830
1830
 
1831
- function isDefined(value) {
1831
+ function isDefined$1(value) {
1832
1832
  return value !== undefined && value !== null;
1833
1833
  }
1834
- function isString(value) {
1834
+ function isString$1(value) {
1835
1835
  return typeof value === 'string';
1836
1836
  }
1837
- function isStringWithValue(value) {
1838
- return isString(value) && value !== '';
1837
+ function isStringWithValue$1(value) {
1838
+ return isString$1(value) && value !== '';
1839
1839
  }
1840
- function isBlob(value) {
1840
+ function isBlob$1(value) {
1841
1841
  return value instanceof Blob;
1842
1842
  }
1843
- function base64(str) {
1843
+ function base64$1(str) {
1844
1844
  try {
1845
1845
  return btoa(str);
1846
1846
  } catch (err) {
1847
1847
  return Buffer.from(str).toString('base64');
1848
1848
  }
1849
1849
  }
1850
- function getQueryString(params) {
1850
+ function getQueryString$1(params) {
1851
1851
  const qs = [];
1852
1852
  Object.keys(params).forEach(key => {
1853
1853
  const value = params[key];
1854
- if (isDefined(value)) {
1854
+ if (isDefined$1(value)) {
1855
1855
  if (Array.isArray(value)) {
1856
1856
  value.forEach(value => {
1857
1857
  qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
@@ -1866,25 +1866,25 @@ function getQueryString(params) {
1866
1866
  }
1867
1867
  return '';
1868
1868
  }
1869
- function getUrl(options) {
1869
+ function getUrl$1(options) {
1870
1870
  const path = options.path;
1871
- const url = `${OpenAPI.BASE}${path}`;
1871
+ const url = `${OpenAPI$1.BASE}${path}`;
1872
1872
  if (options.query) {
1873
- return `${url}${getQueryString(options.query)}`;
1873
+ return `${url}${getQueryString$1(options.query)}`;
1874
1874
  }
1875
1875
  return url;
1876
1876
  }
1877
- function getFormData(params) {
1877
+ function getFormData$1(params) {
1878
1878
  const formData = new FormData();
1879
1879
  Object.keys(params).forEach(key => {
1880
1880
  const value = params[key];
1881
- if (isDefined(value)) {
1881
+ if (isDefined$1(value)) {
1882
1882
  formData.append(key, value);
1883
1883
  }
1884
1884
  });
1885
1885
  return formData;
1886
1886
  }
1887
- function resolve(options, resolver) {
1887
+ function resolve$1(options, resolver) {
1888
1888
  return __awaiter(this, void 0, void 0, function* () {
1889
1889
  if (typeof resolver === 'function') {
1890
1890
  return resolver(options);
@@ -1892,31 +1892,31 @@ function resolve(options, resolver) {
1892
1892
  return resolver;
1893
1893
  });
1894
1894
  }
1895
- function getHeaders(options) {
1895
+ function getHeaders$1(options) {
1896
1896
  return __awaiter(this, void 0, void 0, function* () {
1897
- const token = yield resolve(options, OpenAPI.TOKEN);
1898
- const username = yield resolve(options, OpenAPI.USERNAME);
1899
- const password = yield resolve(options, OpenAPI.PASSWORD);
1900
- const additionalHeaders = yield resolve(options, OpenAPI.HEADERS);
1897
+ const token = yield resolve$1(options, OpenAPI$1.TOKEN);
1898
+ const username = yield resolve$1(options, OpenAPI$1.USERNAME);
1899
+ const password = yield resolve$1(options, OpenAPI$1.PASSWORD);
1900
+ const additionalHeaders = yield resolve$1(options, OpenAPI$1.HEADERS);
1901
1901
  const defaultHeaders = Object.entries(Object.assign(Object.assign({
1902
1902
  Accept: 'application/json'
1903
- }, additionalHeaders), options.headers)).filter(([key, value]) => isDefined(value)).reduce((headers, [key, value]) => Object.assign(Object.assign({}, headers), {
1903
+ }, additionalHeaders), options.headers)).filter(([key, value]) => isDefined$1(value)).reduce((headers, [key, value]) => Object.assign(Object.assign({}, headers), {
1904
1904
  [key]: value
1905
1905
  }), {});
1906
1906
  const headers = new Headers(defaultHeaders);
1907
- if (isStringWithValue(token)) {
1907
+ if (isStringWithValue$1(token)) {
1908
1908
  headers.append('Authorization', `Bearer ${token}`);
1909
1909
  }
1910
- if (isStringWithValue(username) && isStringWithValue(password)) {
1911
- const credentials = base64(`${username}:${password}`);
1910
+ if (isStringWithValue$1(username) && isStringWithValue$1(password)) {
1911
+ const credentials = base64$1(`${username}:${password}`);
1912
1912
  headers.append('Authorization', `Basic ${credentials}`);
1913
1913
  }
1914
1914
  if (options.body) {
1915
1915
  if (options.mediaType) {
1916
1916
  headers.append('Content-Type', options.mediaType);
1917
- } else if (isBlob(options.body)) {
1917
+ } else if (isBlob$1(options.body)) {
1918
1918
  headers.append('Content-Type', options.body.type || 'application/octet-stream');
1919
- } else if (isString(options.body)) {
1919
+ } else if (isString$1(options.body)) {
1920
1920
  headers.append('Content-Type', 'text/plain');
1921
1921
  } else {
1922
1922
  headers.append('Content-Type', 'application/json');
@@ -1925,15 +1925,15 @@ function getHeaders(options) {
1925
1925
  return headers;
1926
1926
  });
1927
1927
  }
1928
- function getRequestBody(options) {
1928
+ function getRequestBody$1(options) {
1929
1929
  var _a;
1930
1930
  if (options.formData) {
1931
- return getFormData(options.formData);
1931
+ return getFormData$1(options.formData);
1932
1932
  }
1933
1933
  if (options.body) {
1934
1934
  if ((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes('/json')) {
1935
1935
  return JSON.stringify(options.body);
1936
- } else if (isString(options.body) || isBlob(options.body)) {
1936
+ } else if (isString$1(options.body) || isBlob$1(options.body)) {
1937
1937
  return options.body;
1938
1938
  } else {
1939
1939
  return JSON.stringify(options.body);
@@ -1941,26 +1941,26 @@ function getRequestBody(options) {
1941
1941
  }
1942
1942
  return undefined;
1943
1943
  }
1944
- function sendRequest(options, url) {
1944
+ function sendRequest$1(options, url) {
1945
1945
  return __awaiter(this, void 0, void 0, function* () {
1946
1946
  const request = {
1947
1947
  method: options.method,
1948
- headers: yield getHeaders(options),
1949
- body: getRequestBody(options)
1948
+ headers: yield getHeaders$1(options),
1949
+ body: getRequestBody$1(options)
1950
1950
  };
1951
1951
  return yield fetch(url, request);
1952
1952
  });
1953
1953
  }
1954
- function getResponseHeader(response, responseHeader) {
1954
+ function getResponseHeader$1(response, responseHeader) {
1955
1955
  if (responseHeader) {
1956
1956
  const content = response.headers.get(responseHeader);
1957
- if (isString(content)) {
1957
+ if (isString$1(content)) {
1958
1958
  return content;
1959
1959
  }
1960
1960
  }
1961
1961
  return null;
1962
1962
  }
1963
- function getResponseBody(response) {
1963
+ function getResponseBody$1(response) {
1964
1964
  return __awaiter(this, void 0, void 0, function* () {
1965
1965
  if (response.status !== 204) {
1966
1966
  try {
@@ -1980,7 +1980,7 @@ function getResponseBody(response) {
1980
1980
  return null;
1981
1981
  });
1982
1982
  }
1983
- function catchErrors(options, result) {
1983
+ function catchErrors$1(options, result) {
1984
1984
  const errors = Object.assign({
1985
1985
  400: 'Bad Request',
1986
1986
  401: 'Unauthorized',
@@ -1992,10 +1992,10 @@ function catchErrors(options, result) {
1992
1992
  }, options.errors);
1993
1993
  const error = errors[result.status];
1994
1994
  if (error) {
1995
- throw new ApiError(result, error);
1995
+ throw new ApiError$1(result, error);
1996
1996
  }
1997
1997
  if (!result.ok) {
1998
- throw new ApiError(result, 'Generic Error');
1998
+ throw new ApiError$1(result, 'Generic Error');
1999
1999
  }
2000
2000
  }
2001
2001
  /**
@@ -2004,12 +2004,12 @@ function catchErrors(options, result) {
2004
2004
  * @returns ApiResult
2005
2005
  * @throws ApiError
2006
2006
  */
2007
- function request(options) {
2007
+ function request$1(options) {
2008
2008
  return __awaiter(this, void 0, void 0, function* () {
2009
- const url = getUrl(options);
2010
- const response = yield sendRequest(options, url);
2011
- const responseBody = yield getResponseBody(response);
2012
- const responseHeader = getResponseHeader(response, options.responseHeader);
2009
+ const url = getUrl$1(options);
2010
+ const response = yield sendRequest$1(options, url);
2011
+ const responseBody = yield getResponseBody$1(response);
2012
+ const responseHeader = getResponseHeader$1(response, options.responseHeader);
2013
2013
  const result = {
2014
2014
  url,
2015
2015
  ok: response.ok,
@@ -2017,7 +2017,7 @@ function request(options) {
2017
2017
  statusText: response.statusText,
2018
2018
  body: responseHeader || responseBody
2019
2019
  };
2020
- catchErrors(options, result);
2020
+ catchErrors$1(options, result);
2021
2021
  return result;
2022
2022
  });
2023
2023
  }
@@ -2051,7 +2051,7 @@ class ApplicationsService {
2051
2051
  */
2052
2052
  static retrieveApplications(accountId, productInstanceId, start, count, sort, filter) {
2053
2053
  return __awaiter(this, void 0, void 0, function* () {
2054
- const result = yield request({
2054
+ const result = yield request$1({
2055
2055
  method: 'GET',
2056
2056
  path: `/licensing/v1/applications/`,
2057
2057
  query: {
@@ -2079,7 +2079,7 @@ class ApplicationsService {
2079
2079
  */
2080
2080
  static retrieveApplicationById(applicationId) {
2081
2081
  return __awaiter(this, void 0, void 0, function* () {
2082
- const result = yield request({
2082
+ const result = yield request$1({
2083
2083
  method: 'GET',
2084
2084
  path: `/licensing/v1/applications/${applicationId}`,
2085
2085
  errors: {
@@ -2142,11 +2142,60 @@ function useCancelablePromise() {
2142
2142
  };
2143
2143
  }
2144
2144
 
2145
- const nullStr = null;
2145
+ const getPlatformConsoleUrlFromToken = encodedToken => {
2146
+ if (encodedToken) {
2147
+ try {
2148
+ const decodedToken = jwt_decode(encodedToken);
2149
+ const iss = decodedToken.iss;
2150
+ const issUrl = new URL(iss);
2151
+ const pathArray = issUrl.pathname.split('/');
2152
+ const vanityDomain = pathArray[pathArray.length - 1];
2153
+ let host = issUrl.hostname === 'localhost' ? 'local.digital.ai:4200' : issUrl.host;
2154
+ const identityRe = /^identity(-\d+)+\.(.+)$/i;
2155
+ const match = host.match(identityRe);
2156
+ if (match && match.length === 3) {
2157
+ host = match[2];
2158
+ }
2159
+ return issUrl.protocol + '//' + vanityDomain + '.' + host + '/';
2160
+ } catch (e) {
2161
+ console.error('Invalid token', e, encodedToken);
2162
+ }
2163
+ }
2164
+ return null;
2165
+ };
2166
+ /**
2167
+ * Maps base64 encoded image data to image MIME types
2168
+ */
2169
+ const signatureMap = {
2170
+ iVBORw0KGgo: 'image/png',
2171
+ '/9j/': 'image/jpg',
2172
+ PHN2Zy: 'image/svg+xml',
2173
+ UklGR: 'image/webp'
2174
+ };
2175
+ /**
2176
+ * Detects the MIME type of an image based on the first few bytes of the image data
2177
+ * @param b64 Base64 encoded image data
2178
+ * @param defaultMimeType mime type to return if it can't be determined from the given b64 string
2179
+ *
2180
+ * @returns mime type string
2181
+ */
2182
+ function detectImageMimeType(b64, defaultMimeType = 'image/svg+xml') {
2183
+ if (b64) {
2184
+ for (const [signature, mimeType] of Object.entries(signatureMap)) {
2185
+ if (b64.startsWith(signature)) {
2186
+ return mimeType;
2187
+ }
2188
+ }
2189
+ }
2190
+ // If no signature is found, return default mime type
2191
+ return defaultMimeType;
2192
+ }
2193
+
2194
+ const nullStr$1 = null;
2146
2195
  let idCount = 100;
2147
2196
  const createAppInstance = (name, instance_state, appType = 'Deploy') => ({
2148
2197
  id: '757e74ed-389b-4ec4-be29-bfed6738b' + idCount++,
2149
- product_instance_id: nullStr,
2198
+ product_instance_id: nullStr$1,
2150
2199
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2151
2200
  enabled: true,
2152
2201
  created_date: '2022-11-30T23:28:50.980764+00:00',
@@ -2154,8 +2203,8 @@ const createAppInstance = (name, instance_state, appType = 'Deploy') => ({
2154
2203
  name,
2155
2204
  url: 'https://digital.ai/products/deploy/',
2156
2205
  description: '',
2157
- alternate_label: nullStr,
2158
- logo: nullStr,
2206
+ alternate_label: nullStr$1,
2207
+ logo: nullStr$1,
2159
2208
  needs_authentication: false,
2160
2209
  logo_product_name: appType,
2161
2210
  instance_state: instance_state % 2
@@ -2168,7 +2217,7 @@ for (const [name, instanceState] of testData) {
2168
2217
  }
2169
2218
  let applications = [{
2170
2219
  id: 'be6e1e4f-7009-4412-b3ba-e5633cbe6be0',
2171
- product_instance_id: nullStr,
2220
+ product_instance_id: nullStr$1,
2172
2221
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2173
2222
  enabled: true,
2174
2223
  created_date: '2022-11-30T23:28:01.662721+00:00',
@@ -2176,14 +2225,14 @@ let applications = [{
2176
2225
  name: 'Agility 1',
2177
2226
  url: 'https://digital.ai/products/agility/',
2178
2227
  description: '',
2179
- alternate_label: nullStr,
2180
- logo: nullStr,
2228
+ alternate_label: nullStr$1,
2229
+ logo: nullStr$1,
2181
2230
  needs_authentication: true,
2182
2231
  logo_product_name: 'Agility',
2183
2232
  instance_state: 1
2184
2233
  }, {
2185
2234
  id: 'f30476d3-c432-44c8-a778-a0a9fae203c9',
2186
- product_instance_id: nullStr,
2235
+ product_instance_id: nullStr$1,
2187
2236
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2188
2237
  enabled: true,
2189
2238
  created_date: '2022-11-30T23:32:00.979159+00:00',
@@ -2191,14 +2240,14 @@ let applications = [{
2191
2240
  name: 'Continuous Testing 1',
2192
2241
  url: 'https://digital.ai/products/continuous-testing/',
2193
2242
  description: '',
2194
- alternate_label: nullStr,
2195
- logo: nullStr,
2243
+ alternate_label: nullStr$1,
2244
+ logo: nullStr$1,
2196
2245
  needs_authentication: false,
2197
2246
  logo_product_name: 'Continuous Testing',
2198
2247
  instance_state: 1
2199
2248
  }, {
2200
2249
  id: 'f30476d4-c432-44c8-a778-a0a9fae203c9',
2201
- product_instance_id: nullStr,
2250
+ product_instance_id: nullStr$1,
2202
2251
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2203
2252
  enabled: true,
2204
2253
  created_date: '2022-12-30T23:32:00.979159+00:00',
@@ -2206,8 +2255,8 @@ let applications = [{
2206
2255
  name: 'Continuous Testing 2',
2207
2256
  url: 'https://digital.ai/products/continuous-testing/',
2208
2257
  description: '',
2209
- alternate_label: nullStr,
2210
- logo: nullStr,
2258
+ alternate_label: nullStr$1,
2259
+ logo: nullStr$1,
2211
2260
  needs_authentication: false,
2212
2261
  logo_product_name: 'Continuous Testing',
2213
2262
  instance_state: 1
@@ -2217,7 +2266,7 @@ deployInstances.forEach(deployApp => {
2217
2266
  });
2218
2267
  applications = applications.concat([{
2219
2268
  id: '0c152339-b953-41e4-8b0f-51182b6e646a',
2220
- product_instance_id: nullStr,
2269
+ product_instance_id: nullStr$1,
2221
2270
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2222
2271
  enabled: true,
2223
2272
  created_date: '2022-11-30T23:31:18.846994+00:00',
@@ -2225,14 +2274,14 @@ applications = applications.concat([{
2225
2274
  name: 'Staging Intelligence',
2226
2275
  url: 'https://digital.ai/products/intelligence/',
2227
2276
  description: '',
2228
- alternate_label: nullStr,
2229
- logo: nullStr,
2277
+ alternate_label: nullStr$1,
2278
+ logo: nullStr$1,
2230
2279
  needs_authentication: true,
2231
2280
  logo_product_name: 'Intelligence',
2232
2281
  instance_state: 0
2233
2282
  }, {
2234
2283
  id: '00f39f97-0e22-4e24-8cd1-20b359861c3f',
2235
- product_instance_id: nullStr,
2284
+ product_instance_id: nullStr$1,
2236
2285
  account_id: 'c390d325-1628-4c4e-a1ee-d269e025c34e',
2237
2286
  enabled: true,
2238
2287
  created_date: '2022-11-30T23:30:11.995558+00:00',
@@ -2240,8 +2289,8 @@ applications = applications.concat([{
2240
2289
  name: 'Prod Release',
2241
2290
  url: 'https://digital.ai/products/release/',
2242
2291
  description: '',
2243
- alternate_label: nullStr,
2244
- logo: nullStr,
2292
+ alternate_label: nullStr$1,
2293
+ logo: nullStr$1,
2245
2294
  needs_authentication: true,
2246
2295
  logo_product_name: 'Release',
2247
2296
  instance_state: 1
@@ -2275,7 +2324,7 @@ const DotCoreApiProvider = ({
2275
2324
  const nullProductInstanceId = null;
2276
2325
  const sort = 'name';
2277
2326
  const filter = ['enabled:true'];
2278
- if (OpenAPI.BASE === MOCK_API_URL) {
2327
+ if (OpenAPI$1.BASE === MOCK_API_URL) {
2279
2328
  setApplicationsError(null);
2280
2329
  setApplicationsLoading(false);
2281
2330
  setApplications(getApplicationsMock.applications);
@@ -2295,7 +2344,7 @@ const DotCoreApiProvider = ({
2295
2344
  if (!accountId || isUUID(accountId)) {
2296
2345
  retrieveApplications(accountId);
2297
2346
  } else {
2298
- const error = new ApiError({
2347
+ const error = new ApiError$1({
2299
2348
  url: '',
2300
2349
  ok: false,
2301
2350
  status: 400,
@@ -2305,29 +2354,9 @@ const DotCoreApiProvider = ({
2305
2354
  setApplicationsError(error);
2306
2355
  }
2307
2356
  };
2308
- const decodeToken = encodedToken => {
2309
- if (encodedToken) {
2310
- try {
2311
- const decodedToken = jwt_decode(encodedToken);
2312
- const iss = decodedToken.iss;
2313
- const issUrl = new URL(iss);
2314
- const pathArray = issUrl.pathname.split('/');
2315
- const vanityDomain = pathArray[pathArray.length - 1];
2316
- let host = issUrl.hostname === 'localhost' ? 'local.digital.ai:4200' : issUrl.host;
2317
- const identity = 'identity.';
2318
- if (host.startsWith(identity)) {
2319
- host = host.substring(identity.length);
2320
- }
2321
- const consoleUrl = issUrl.protocol + '//' + vanityDomain + '.' + host + '/';
2322
- setPlatformConsoleUrl(consoleUrl);
2323
- } catch (e) {
2324
- console.error('Invalid token', e, encodedToken);
2325
- }
2326
- }
2327
- };
2328
2357
  const setToken = newToken => {
2329
- OpenAPI.TOKEN = newToken;
2330
- decodeToken(newToken);
2358
+ OpenAPI$1.TOKEN = newToken;
2359
+ setPlatformConsoleUrl(getPlatformConsoleUrlFromToken(newToken));
2331
2360
  };
2332
2361
  const DotCoreApiValues = {
2333
2362
  applications,
@@ -2342,14 +2371,14 @@ const DotCoreApiProvider = ({
2342
2371
  setSelectedAppSwitcherAppType
2343
2372
  };
2344
2373
  const memoizedValues = useMemo(() => DotCoreApiValues, [applications, applicationsError, applicationsLoading, isAppSwitcherOpen, platformConsoleUrl, selectedAppSwitcherAppType]);
2345
- if (apiUrl && OpenAPI.BASE !== apiUrl) {
2346
- OpenAPI.BASE = apiUrl;
2374
+ if (apiUrl && OpenAPI$1.BASE !== apiUrl) {
2375
+ OpenAPI$1.BASE = apiUrl;
2347
2376
  }
2348
2377
  const demoUrl = 'https://digitalai.staging.digitalai.cloud/';
2349
- if (token && OpenAPI.TOKEN !== token) {
2350
- OpenAPI.TOKEN = token;
2351
- decodeToken(token);
2352
- } else if (OpenAPI.BASE === MOCK_API_URL && platformConsoleUrl !== demoUrl) {
2378
+ if (token && OpenAPI$1.TOKEN !== token) {
2379
+ OpenAPI$1.TOKEN = token;
2380
+ setPlatformConsoleUrl(getPlatformConsoleUrlFromToken(token));
2381
+ } else if (OpenAPI$1.BASE === MOCK_API_URL && platformConsoleUrl !== demoUrl) {
2353
2382
  setPlatformConsoleUrl(demoUrl);
2354
2383
  }
2355
2384
  return jsx(DotCoreApiContext.Provider, {
@@ -2713,7 +2742,7 @@ const DotLink = ({
2713
2742
  const rootClasses = useStylesWithRootClass(rootClassName$13, className);
2714
2743
  useEffect(() => {
2715
2744
  // Include a console warning if the link is not a string and no ariaLabel is provided
2716
- if (!isString$1(children) && !ariaLabel) {
2745
+ if (!isString$2(children) && !ariaLabel) {
2717
2746
  console.warn(`a11y: Consider adding an 'ariaLabel' to 'DotLink' when used without text`);
2718
2747
  }
2719
2748
  // Include a console warning if the color value is set to initial
@@ -2852,18 +2881,46 @@ const DotListDivider = ({
2852
2881
  };
2853
2882
 
2854
2883
  const rootClassName$11 = 'dot-progress';
2855
- const StyledCircularProgress = styled(CircularProgress)`
2884
+ const StyledProgress = styled.div`
2856
2885
  ${({
2857
2886
  theme
2858
2887
  }) => css`
2859
2888
  &.${rootClassName$11} {
2860
- &.MuiCircularProgress-colorPrimary {
2861
- color: ${theme.palette.figma.inProgress.normal};
2889
+ line-height: 0;
2890
+
2891
+ .dot-progress-with-label-wrapper {
2892
+ position: relative;
2893
+ display: inline-flex;
2894
+
2895
+ .progress-label-typography {
2896
+ position: absolute;
2897
+ display: flex;
2898
+ align-items: center;
2899
+ justify-content: center;
2900
+ inset: 0;
2901
+ }
2862
2902
  }
2863
2903
 
2864
- &.MuiCircularProgress-colorSecondary {
2865
- color: ${theme.palette.figma.inProgress.secondary};
2904
+ .dot-progress-background-wrapper {
2905
+ position: relative;
2906
+
2907
+ .dot-progress-background {
2908
+ color: ${theme.palette.grey[100]};
2909
+ position: absolute;
2910
+ left: 0;
2911
+ }
2912
+ }
2913
+
2914
+ .dot-circular-progress {
2915
+ &.MuiCircularProgress-colorPrimary {
2916
+ color: ${theme.palette.figma.inProgress.normal};
2917
+ }
2918
+
2919
+ &.MuiCircularProgress-colorSecondary {
2920
+ color: ${theme.palette.figma.inProgress.secondary};
2921
+ }
2866
2922
  }
2923
+ }
2867
2924
  `}
2868
2925
  `;
2869
2926
 
@@ -2872,6 +2929,7 @@ const DotProgress = ({
2872
2929
  color = 'secondary',
2873
2930
  className,
2874
2931
  'data-testid': dataTestId,
2932
+ hasPercentageLabel = false,
2875
2933
  size = 40,
2876
2934
  thickness = 3.6,
2877
2935
  tooltip = 'loading data',
@@ -2884,13 +2942,10 @@ const DotProgress = ({
2884
2942
  console.warn('a11y: DotProgress must have an ariaLabel to describe the progress component');
2885
2943
  }
2886
2944
  }, []);
2887
- return jsx(DotTooltip, {
2888
- title: tooltip,
2889
- children: jsx(StyledCircularProgress, {
2945
+ const renderCircularProgress = (hasBackgroundProgress = false) => {
2946
+ const circularProgress = jsx(CircularProgress, {
2890
2947
  "aria-label": ariaLabel || tooltip,
2891
- classes: {
2892
- root: rootClasses
2893
- },
2948
+ className: "dot-circular-progress",
2894
2949
  color: color,
2895
2950
  "data-testid": dataTestId,
2896
2951
  role: "progressbar",
@@ -2898,6 +2953,34 @@ const DotProgress = ({
2898
2953
  thickness: thickness,
2899
2954
  value: value,
2900
2955
  variant: variant
2956
+ });
2957
+ if (hasBackgroundProgress) {
2958
+ return jsxs("div", {
2959
+ className: "dot-progress-background-wrapper",
2960
+ children: [jsx(CircularProgress, {
2961
+ "aria-label": "background progress",
2962
+ className: "dot-progress-background",
2963
+ size: size,
2964
+ thickness: thickness,
2965
+ value: 100,
2966
+ variant: "determinate"
2967
+ }), circularProgress]
2968
+ });
2969
+ }
2970
+ return circularProgress;
2971
+ };
2972
+ return jsx(StyledProgress, {
2973
+ className: rootClasses,
2974
+ children: jsx(DotTooltip, {
2975
+ title: tooltip,
2976
+ children: hasPercentageLabel ? jsxs("div", {
2977
+ className: "dot-progress-with-label-wrapper",
2978
+ children: [renderCircularProgress(true), jsxs(DotTypography, {
2979
+ className: "progress-label-typography",
2980
+ variant: "caption",
2981
+ children: [value, "%"]
2982
+ })]
2983
+ }) : renderCircularProgress()
2901
2984
  })
2902
2985
  });
2903
2986
  };
@@ -2937,7 +3020,7 @@ const StyledPopper$1 = styled(Popper)`
2937
3020
 
2938
3021
  const flyoutMenuClassName = 'dot-flyout-menu';
2939
3022
  const rootClassName$$ = 'dot-menu';
2940
- const getListMaxHeight = maxHeight => isString$1(maxHeight) ? maxHeight : `${maxHeight}px`;
3023
+ const getListMaxHeight = maxHeight => isString$2(maxHeight) ? maxHeight : `${maxHeight}px`;
2941
3024
  const StyledPopper = styled(Popper)`
2942
3025
  ${({
2943
3026
  theme
@@ -5400,7 +5483,7 @@ const StyledSidebar = styled.aside`
5400
5483
 
5401
5484
  .toggle-nav {
5402
5485
  border-top: 1px solid ${theme.palette.figma.border.default};
5403
- padding: ${theme.spacing(1)};
5486
+ padding: ${theme.spacing(1, 2)};
5404
5487
  text-align: right;
5405
5488
 
5406
5489
  .dot-icon {
@@ -5612,6 +5695,7 @@ const DotSidebar = ({
5612
5695
  const hasBackItem = goBack && backItem;
5613
5696
  const displayHeader = title || hasAppLogo;
5614
5697
  const openClass = isOpen ? 'open' : 'collapsed';
5698
+ const collapseKey = 'q';
5615
5699
  const checkPrimaryNavMissingIcons = () => navItems.some(item => !item.divider && !item.startIcon);
5616
5700
  useEffect(() => {
5617
5701
  // Incorrect usage warning
@@ -5625,10 +5709,22 @@ const DotSidebar = ({
5625
5709
  useEffect(() => {
5626
5710
  setSidebarWidth(isOpen ? width : 58);
5627
5711
  }, [isOpen]);
5628
- const collapseNav = () => {
5712
+ const toggleNavCollapseState = () => {
5629
5713
  onCollapseChange && onCollapseChange(isOpen);
5630
5714
  setIsOpen(!isOpen);
5631
5715
  };
5716
+ useEffect(() => {
5717
+ const handleKeyPress = event => {
5718
+ const element = event.target;
5719
+ if (event.key === collapseKey && !['INPUT', 'TEXTAREA'].includes(element.nodeName) && !element.isContentEditable) {
5720
+ toggleNavCollapseState();
5721
+ }
5722
+ };
5723
+ window.addEventListener('keydown', handleKeyPress);
5724
+ return () => {
5725
+ window.removeEventListener('keydown', handleKeyPress);
5726
+ };
5727
+ }, [isOpen]);
5632
5728
  const sidebarClasses = useStylesWithRootClass('side-nav', openClass);
5633
5729
  const rootClasses = useStylesWithRootClass(rootClassName$R, openClass, className);
5634
5730
  return jsxs(StyledSidebar, {
@@ -5681,13 +5777,14 @@ const DotSidebar = ({
5681
5777
  }), collapsable && jsx("div", {
5682
5778
  className: "toggle-nav",
5683
5779
  children: jsx(DotTooltip, {
5684
- title: isOpen ? 'Collapse' : 'Expand',
5780
+ title: (isOpen ? 'Collapse' : 'Expand') + ` ${collapseKey}`,
5781
+ placement: "right",
5685
5782
  children: jsx(DotIconButton, {
5686
5783
  ariaLabel: "collapse sidebar navigation",
5687
5784
  "data-testid": "toggle-nav",
5688
- iconId: isOpen ? 'chevron-left' : 'chevron-right',
5785
+ iconId: isOpen ? 'collapse' : 'expand',
5689
5786
  iconSize: "small",
5690
- onClick: collapseNav,
5787
+ onClick: toggleNavCollapseState,
5691
5788
  size: "small"
5692
5789
  })
5693
5790
  })
@@ -6283,7 +6380,7 @@ const getChipsFromAutocomplete = ({
6283
6380
  if (values === undefined) return;
6284
6381
  return values.map((option, index) => {
6285
6382
  if (!option) return null;
6286
- const hasStringValue = isString$1(option);
6383
+ const hasStringValue = isString$2(option);
6287
6384
  const optionAsString = option;
6288
6385
  const optionAsObject = option;
6289
6386
  const chipError = hasStringValue ? undefined : optionAsObject.error;
@@ -6433,7 +6530,7 @@ const DotAutoComplete = ({
6433
6530
  // If simple text, we need to give it a class so that styling for
6434
6531
  // displaying ellipsis on a long text can be applied. If it is
6435
6532
  // custom node coming from the consumer, then leave it as it is.
6436
- const itemTextNode = isString$1(itemText) ? jsx("span", {
6533
+ const itemTextNode = isString$2(itemText) ? jsx("span", {
6437
6534
  className: "dot-action-item-text",
6438
6535
  children: itemText
6439
6536
  }) : itemText;
@@ -6509,7 +6606,7 @@ const DotAutoComplete = ({
6509
6606
  values
6510
6607
  });
6511
6608
  const handleTagsRender = () => {
6512
- if (!multiple || isString$1(defaultValue)) return;
6609
+ if (!multiple || isString$2(defaultValue)) return;
6513
6610
  return renderTags || handleRenderChips;
6514
6611
  };
6515
6612
  const renderErrorOrWarningIcon = () => {
@@ -6547,7 +6644,7 @@ const DotAutoComplete = ({
6547
6644
  },
6548
6645
  "data-pendoid": dataPendoId,
6549
6646
  "data-testid": dataTestId,
6550
- defaultValue: multiple && isString$1(defaultValue) ? [defaultValue] : defaultValue,
6647
+ defaultValue: multiple && isString$2(defaultValue) ? [defaultValue] : defaultValue,
6551
6648
  disabled: disabled,
6552
6649
  filterOptions: filterOptions,
6553
6650
  filterSelectedOptions: filterSelectedOptions,
@@ -6555,6 +6652,7 @@ const DotAutoComplete = ({
6555
6652
  getOptionLabel: option => parseAutoCompleteValue(option),
6556
6653
  getOptionDisabled: checkIfOptionDisabled,
6557
6654
  groupBy: group ? option => option.group : undefined,
6655
+ id: inputId,
6558
6656
  inputValue: inputValue,
6559
6657
  isOptionEqualToValue: isOptionEqualToValue,
6560
6658
  ListboxComponent: ListboxComponent,
@@ -8174,125 +8272,2528 @@ const CssGridDebug = ({
8174
8272
  });
8175
8273
  };
8176
8274
 
8177
- const rootClassName$z = 'dot-empty-state';
8178
- const StyledEmptyState = styled.div`
8179
- ${({
8180
- theme
8181
- }) => css`
8182
- &.dot-empty-state {
8183
- margin: 0 auto;
8184
- max-width: 600px;
8185
- text-align: center;
8186
-
8187
- .empty-state-image-container {
8188
- display: flex;
8189
- justify-content: center;
8190
- }
8191
-
8192
- .empty-state-image {
8193
- min-height: ${theme.spacing(10)};
8194
- margin-bottom: ${theme.spacing(5)};
8195
- }
8196
-
8197
- h2 {
8198
- margin-bottom: ${theme.spacing(1)};
8199
- }
8200
-
8201
- .dot-tooltip {
8202
- display: inline-block;
8203
- }
8204
-
8205
- .dot-button {
8206
- margin-top: ${theme.spacing(4)};
8207
- }
8208
- }
8209
- `}
8210
- `;
8211
-
8212
- const rootClassName$y = 'dot-illustration';
8213
- const StyledIllustration = styled.span`
8214
- &.${rootClassName$y} {
8215
- display: inline-block;
8216
- }
8217
- `;
8218
-
8219
- const DotIllustration = ({
8220
- alt,
8221
- ariaLabel,
8222
- ariaRole = 'img',
8223
- className,
8224
- 'data-testid': dataTestId,
8225
- illustrationId,
8226
- theme = 'light',
8227
- title,
8228
- tooltip,
8229
- tooltipPlacement = 'right-end'
8230
- }) => {
8231
- const rootClasses = useStylesWithRootClass(rootClassName$y, className);
8232
- return jsx(DotTooltip, {
8233
- title: tooltip,
8234
- placement: tooltipPlacement,
8235
- "data-testid": `${dataTestId || rootClassName$y}-tooltip`,
8236
- children: jsx(StyledIllustration, {
8237
- "aria-hidden": "false",
8238
- "aria-label": ariaLabel || title || 'Illustration',
8239
- className: rootClasses,
8240
- "data-testid": dataTestId || rootClassName$y,
8241
- role: ariaRole,
8242
- children: jsx("img", {
8243
- alt: alt || 'Illustration',
8244
- "aria-label": ariaLabel || title || 'Illustration',
8245
- className: `illustration-${illustrationId}-${theme} dot-img`,
8246
- "data-testid": dataTestId && `${dataTestId}-img`,
8247
- role: ariaRole,
8248
- title: title || 'Illustration'
8249
- })
8250
- })
8251
- });
8252
- };
8253
-
8254
- const DotEmptyState = ({
8275
+ const DotInputSelect = ({
8255
8276
  ariaLabel,
8256
- buttonProps,
8277
+ autoFocus,
8257
8278
  className,
8279
+ 'data-pendoid': dataPendoId = rootSelectClassName,
8258
8280
  'data-testid': dataTestId,
8259
- illustrationId,
8260
- imageAltText,
8261
- imageSrc,
8262
- subtitle,
8263
- title
8281
+ defaultValue,
8282
+ disabled = false,
8283
+ endIcon,
8284
+ endText,
8285
+ error = false,
8286
+ fullWidth = true,
8287
+ helperText,
8288
+ id,
8289
+ inputRef,
8290
+ label,
8291
+ name,
8292
+ onBlur,
8293
+ onChange,
8294
+ onFocus,
8295
+ onKeyDown,
8296
+ options = [],
8297
+ persistentLabel,
8298
+ readOnly = false,
8299
+ required,
8300
+ shrink,
8301
+ size = 'small',
8302
+ startIcon,
8303
+ success,
8304
+ value,
8305
+ warning = false
8264
8306
  }) => {
8265
- const rootClasses = useStylesWithRootClass(rootClassName$z, className);
8266
- return jsxs(StyledEmptyState, {
8267
- "aria-label": ariaLabel,
8268
- className: rootClasses,
8269
- "data-testid": dataTestId,
8270
- children: [jsxs("div", {
8271
- className: "empty-state-image-container",
8272
- children: [illustrationId && jsx(DotIllustration, {
8273
- alt: imageAltText || title,
8274
- className: "empty-state-image",
8275
- illustrationId: illustrationId,
8276
- title: imageAltText || title
8277
- }), !illustrationId && imageSrc && jsx("img", {
8278
- alt: imageAltText || title,
8279
- className: "empty-state-image",
8280
- src: imageSrc,
8281
- title: imageAltText || title
8282
- })]
8283
- }), jsx(DotTypography, {
8284
- variant: "h2",
8285
- children: title
8286
- }), subtitle && jsx(DotTypography, {
8287
- variant: "body1",
8288
- children: subtitle
8289
- }), buttonProps && jsx(DotButton, Object.assign({}, buttonProps))]
8290
- });
8291
- };
8292
-
8293
- const DotEmptyFilterState = ({
8294
- ariaLabel,
8295
- className,
8307
+ const hasWarning = !error && warning && warningClassName;
8308
+ const hasSuccess = !error && !warning && success && successClassName;
8309
+ const endAdornment = endIcon || endText;
8310
+ const inputStyles = useStylesWithRootClass('dot-select', readOnly && readOnlyClassName$1);
8311
+ const rootStyles = useStylesWithRootClass(rootSelectClassName, hasSuccess, hasWarning);
8312
+ const getOption = option => {
8313
+ return typeof option === 'string' ? option : option.option;
8314
+ };
8315
+ const getValue = option => {
8316
+ return typeof option === 'string' ? option : (option === null || option === void 0 ? void 0 : option.value) || option.option;
8317
+ };
8318
+ return jsxs("div", {
8319
+ className: className,
8320
+ children: [persistentLabel && jsx(DotInputLabel, {
8321
+ disabled,
8322
+ error,
8323
+ id,
8324
+ label,
8325
+ required
8326
+ }), jsx(StyledTextField, {
8327
+ InputProps: {
8328
+ startAdornment: startIcon && jsx(StyledAdornment, {
8329
+ className: `${adornmentIconClassName} start`,
8330
+ position: "start",
8331
+ children: startIcon
8332
+ }),
8333
+ endAdornment: endAdornment && jsx(StyledAdornment, {
8334
+ className: `${adornmentIconClassName} end`,
8335
+ position: "end",
8336
+ children: endAdornment
8337
+ })
8338
+ },
8339
+ SelectProps: {
8340
+ native: !readOnly,
8341
+ readOnly,
8342
+ open: readOnly ? false : undefined
8343
+ },
8344
+ "aria-label": ariaLabel || label,
8345
+ autoFocus: autoFocus,
8346
+ className: rootStyles,
8347
+ defaultValue: defaultValue,
8348
+ disabled: disabled,
8349
+ error: error,
8350
+ fullWidth: fullWidth,
8351
+ helperText: helperText,
8352
+ id: id,
8353
+ InputLabelProps: {
8354
+ shrink: shrink
8355
+ },
8356
+ inputProps: {
8357
+ 'aria-label': ariaLabel,
8358
+ 'data-pendoid': dataPendoId,
8359
+ 'data-testid': dataTestId,
8360
+ className: inputStyles,
8361
+ readOnly
8362
+ },
8363
+ inputRef: inputRef,
8364
+ label: persistentLabel ? null : label,
8365
+ multiline: false,
8366
+ name: name,
8367
+ onBlur: onBlur,
8368
+ onChange: onChange,
8369
+ onFocus: onFocus,
8370
+ onKeyDown: onKeyDown,
8371
+ required: required,
8372
+ role: "textbox",
8373
+ select: true,
8374
+ size: size,
8375
+ value: value,
8376
+ variant: "outlined",
8377
+ children: options.map(option => jsx("option", {
8378
+ className: "dot-option",
8379
+ value: getValue(option),
8380
+ children: getOption(option)
8381
+ }, getValue(option)))
8382
+ })]
8383
+ });
8384
+ };
8385
+
8386
+ class ApiError extends Error {
8387
+ constructor(response, message) {
8388
+ super(message);
8389
+ this.url = response.url;
8390
+ this.status = response.status;
8391
+ this.statusText = response.statusText;
8392
+ this.body = response.body;
8393
+ }
8394
+ }
8395
+
8396
+ const OpenAPI = {
8397
+ BASE: '',
8398
+ VERSION: '0.1',
8399
+ WITH_CREDENTIALS: false,
8400
+ TOKEN: undefined,
8401
+ USERNAME: undefined,
8402
+ PASSWORD: undefined,
8403
+ HEADERS: undefined,
8404
+ ENCODE_PATH: undefined
8405
+ };
8406
+
8407
+ /* istanbul ignore file */
8408
+ /* tslint:disable */
8409
+ /* eslint-disable */
8410
+ var DashboardCreateBody;
8411
+ (function (DashboardCreateBody) {
8412
+ (function (lifecycle_state) {
8413
+ lifecycle_state["DRAFT"] = "DRAFT";
8414
+ lifecycle_state["PUBLISHED"] = "PUBLISHED";
8415
+ })(DashboardCreateBody.lifecycle_state || (DashboardCreateBody.lifecycle_state = {}));
8416
+ (function (bi_type) {
8417
+ bi_type["SUPERSET"] = "SUPERSET";
8418
+ bi_type["MICROSTRATEGY"] = "MICROSTRATEGY";
8419
+ })(DashboardCreateBody.bi_type || (DashboardCreateBody.bi_type = {}));
8420
+ })(DashboardCreateBody || (DashboardCreateBody = {}));
8421
+
8422
+ /* istanbul ignore file */
8423
+ /* tslint:disable */
8424
+ /* eslint-disable */
8425
+ var DashboardPatchBody;
8426
+ (function (DashboardPatchBody) {
8427
+ (function (lifecycle_state) {
8428
+ lifecycle_state["DRAFT"] = "DRAFT";
8429
+ lifecycle_state["PUBLISHED"] = "PUBLISHED";
8430
+ })(DashboardPatchBody.lifecycle_state || (DashboardPatchBody.lifecycle_state = {}));
8431
+ (function (bi_type) {
8432
+ bi_type["SUPERSET"] = "SUPERSET";
8433
+ bi_type["MICROSTRATEGY"] = "MICROSTRATEGY";
8434
+ })(DashboardPatchBody.bi_type || (DashboardPatchBody.bi_type = {}));
8435
+ })(DashboardPatchBody || (DashboardPatchBody = {}));
8436
+
8437
+ /* istanbul ignore file */
8438
+ /* tslint:disable */
8439
+ /* eslint-disable */
8440
+ var DashboardPutBody;
8441
+ (function (DashboardPutBody) {
8442
+ (function (lifecycle_state) {
8443
+ lifecycle_state["DRAFT"] = "DRAFT";
8444
+ lifecycle_state["PUBLISHED"] = "PUBLISHED";
8445
+ })(DashboardPutBody.lifecycle_state || (DashboardPutBody.lifecycle_state = {}));
8446
+ (function (bi_type) {
8447
+ bi_type["SUPERSET"] = "SUPERSET";
8448
+ bi_type["MICROSTRATEGY"] = "MICROSTRATEGY";
8449
+ })(DashboardPutBody.bi_type || (DashboardPutBody.bi_type = {}));
8450
+ })(DashboardPutBody || (DashboardPutBody = {}));
8451
+
8452
+ /* istanbul ignore file */
8453
+ /* tslint:disable */
8454
+ /* eslint-disable */
8455
+ var DashboardView;
8456
+ (function (DashboardView) {
8457
+ (function (lifecycle_state) {
8458
+ lifecycle_state["DRAFT"] = "DRAFT";
8459
+ lifecycle_state["PUBLISHED"] = "PUBLISHED";
8460
+ })(DashboardView.lifecycle_state || (DashboardView.lifecycle_state = {}));
8461
+ (function (bi_type) {
8462
+ bi_type["SUPERSET"] = "SUPERSET";
8463
+ bi_type["MICROSTRATEGY"] = "MICROSTRATEGY";
8464
+ })(DashboardView.bi_type || (DashboardView.bi_type = {}));
8465
+ })(DashboardView || (DashboardView = {}));
8466
+
8467
+ function isDefined(value) {
8468
+ return value !== undefined && value !== null;
8469
+ }
8470
+ function isString(value) {
8471
+ return typeof value === 'string';
8472
+ }
8473
+ function isStringWithValue(value) {
8474
+ return isString(value) && value !== '';
8475
+ }
8476
+ function isBlob(value) {
8477
+ return value instanceof Blob;
8478
+ }
8479
+ function base64(str) {
8480
+ try {
8481
+ return btoa(str);
8482
+ } catch (err) {
8483
+ return Buffer.from(str).toString('base64');
8484
+ }
8485
+ }
8486
+ function getQueryString(params) {
8487
+ const qs = [];
8488
+ Object.keys(params).forEach(key => {
8489
+ const value = params[key];
8490
+ if (isDefined(value)) {
8491
+ if (Array.isArray(value)) {
8492
+ value.forEach(value => {
8493
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
8494
+ });
8495
+ } else {
8496
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
8497
+ }
8498
+ }
8499
+ });
8500
+ if (qs.length > 0) {
8501
+ return `?${qs.join('&')}`;
8502
+ }
8503
+ return '';
8504
+ }
8505
+ function getUrl(options) {
8506
+ const path = options.path;
8507
+ const url = `${OpenAPI.BASE}${path}`;
8508
+ if (options.query) {
8509
+ return `${url}${getQueryString(options.query)}`;
8510
+ }
8511
+ return url;
8512
+ }
8513
+ function getFormData(params) {
8514
+ const formData = new FormData();
8515
+ Object.keys(params).forEach(key => {
8516
+ const value = params[key];
8517
+ if (isDefined(value)) {
8518
+ formData.append(key, value);
8519
+ }
8520
+ });
8521
+ return formData;
8522
+ }
8523
+ function resolve(options, resolver) {
8524
+ return __awaiter(this, void 0, void 0, function* () {
8525
+ if (typeof resolver === 'function') {
8526
+ return resolver(options);
8527
+ }
8528
+ return resolver;
8529
+ });
8530
+ }
8531
+ function getHeaders(options) {
8532
+ return __awaiter(this, void 0, void 0, function* () {
8533
+ const token = yield resolve(options, OpenAPI.TOKEN);
8534
+ const username = yield resolve(options, OpenAPI.USERNAME);
8535
+ const password = yield resolve(options, OpenAPI.PASSWORD);
8536
+ const additionalHeaders = yield resolve(options, OpenAPI.HEADERS);
8537
+ const defaultHeaders = Object.entries(Object.assign(Object.assign({
8538
+ Accept: 'application/json'
8539
+ }, additionalHeaders), options.headers)).filter(([key, value]) => isDefined(value)).reduce((headers, [key, value]) => Object.assign(Object.assign({}, headers), {
8540
+ [key]: value
8541
+ }), {});
8542
+ const headers = new Headers(defaultHeaders);
8543
+ if (isStringWithValue(token)) {
8544
+ headers.append('Authorization', `Bearer ${token}`);
8545
+ }
8546
+ if (isStringWithValue(username) && isStringWithValue(password)) {
8547
+ const credentials = base64(`${username}:${password}`);
8548
+ headers.append('Authorization', `Basic ${credentials}`);
8549
+ }
8550
+ if (options.body) {
8551
+ if (options.mediaType) {
8552
+ headers.append('Content-Type', options.mediaType);
8553
+ } else if (isBlob(options.body)) {
8554
+ headers.append('Content-Type', options.body.type || 'application/octet-stream');
8555
+ } else if (isString(options.body)) {
8556
+ headers.append('Content-Type', 'text/plain');
8557
+ } else {
8558
+ headers.append('Content-Type', 'application/json');
8559
+ }
8560
+ }
8561
+ return headers;
8562
+ });
8563
+ }
8564
+ function getRequestBody(options) {
8565
+ var _a;
8566
+ if (options.formData) {
8567
+ return getFormData(options.formData);
8568
+ }
8569
+ if (options.body) {
8570
+ if ((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes('/json')) {
8571
+ return JSON.stringify(options.body);
8572
+ } else if (isString(options.body) || isBlob(options.body)) {
8573
+ return options.body;
8574
+ } else {
8575
+ return JSON.stringify(options.body);
8576
+ }
8577
+ }
8578
+ return undefined;
8579
+ }
8580
+ function sendRequest(options, url) {
8581
+ return __awaiter(this, void 0, void 0, function* () {
8582
+ const request = {
8583
+ method: options.method,
8584
+ headers: yield getHeaders(options),
8585
+ body: getRequestBody(options)
8586
+ };
8587
+ return yield fetch(url, request);
8588
+ });
8589
+ }
8590
+ function getResponseHeader(response, responseHeader) {
8591
+ if (responseHeader) {
8592
+ const content = response.headers.get(responseHeader);
8593
+ if (isString(content)) {
8594
+ return content;
8595
+ }
8596
+ }
8597
+ return null;
8598
+ }
8599
+ function getResponseBody(response) {
8600
+ return __awaiter(this, void 0, void 0, function* () {
8601
+ if (response.status !== 204) {
8602
+ try {
8603
+ const contentType = response.headers.get('Content-Type');
8604
+ if (contentType) {
8605
+ const isJSON = contentType.toLowerCase().startsWith('application/json');
8606
+ if (isJSON) {
8607
+ return yield response.json();
8608
+ } else {
8609
+ return yield response.text();
8610
+ }
8611
+ }
8612
+ } catch (error) {
8613
+ console.error(error);
8614
+ }
8615
+ }
8616
+ return null;
8617
+ });
8618
+ }
8619
+ function catchErrors(options, result) {
8620
+ const errors = Object.assign({
8621
+ 400: 'Bad Request',
8622
+ 401: 'Unauthorized',
8623
+ 403: 'Forbidden',
8624
+ 404: 'Not Found',
8625
+ 500: 'Internal Server Error',
8626
+ 502: 'Bad Gateway',
8627
+ 503: 'Service Unavailable'
8628
+ }, options.errors);
8629
+ const error = errors[result.status];
8630
+ if (error) {
8631
+ throw new ApiError(result, error);
8632
+ }
8633
+ if (!result.ok) {
8634
+ throw new ApiError(result, 'Generic Error');
8635
+ }
8636
+ }
8637
+ /**
8638
+ * Request using fetch client
8639
+ * @param options The request options from the the service
8640
+ * @returns ApiResult
8641
+ * @throws ApiError
8642
+ */
8643
+ function request(options) {
8644
+ return __awaiter(this, void 0, void 0, function* () {
8645
+ const url = getUrl(options);
8646
+ const response = yield sendRequest(options, url);
8647
+ const responseBody = yield getResponseBody(response);
8648
+ const responseHeader = getResponseHeader(response, options.responseHeader);
8649
+ const result = {
8650
+ url,
8651
+ ok: response.ok,
8652
+ status: response.status,
8653
+ statusText: response.statusText,
8654
+ body: responseHeader || responseBody
8655
+ };
8656
+ catchErrors(options, result);
8657
+ return result;
8658
+ });
8659
+ }
8660
+
8661
+ class CategoriesService {
8662
+ /**
8663
+ * Get a list of Categories by Application type.
8664
+ * Return a list of Categories by Application type.
8665
+ * @returns AllCategoriesResponse OK
8666
+ * @returns Error Default error response
8667
+ * @throws ApiError
8668
+ */
8669
+ static getCategoriesService() {
8670
+ return __awaiter(this, void 0, void 0, function* () {
8671
+ const result = yield request({
8672
+ method: 'GET',
8673
+ path: `/metadata/bi/categories`,
8674
+ errors: {
8675
+ 401: `Could not resolve a valid Tenant from the provided API Token.`
8676
+ }
8677
+ });
8678
+ return result.body;
8679
+ });
8680
+ }
8681
+ /**
8682
+ * Get Categories for a single application type.
8683
+ * Return all Categories for a single application type.
8684
+ * @param appType
8685
+ * @returns CategoriesResponse OK
8686
+ * @returns Error Default error response
8687
+ * @throws ApiError
8688
+ */
8689
+ static getCategoriesService1(appType) {
8690
+ return __awaiter(this, void 0, void 0, function* () {
8691
+ const result = yield request({
8692
+ method: 'GET',
8693
+ path: `/metadata/bi/categories/${appType}`,
8694
+ errors: {
8695
+ 400: `Given app type is not valid.`,
8696
+ 401: `Could not resolve a valid Tenant from the provided API Token.`
8697
+ }
8698
+ });
8699
+ return result.body;
8700
+ });
8701
+ }
8702
+ }
8703
+
8704
+ class DashboardsService {
8705
+ /**
8706
+ * Get a list of Dashboards.
8707
+ * Return a list of Dashboard definitions, filtered by query parameters.
8708
+ * @param start Offset of the first fetched item.
8709
+ * @param count Maximum number of fetched items.
8710
+ * @param sort Sort ordering to apply to the query.
8711
+ * @param filter List of filters (each filter is a separate query param, and they are OR'ed).
8712
+ *
8713
+ * * **Filterable field names**: author_fullname, author_id, bi_type, categories, created_dt, description, external_embedding_id, external_id, id, is_ootb_dashboard, lifecycle_state, name, target_apps, updated_dt
8714
+ * * **Searchable field names**: author_fullname, categories, description, name
8715
+ *
8716
+ * @param favorite Boolean flag to only return dashboards marked as favorites.
8717
+ * @param q Case-insensitive search of all text fields.
8718
+ * @param authorFullname String match on Dashboard author fullname.
8719
+ * @param authorId String match on Dashboard author user id.
8720
+ * @param biType String match on Dashboard bi type - 'MICROSTRATEGY'.
8721
+ * @param description String match on Dashboard description.
8722
+ * @param id Dashboard ID.
8723
+ * @param isOotbDashboard Boolean match on Dashboard OOTB status.
8724
+ * @param lifecycleState String match on Dashboard lifecycle state - 'DRAFT' or 'PUBLISHED'.
8725
+ * @param name String match on Dashboard name.
8726
+ * @param targetApp String match on the Dashboard target application - 'AGILITY', 'CONTINUOUSTEST', 'DEPLOY' or 'RELEASE'.
8727
+ * @returns DashboardViewPagedResponse OK
8728
+ * @returns Error Default error response
8729
+ * @throws ApiError
8730
+ */
8731
+ static getDashboardsService(start, count = 20, sort = 'id', filter, favorite = null, q = null, authorFullname = null, authorId = null, biType = 'MICROSTRATEGY', description = null, id = null, isOotbDashboard = null, lifecycleState = null, name = null, targetApp = null) {
8732
+ return __awaiter(this, void 0, void 0, function* () {
8733
+ const result = yield request({
8734
+ method: 'GET',
8735
+ path: `/metadata/bi/dashboards`,
8736
+ query: {
8737
+ start: start,
8738
+ count: count,
8739
+ sort: sort,
8740
+ filter: filter,
8741
+ favorite: favorite,
8742
+ q: q,
8743
+ author_fullname: authorFullname,
8744
+ author_id: authorId,
8745
+ bi_type: biType,
8746
+ description: description,
8747
+ id: id,
8748
+ is_ootb_dashboard: isOotbDashboard,
8749
+ lifecycle_state: lifecycleState,
8750
+ name: name,
8751
+ target_app: targetApp
8752
+ },
8753
+ errors: {
8754
+ 400: `An unknown parameter was specified.`,
8755
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
8756
+ 422: `Unprocessable Entity`
8757
+ }
8758
+ });
8759
+ return result.body;
8760
+ });
8761
+ }
8762
+ /**
8763
+ * Create a Dashboard definition.
8764
+ * Creates a Dashboard definition.
8765
+ * @param requestBody
8766
+ * @returns DashboardView Dashboard created.
8767
+ * @returns Error Default error response
8768
+ * @throws ApiError
8769
+ */
8770
+ static postDashboardsService(requestBody) {
8771
+ return __awaiter(this, void 0, void 0, function* () {
8772
+ const result = yield request({
8773
+ method: 'POST',
8774
+ path: `/metadata/bi/dashboards`,
8775
+ body: requestBody,
8776
+ mediaType: 'application/json',
8777
+ errors: {
8778
+ 400: `The provided data is not valid.`,
8779
+ 404: `The dashboard could not be found.`,
8780
+ 422: `Unprocessable Entity`
8781
+ }
8782
+ });
8783
+ return result.body;
8784
+ });
8785
+ }
8786
+ /**
8787
+ * Get one Dashboard definition.
8788
+ * Return a single Dashboard definition, selected by ID.
8789
+ * @param dashboardId
8790
+ * @returns DashboardView OK
8791
+ * @returns Error Default error response
8792
+ * @throws ApiError
8793
+ */
8794
+ static getDashboardsService1(dashboardId) {
8795
+ return __awaiter(this, void 0, void 0, function* () {
8796
+ const result = yield request({
8797
+ method: 'GET',
8798
+ path: `/metadata/bi/dashboards/${dashboardId}`,
8799
+ errors: {
8800
+ 400: `An unknown parameter was specified.`,
8801
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
8802
+ 404: `The dashboard could not be found.`
8803
+ }
8804
+ });
8805
+ return result.body;
8806
+ });
8807
+ }
8808
+ /**
8809
+ * Sets a single Dashboard definition.
8810
+ * Sets a Dashboard definition, selected by ID.
8811
+ * @param dashboardId
8812
+ * @param requestBody
8813
+ * @param isSync Sync the dashboard with BI
8814
+ * @returns DashboardView Dashboard updated.
8815
+ * @returns Error Default error response
8816
+ * @throws ApiError
8817
+ */
8818
+ static putDashboardsService(dashboardId, requestBody, isSync = null) {
8819
+ return __awaiter(this, void 0, void 0, function* () {
8820
+ const result = yield request({
8821
+ method: 'PUT',
8822
+ path: `/metadata/bi/dashboards/${dashboardId}`,
8823
+ query: {
8824
+ is_sync: isSync
8825
+ },
8826
+ body: requestBody,
8827
+ mediaType: 'application/json',
8828
+ errors: {
8829
+ 400: `The provided data is not valid.`,
8830
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
8831
+ 404: `The dashboard could not be found.`,
8832
+ 409: `Unable to update object because IDs are different.`,
8833
+ 422: `Unprocessable Entity`
8834
+ }
8835
+ });
8836
+ return result.body;
8837
+ });
8838
+ }
8839
+ /**
8840
+ * Updates a single Dashboard definition.
8841
+ * Updates a Dashboard definition, selected by ID.
8842
+ * @param dashboardId
8843
+ * @param requestBody
8844
+ * @param isSync Sync the dashboard with BI
8845
+ * @returns DashboardView Dashboard updated.
8846
+ * @returns Error Default error response
8847
+ * @throws ApiError
8848
+ */
8849
+ static patchDashboardsService(dashboardId, requestBody, isSync = null) {
8850
+ return __awaiter(this, void 0, void 0, function* () {
8851
+ const result = yield request({
8852
+ method: 'PATCH',
8853
+ path: `/metadata/bi/dashboards/${dashboardId}`,
8854
+ query: {
8855
+ is_sync: isSync
8856
+ },
8857
+ body: requestBody,
8858
+ mediaType: 'application/json',
8859
+ errors: {
8860
+ 400: `The provided data is not valid.`,
8861
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
8862
+ 404: `The dashboard could not be found.`,
8863
+ 409: `Unable to update object because IDs are different.`,
8864
+ 422: `Unprocessable Entity`
8865
+ }
8866
+ });
8867
+ return result.body;
8868
+ });
8869
+ }
8870
+ /**
8871
+ * Delete a Dashboard definition.
8872
+ * Deletes a single Dashboard definition, selected by ID.
8873
+ * @param dashboardId
8874
+ * @returns Error Default error response
8875
+ * @throws ApiError
8876
+ */
8877
+ static deleteDashboardsService(dashboardId) {
8878
+ return __awaiter(this, void 0, void 0, function* () {
8879
+ const result = yield request({
8880
+ method: 'DELETE',
8881
+ path: `/metadata/bi/dashboards/${dashboardId}`
8882
+ });
8883
+ return result.body;
8884
+ });
8885
+ }
8886
+ /**
8887
+ * Create a copy of existing dashboard
8888
+ * Create a copy of existing dashboard
8889
+ * @param dashboardId
8890
+ * @param requestBody
8891
+ * @returns DashboardView Dashboard copied.
8892
+ * @returns Error Default error response
8893
+ * @throws ApiError
8894
+ */
8895
+ static postDashboardsService1(dashboardId, requestBody) {
8896
+ return __awaiter(this, void 0, void 0, function* () {
8897
+ const result = yield request({
8898
+ method: 'POST',
8899
+ path: `/metadata/bi/dashboards/${dashboardId}/copy`,
8900
+ body: requestBody,
8901
+ mediaType: 'application/json',
8902
+ errors: {
8903
+ 400: `The provided data is not valid.`,
8904
+ 404: `The dashboard could not be found.`,
8905
+ 422: `Unprocessable Entity`
8906
+ }
8907
+ });
8908
+ return result.body;
8909
+ });
8910
+ }
8911
+ /**
8912
+ * Favorite a dashboard
8913
+ * Favorite a dashboard
8914
+ * @param dashboardId
8915
+ * @returns DashboardView Dashboard favorited.
8916
+ * @returns Error Default error response
8917
+ * @throws ApiError
8918
+ */
8919
+ static postDashboardsService2(dashboardId) {
8920
+ return __awaiter(this, void 0, void 0, function* () {
8921
+ const result = yield request({
8922
+ method: 'POST',
8923
+ path: `/metadata/bi/dashboards/${dashboardId}/favorite`,
8924
+ errors: {
8925
+ 400: `The provided data is not valid.`,
8926
+ 404: `The dashboard could not be found.`
8927
+ }
8928
+ });
8929
+ return result.body;
8930
+ });
8931
+ }
8932
+ /**
8933
+ * Un-favorite a dashboard
8934
+ * Un-favorite a dashboard
8935
+ * @param dashboardId
8936
+ * @returns DashboardView Dashboard un-favorited.
8937
+ * @returns Error Default error response
8938
+ * @throws ApiError
8939
+ */
8940
+ static deleteDashboardsService1(dashboardId) {
8941
+ return __awaiter(this, void 0, void 0, function* () {
8942
+ const result = yield request({
8943
+ method: 'DELETE',
8944
+ path: `/metadata/bi/dashboards/${dashboardId}/favorite`,
8945
+ errors: {
8946
+ 400: `The provided data is not valid.`,
8947
+ 404: `The dashboard could not be found.`
8948
+ }
8949
+ });
8950
+ return result.body;
8951
+ });
8952
+ }
8953
+ /**
8954
+ * Get Metadata (categories and authors)
8955
+ * Return all Metadata for the given query parameters: bi_type, lifecycle_state, target_app, and/or is_ootb_dashboard
8956
+ * @param biType String match on Dashboard bi type - 'MICROSTRATEGY'.
8957
+ * @param isOotbDashboard Boolean match on Dashboard OOTB status.
8958
+ * @param lifecycleState String match on Dashboard lifecycle state - 'DRAFT' or 'PUBLISHED'.
8959
+ * @param targetApp String match on the Dashboard target application - 'AGILITY', 'CONTINUOUSTEST', 'DEPLOY' or 'RELEASE'.
8960
+ * @returns MetadataResponse OK
8961
+ * @returns Error Default error response
8962
+ * @throws ApiError
8963
+ */
8964
+ static getDashboardsService2(biType = 'MICROSTRATEGY', isOotbDashboard = null, lifecycleState = null, targetApp = null) {
8965
+ return __awaiter(this, void 0, void 0, function* () {
8966
+ const result = yield request({
8967
+ method: 'GET',
8968
+ path: `/metadata/bi/dashboards/metadata`,
8969
+ query: {
8970
+ bi_type: biType,
8971
+ is_ootb_dashboard: isOotbDashboard,
8972
+ lifecycle_state: lifecycleState,
8973
+ target_app: targetApp
8974
+ },
8975
+ errors: {
8976
+ 400: `Given query params are not valid.`,
8977
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
8978
+ 422: `Unprocessable Entity`
8979
+ }
8980
+ });
8981
+ return result.body;
8982
+ });
8983
+ }
8984
+ }
8985
+
8986
+ class HelpContentService {
8987
+ /**
8988
+ * Gets help content definitions.
8989
+ * Return help content definitions.
8990
+ * @returns HelpContentPagedResponse OK
8991
+ * @returns Error Default error response
8992
+ * @throws ApiError
8993
+ */
8994
+ static getHelpContent() {
8995
+ return __awaiter(this, void 0, void 0, function* () {
8996
+ const result = yield request({
8997
+ method: 'GET',
8998
+ path: `/metadata/bi/helpcontent`,
8999
+ errors: {
9000
+ 400: `An unknown parameter was specified.`,
9001
+ 401: `Could not resolve a valid Tenant from the provided API Token.`
9002
+ }
9003
+ });
9004
+ return result.body;
9005
+ });
9006
+ }
9007
+ /**
9008
+ * Upload an HTML file to be displayed as help content.
9009
+ * Upload help content.
9010
+ * @param requestBody
9011
+ * @returns HelpContent Content uploaded.
9012
+ * @returns Error Default error response
9013
+ * @throws ApiError
9014
+ */
9015
+ static createHelpContent(requestBody) {
9016
+ return __awaiter(this, void 0, void 0, function* () {
9017
+ const result = yield request({
9018
+ method: 'POST',
9019
+ path: `/metadata/bi/helpcontent`,
9020
+ body: requestBody,
9021
+ errors: {
9022
+ 400: `The provided data is not valid.`,
9023
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
9024
+ 422: `Unprocessable Entity`
9025
+ }
9026
+ });
9027
+ return result.body;
9028
+ });
9029
+ }
9030
+ /**
9031
+ * Get a help content definition.
9032
+ * Return a single help content definition, selected by ID.
9033
+ * @param helpContentId
9034
+ * @returns HelpContent OK
9035
+ * @returns Error Default error response
9036
+ * @throws ApiError
9037
+ */
9038
+ static getHelpContentById(helpContentId) {
9039
+ return __awaiter(this, void 0, void 0, function* () {
9040
+ const result = yield request({
9041
+ method: 'GET',
9042
+ path: `/metadata/bi/helpcontent/${helpContentId}`,
9043
+ errors: {
9044
+ 400: `An unknown parameter was specified.`,
9045
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
9046
+ 404: `The help content could not be found.`
9047
+ }
9048
+ });
9049
+ return result.body;
9050
+ });
9051
+ }
9052
+ /**
9053
+ * Update a help content definition.
9054
+ * Update a single help content definition, selected by ID.
9055
+ * @param helpContentId
9056
+ * @param requestBody
9057
+ * @returns HelpContent OK
9058
+ * @returns Error Default error response
9059
+ * @throws ApiError
9060
+ */
9061
+ static putHelpContentById(helpContentId, requestBody) {
9062
+ return __awaiter(this, void 0, void 0, function* () {
9063
+ const result = yield request({
9064
+ method: 'PUT',
9065
+ path: `/metadata/bi/helpcontent/${helpContentId}`,
9066
+ body: requestBody,
9067
+ errors: {
9068
+ 400: `An unknown parameter was specified.`,
9069
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
9070
+ 404: `The help content could not be found.`,
9071
+ 422: `Unprocessable Entity`
9072
+ }
9073
+ });
9074
+ return result.body;
9075
+ });
9076
+ }
9077
+ /**
9078
+ * Delete a help content definition.
9079
+ * Delete a single help content definition, selected by ID.
9080
+ * @param helpContentId
9081
+ * @returns Error Default error response
9082
+ * @throws ApiError
9083
+ */
9084
+ static deleteHelpContentById(helpContentId) {
9085
+ return __awaiter(this, void 0, void 0, function* () {
9086
+ const result = yield request({
9087
+ method: 'DELETE',
9088
+ path: `/metadata/bi/helpcontent/${helpContentId}`,
9089
+ errors: {
9090
+ 400: `An unknown parameter was specified.`,
9091
+ 401: `Could not resolve a valid Tenant from the provided API Token.`,
9092
+ 404: `The help content could not be found.`
9093
+ }
9094
+ });
9095
+ return result.body;
9096
+ });
9097
+ }
9098
+ }
9099
+
9100
+ const helpContent = {
9101
+ id: 'test-help-content-1',
9102
+ content: '<html><h1>Test</h1></html>'
9103
+ };
9104
+ ({
9105
+ author_fullname: 'Dashboard1 Author',
9106
+ author_id: 'id1a',
9107
+ target_apps: ['AGILITY'],
9108
+ external_id: '1',
9109
+ name: 'Test dashboard 1',
9110
+ description: '',
9111
+ dashboard_url: 'https://test.com',
9112
+ server_url: 'https://test.com',
9113
+ external_embedding_id: null,
9114
+ created_dt: '2023-11-22T06:42:07.872000',
9115
+ id: 'id1',
9116
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9117
+ application_instances: [],
9118
+ categories: [],
9119
+ bi_type: DashboardView.bi_type.SUPERSET,
9120
+ is_ootb_dashboard: false,
9121
+ thumbnail: '',
9122
+ external_object: {},
9123
+ embed_config: {},
9124
+ help_content_id: helpContent.id,
9125
+ filter_configuration: [],
9126
+ favorite: false
9127
+ });
9128
+ ({
9129
+ author_fullname: 'Dashboard2 Author',
9130
+ author_id: 'id2a',
9131
+ target_apps: ['AGILITY'],
9132
+ external_id: '2',
9133
+ name: 'dashboard2',
9134
+ description: '',
9135
+ dashboard_url: 'https://test.com',
9136
+ server_url: 'https://test.com',
9137
+ external_embedding_id: null,
9138
+ created_dt: '2023-11-22T05:42:07.872000',
9139
+ id: 'id2',
9140
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT,
9141
+ application_instances: [],
9142
+ categories: [],
9143
+ bi_type: DashboardView.bi_type.MICROSTRATEGY,
9144
+ is_ootb_dashboard: false,
9145
+ thumbnail: '',
9146
+ external_object: {},
9147
+ embed_config: {},
9148
+ help_content_id: helpContent.id,
9149
+ filter_configuration: [],
9150
+ favorite: true
9151
+ });
9152
+ ({
9153
+ author_fullname: 'Dashboard3 Author',
9154
+ author_id: 'id3a',
9155
+ target_apps: ['AGILITY'],
9156
+ external_id: '3',
9157
+ name: 'dashboard3',
9158
+ description: '',
9159
+ dashboard_url: 'https://test.com',
9160
+ server_url: 'https://test.com',
9161
+ external_embedding_id: null,
9162
+ created_dt: '2023-11-21T04:42:07.872000',
9163
+ id: 'id3',
9164
+ lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
9165
+ application_instances: [],
9166
+ categories: [],
9167
+ bi_type: DashboardView.bi_type.MICROSTRATEGY,
9168
+ is_ootb_dashboard: true,
9169
+ thumbnail: '',
9170
+ external_object: {},
9171
+ embed_config: {},
9172
+ help_content_id: helpContent.id,
9173
+ filter_configuration: [],
9174
+ favorite: false
9175
+ });
9176
+ const getCategoriesMock = {
9177
+ categories: {
9178
+ AGILITY: ['Scrum Master', 'DevOps Manager', 'Release Train Engineer', 'Agility Analytics'],
9179
+ CONTINUOUSTEST: ['User', 'Project Admin', 'Cloud Admin'],
9180
+ DEPLOY: [],
9181
+ RELEASE: ['DevOps COE', 'Engineering Manager', 'Release Manager', 'Platform Engineer', 'Platform Product Manager'],
9182
+ TEAMFORGE: ['Scrum Master']
9183
+ }
9184
+ };
9185
+ const accountId = 'acct1';
9186
+ const applicationId = 'app1';
9187
+ const nullStr = null;
9188
+ const initialAppModel = {
9189
+ id: applicationId,
9190
+ account_id: accountId,
9191
+ alternate_label: nullStr,
9192
+ description: '',
9193
+ enabled: true,
9194
+ instance_state: 0,
9195
+ needs_authentication: true,
9196
+ product_instance_id: nullStr
9197
+ };
9198
+ Object.assign(Object.assign({}, initialAppModel), {
9199
+ id: '2',
9200
+ created_date: '2023-05-31T20:27:42.326428+00:00',
9201
+ logo: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIGZpbGw9IiMzM0QzODkiLz4KPHBhdGggZD0iTTE3LjAwMzMgNy42MjMyMkgxNi40NTY3QzE2LjM5MjUgNy42Mjg2MyAxNi4zMzI0IDcuNjU2NzkgMTYuMjg3MSA3Ljc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MwNzggMTIuOTAzMyAxMS4xNzMzIDEyLjc0MzRDMTEuMTI3NyAxMi42OTEzIDExLjA4NjQgMTIuNjM1NiAxMS4wNDk5IDEyLjU3NjhDMTAuOTI2OCAxMi4zNzc2IDEwLjg1ODIgMTIuMTQ5NSAxMC44NTEyIDExLjkxNTVDMTAuODQ0MiAxMS42ODE0IDEwLjg5ODkgMTEuNDQ5NiAxMS4wMDk5IDExLjI0MzRDMTEuMDMxNCAxMS4yMTAyIDExLjAzODkgMTEuMTY5OSAxMS4wMzA4IDExLjEzMTJDMTEuMDIyNyAxMS4wOTI1IDEwLjk5OTYgMTEuMDU4NSAxMC45NjY2IDExLjAzNjhMMTAuNjMzMyAxMC43OTAxQzEwLjU4OTEgMTAuNzcxNSAxMC41Mzk2IDEwLjc2OTcgMTAuNDk0MiAxMC43ODUxQzEwLjQ0ODcgMTAuODAwNCAxMC40MTA1IDEwLjgzMTkgMTAuMzg2NiAxMC44NzM0QzEwLjIzNzYgMTEuMTQ2NSAxMC4xNTMgMTEuNDUgMTAuMTM5MSAxMS43NjA4QzEwLjEyNTMgMTIuMDcxNiAxMC4xODI1IDEyLjM4MTUgMTAuMzA2NiAxMi42NjY4QzEwLjQxMjcgMTIuOTM4IDEwLjU4MzEgMTMuMTc5NCAxMC44MDMzIDEzLjM3MDFDMTEuMTkwMiAxMy43NDYxIDExLjcxMDQgMTMuOTUzNCAxMi4yNDk5IDEzLjk0NjhDMTIuNTc0MyAxMy45NTY1IDEyLjg5NjQgMTMuODkwMiAxMy4xOTA1IDEzLjc1M0MxMy40ODQ1IDEzLjYxNTggMTMuNzQyNCAxMy40MTE2IDEzLjk0MzMgMTMuMTU2OFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=',
9202
+ logo_product_name: 'Agility',
9203
+ modified_date: '2023-06-01T18:49:20.747702+00:00',
9204
+ name: 'Agility',
9205
+ url: 'https://digital.ai/agility'
9206
+ });
9207
+ Object.assign(Object.assign({}, initialAppModel), {
9208
+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43.905064+00:00',
9213
+ name: 'Deploy',
9214
+ url: 'https://digital.ai/deploy'
9215
+ });
9216
+ Object.assign(Object.assign({}, initialAppModel), {
9217
+ id: '6',
9218
+ created_date: '2023-05-24T20:57:43.929634+00:00',
9219
+ logo: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIGZpbGw9IiNGN0I3MzEiLz4KPHBhdGggZD0iTTE3LjAxNjggMTAuNDgzNkMxNi44NTk4IDEwLjQ4MTkgMTYuNzA0IDEwLjUxMTEgMTYuNTU4MyAxMC41Njk3QzE2LjQxMjYgMTAuNjI4MiAxNi4yNzk5IDEwLjcxNSAxNi4xNjc5IDEwLjgyNDlDMTYuMDU1OCAxMC45MzQ4IDE1Ljk2NjUgMTEuMDY1OCAxNS45MDUxIDExLjIxMDNDMTUuODQzNyAxMS4zNTQ4IDE1LjgxMTQgMTEuNTEgMTUuODEwMSAxMS42NjdDMTUuODEyNSAxMS44ODg3IDE1Ljg3NTkgMTIuMTA1NiAxNS45OTM0IDEyLjI5MzZMMTUuMzI2OCAxMy4wMDM2QzE1LjEwNjIgMTIuODc2NiAxNC44NTE2IDEyLjgyMTQgMTQuNTk4MiAxMi44NDU5QzE0LjM0NDkgMTIuODcwNCAxNC4xMDU1IDEyLjk3MzMgMTMuOTEzNCAxMy4xNDAzTDEzLjIxNjggMTIuNjY3QzEzLjMyMDQgMTIuMzc1MyAxMy4zNTE0IDEyLjA2MjcgMTMuMzA3IDExLjc1NjRDMTMuMjYyNiAxMS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MTEuODAzNkMxMC4yNjYgMTEuNTc0OCAxMC4zODE2IDExLjM2NTYgMTAuNTQ5MiAxMS4yMDIxQzEwLjcxNjcgMTEuMDM4NyAxMC45Mjg4IDEwLjkyODMgMTEuMTU4OCAxMC44ODQ4QzExLjM4ODcgMTAuODQxMiAxMS42MjY0IDEwLjg2NjUgMTEuODQyMiAxMC45NTc0QzEyLjA1NzkgMTEuMDQ4MyAxMi4yNDIgMTEuMjAwNyAxMi4zNzE0IDExLjM5NTdDMTzIuNTAwOSAxMS41OTA3IDEyLjU3IDExLjgxOTYgMTIuNTcwMSAxMi4wNTM2QzEyLjU2NTcgMTIuMzcxOSAxMi40MzU3IDEyLjY3NTYgMTIuMjA4NSAxMi44OTg1QzExLjk4MTIgMTMuMTIxNCAxMS42NzUxIDEzLjI0NTQgMTEuMzU2OCAxMy4yNDM2SDExLjM1MDFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K',
9220
+ logo_product_name: 'Intelligence',
9221
+ modified_date: '2023-05-24T20:57:43.929634+00:00',
9222
+ name: 'Intelligence',
9223
+ url: 'https://digital.ai/intelligence'
9224
+ });
9225
+ Object.assign(Object.assign({}, initialAppModel), {
9226
+ id: '7',
9227
+ created_date: '2023-05-24T20:56:03.745221+00:00',
9228
+ logo: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIGZpbGw9IiMyNzlGRUEiLz4KPHBhdGggZD0iTTEyLjQzMzIgMTYuMzUzM1YxNC44MzMzSDExLjU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4wNTY3IDE1Ljg3MDFMMTYuODcwMSAxNC44MjY4TDE2Ljg4MDEgMTIuNTQzNVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=',
9229
+ logo_product_name: 'Release',
9230
+ modified_date: '2023-05-24T20:56:03.745221+00:00',
9231
+ name: 'Release',
9232
+ url: 'https://digital.ai/release'
9233
+ });
9234
+
9235
+ const ID = 'id';
9236
+ function updateItemInArray(elements, updatedItem, idProp) {
9237
+ if (elements) {
9238
+ const index = elements.findIndex(item => item[idProp] === updatedItem[idProp]);
9239
+ if (index >= 0) {
9240
+ elements[index] = Object.assign({}, updatedItem);
9241
+ }
9242
+ }
9243
+ return elements;
9244
+ }
9245
+ const handleUpdateDashboard = (dashboards, updatedDashboard) => {
9246
+ updateItemInArray(dashboards, updatedDashboard, ID);
9247
+ return dashboards;
9248
+ };
9249
+ const DotMetadataApiContext = createContext(null);
9250
+ const accountHeaderKey = 'X-Digitalai-Account-ID';
9251
+ function setAccountIdHeader(accountId) {
9252
+ const headers = OpenAPI.HEADERS;
9253
+ if (accountId) {
9254
+ if (!headers || accountHeaderKey in headers && headers[accountHeaderKey] !== accountId) {
9255
+ OpenAPI.HEADERS = {
9256
+ [accountHeaderKey]: accountId
9257
+ };
9258
+ }
9259
+ } else if (headers) {
9260
+ OpenAPI.HEADERS = null;
9261
+ }
9262
+ }
9263
+ const DotMetadataApiProvider = ({
9264
+ accountOverrideId,
9265
+ apiUrl,
9266
+ token,
9267
+ children
9268
+ }) => {
9269
+ const {
9270
+ cancelablePromise
9271
+ } = useCancelablePromise();
9272
+ const [accountId, setAccountId] = useState(accountOverrideId);
9273
+ const [categories, setCategories] = useState(null);
9274
+ const [categoriesLoading, setCategoriesLoading] = useState(true);
9275
+ const [dashboards, setDashboards] = useState();
9276
+ const [dashboardsLoading, setDashboardsLoading] = useState(true);
9277
+ const [helpContentLoading, setHelpContentLoading] = useState(true);
9278
+ const [dashboardsError, setDashboardsError] = useState(null);
9279
+ const [platformConsoleUrl, setPlatformConsoleUrl] = useState(null);
9280
+ const MOCK_API_URL = 'https://demo-mock-api';
9281
+ const memoizedValues = useMemo(() => ({
9282
+ categories,
9283
+ categoriesLoading,
9284
+ dashboards,
9285
+ dashboardsError,
9286
+ dashboardsLoading,
9287
+ helpContentLoading,
9288
+ platformConsoleUrl,
9289
+ setOverrideAccountId: id => {
9290
+ setAccountId(id);
9291
+ },
9292
+ setToken: newToken => {
9293
+ OpenAPI.TOKEN = newToken;
9294
+ setPlatformConsoleUrl(getPlatformConsoleUrlFromToken(newToken));
9295
+ },
9296
+ searchDashboards: ({
9297
+ start,
9298
+ count,
9299
+ sort,
9300
+ filter,
9301
+ q,
9302
+ authorFullname,
9303
+ authorId,
9304
+ biType,
9305
+ description,
9306
+ id,
9307
+ isOotbDashboard,
9308
+ lifecycleState,
9309
+ name,
9310
+ targetApp,
9311
+ favorite,
9312
+ returnErrors = false
9313
+ }) => {
9314
+ setAccountIdHeader(accountId);
9315
+ setDashboardsLoading(true);
9316
+ return cancelablePromise(DashboardsService.getDashboardsService(start, count, sort, filter, favorite, q, authorFullname, authorId, biType, description, id, isOotbDashboard, lifecycleState, name, targetApp)).then(response => {
9317
+ setDashboardsError(null);
9318
+ setDashboardsLoading(false);
9319
+ return response.results;
9320
+ }).catch(error => {
9321
+ setDashboardsLoading(false);
9322
+ if (returnErrors) {
9323
+ return {
9324
+ error: error.message
9325
+ };
9326
+ } else {
9327
+ setDashboardsError(error);
9328
+ return null;
9329
+ }
9330
+ });
9331
+ },
9332
+ duplicateDashboard: (dashboardId, dashboard) => {
9333
+ setAccountIdHeader(accountId);
9334
+ return cancelablePromise(DashboardsService.postDashboardsService1(dashboardId, dashboard)).then(response => {
9335
+ setDashboardsError(null);
9336
+ dashboards.push(response);
9337
+ setDashboards(dashboards.slice());
9338
+ return response;
9339
+ }).catch(error => {
9340
+ setDashboardsError(error);
9341
+ return null;
9342
+ });
9343
+ },
9344
+ favoriteDashboard: (dashboardId, favoriteValue) => {
9345
+ setAccountIdHeader(accountId);
9346
+ if (favoriteValue) {
9347
+ return cancelablePromise(DashboardsService.postDashboardsService2(dashboardId)).then(response => {
9348
+ setDashboardsError(null);
9349
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9350
+ return response;
9351
+ }).catch(error => {
9352
+ setDashboardsError(error);
9353
+ return null;
9354
+ });
9355
+ } else {
9356
+ return cancelablePromise(DashboardsService.deleteDashboardsService1(dashboardId)).then(response => {
9357
+ setDashboardsError(null);
9358
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9359
+ return response;
9360
+ }).catch(error => {
9361
+ setDashboardsError(error);
9362
+ return null;
9363
+ });
9364
+ }
9365
+ },
9366
+ updateDashboard: (dashboardId, dashboard, isSync = false) => __awaiter(void 0, void 0, void 0, function* () {
9367
+ setAccountIdHeader(accountId);
9368
+ return cancelablePromise(DashboardsService.patchDashboardsService(dashboardId, dashboard, isSync)).then(response => {
9369
+ setDashboardsError(null);
9370
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9371
+ return response;
9372
+ }).catch(error => setDashboardsError(error));
9373
+ }),
9374
+ getCategories: () => __awaiter(void 0, void 0, void 0, function* () {
9375
+ setCategoriesLoading(true);
9376
+ if (OpenAPI.BASE === MOCK_API_URL) {
9377
+ setDashboardsError(null);
9378
+ setCategoriesLoading(false);
9379
+ setCategories(getCategoriesMock);
9380
+ return getCategoriesMock;
9381
+ } else {
9382
+ return cancelablePromise(CategoriesService.getCategoriesService()).then(response => {
9383
+ setDashboardsError(null);
9384
+ setCategoriesLoading(false);
9385
+ setCategories(response);
9386
+ return response;
9387
+ }).catch(error => {
9388
+ setCategoriesLoading(false);
9389
+ setDashboardsError(error);
9390
+ return null;
9391
+ });
9392
+ }
9393
+ }),
9394
+ getDashboardHelpContent: helpContentId => __awaiter(void 0, void 0, void 0, function* () {
9395
+ setHelpContentLoading(true);
9396
+ if (OpenAPI.BASE === MOCK_API_URL) {
9397
+ setDashboardsError(null);
9398
+ setHelpContentLoading(false);
9399
+ return helpContent;
9400
+ } else {
9401
+ setAccountIdHeader(accountId);
9402
+ return cancelablePromise(HelpContentService.getHelpContentById(helpContentId)).then(response => {
9403
+ setHelpContentLoading(false);
9404
+ return response.content;
9405
+ }).catch(error => {
9406
+ setHelpContentLoading(false);
9407
+ setDashboardsError(error);
9408
+ });
9409
+ }
9410
+ })
9411
+ }), [categories, categoriesLoading, dashboards, dashboardsError, dashboardsLoading, platformConsoleUrl]);
9412
+ if (apiUrl && OpenAPI.BASE !== apiUrl) {
9413
+ OpenAPI.BASE = apiUrl;
9414
+ }
9415
+ const demoUrl = 'https://digitalai.staging.digitalai.cloud/';
9416
+ if (token && OpenAPI.TOKEN !== token) {
9417
+ OpenAPI.TOKEN = token;
9418
+ setPlatformConsoleUrl(getPlatformConsoleUrlFromToken(token));
9419
+ } else if (OpenAPI.BASE === MOCK_API_URL && platformConsoleUrl !== demoUrl) {
9420
+ setPlatformConsoleUrl(demoUrl);
9421
+ }
9422
+ return jsx(DotMetadataApiContext.Provider, {
9423
+ value: memoizedValues,
9424
+ children: children
9425
+ });
9426
+ };
9427
+ const useDotMetadataApiContext = () => {
9428
+ return useContext(DotMetadataApiContext);
9429
+ };
9430
+
9431
+ const StyledDashboardDialog = styled(DotDialog)`
9432
+ ${({
9433
+ theme
9434
+ }) => css`
9435
+ .dot-text-field {
9436
+ margin-bottom: ${theme.spacing(2)};
9437
+ width: 40vw;
9438
+ }
9439
+ .dot-autocomplete {
9440
+ margin-top: ${theme.spacing(1.5)};
9441
+ }
9442
+ .dot-input-select {
9443
+ margin-bottom: ${theme.spacing(2)};
9444
+ }
9445
+ `}
9446
+ `;
9447
+ const StyledDialogActions = styled(DialogActions)`
9448
+ padding-right: 0;
9449
+ `;
9450
+
9451
+ const DashboardAppTypeOptions = [
9452
+ // Matches target_app values in Dashboard model
9453
+ {
9454
+ option: 'Agility',
9455
+ value: 'AGILITY'
9456
+ }, {
9457
+ option: 'Release',
9458
+ value: 'RELEASE'
9459
+ }, {
9460
+ option: 'Deploy',
9461
+ value: 'DEPLOY'
9462
+ }, {
9463
+ option: 'Continuous Testing',
9464
+ value: 'CONTINUOUSTEST'
9465
+ }, {
9466
+ option: 'TeamForge',
9467
+ value: 'TEAMFORGE'
9468
+ }];
9469
+ const initialFormState = {
9470
+ categories: [],
9471
+ description: '',
9472
+ name: ''
9473
+ };
9474
+ const DASHBOARD_NAME_MAX_LENGTH = 250;
9475
+ const DASHBOARD_DESCRIPTION_MAX_LENGTH = 250;
9476
+ function DotDashboardDialog({
9477
+ availableCategories,
9478
+ copyDashboard,
9479
+ editDashboard,
9480
+ open,
9481
+ onClose,
9482
+ onSubmit,
9483
+ onContinue,
9484
+ title
9485
+ }) {
9486
+ const [isDirty, setIsDirty] = useState(false);
9487
+ const [isLoadingSubmit, setIsLoadingSubmit] = useState(false);
9488
+ const [nameError, setNameError] = useState(null);
9489
+ const [formValues, setFormValues] = useState(initialFormState);
9490
+ const {
9491
+ categories,
9492
+ description,
9493
+ name
9494
+ } = formValues;
9495
+ const {
9496
+ searchDashboards
9497
+ } = useDotMetadataApiContext();
9498
+ const {
9499
+ cancelablePromise
9500
+ } = useCancelablePromise();
9501
+ useEffect(() => {
9502
+ if (copyDashboard) {
9503
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9504
+ name: copyDashboard.name + ' (copy)',
9505
+ description: copyDashboard.description,
9506
+ categories: copyDashboard.categories
9507
+ }));
9508
+ }
9509
+ if (editDashboard) {
9510
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9511
+ name: editDashboard.name,
9512
+ description: editDashboard.description,
9513
+ categories: editDashboard.categories
9514
+ }));
9515
+ }
9516
+ return () => {
9517
+ onClose(false);
9518
+ };
9519
+ }, []);
9520
+ const handleSubmit = useCallback(returnToList => __awaiter(this, void 0, void 0, function* () {
9521
+ setIsLoadingSubmit(true);
9522
+ const useFormValues = Object.assign(Object.assign({}, formValues), {
9523
+ id: editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
9524
+ });
9525
+ const validName = yield validateName(useFormValues.name);
9526
+ if (validName) {
9527
+ yield onSubmit(useFormValues, returnToList);
9528
+ }
9529
+ setIsLoadingSubmit(false);
9530
+ }), [formValues, editDashboard]);
9531
+ const handleSubmitCreate = useCallback(() => {
9532
+ handleSubmit(false);
9533
+ }, [handleSubmit]);
9534
+ const handleSubmitEditExit = useCallback(() => {
9535
+ handleSubmit(true);
9536
+ }, [handleSubmit]);
9537
+ const handleSubmitEditContinue = useCallback(() => {
9538
+ if (isDirty || !onContinue) {
9539
+ handleSubmit(false);
9540
+ } else {
9541
+ onContinue();
9542
+ }
9543
+ }, [isDirty, handleSubmit, onContinue]);
9544
+ const handleChange = useCallback(event => {
9545
+ const targetName = event.target.name;
9546
+ const value = event.target.value;
9547
+ setNameError(null);
9548
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9549
+ [targetName]: value
9550
+ }));
9551
+ setIsDirty(true);
9552
+ }, [formValues]);
9553
+ const handleChangeCategories = useCallback((_event, options, _reason) => {
9554
+ const values = options.map(option => option.title);
9555
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9556
+ categories: values
9557
+ }));
9558
+ setIsDirty(true);
9559
+ }, [formValues]);
9560
+ const getCategoryValues = useCallback(() => categories.map(category => ({
9561
+ title: category
9562
+ })), [categories]);
9563
+ const getAvailableCategoryOptions = useCallback(() => {
9564
+ const availableCategoryOptions = [];
9565
+ if (availableCategories) {
9566
+ availableCategories.forEach(category => {
9567
+ if (!categories.includes(category)) {
9568
+ availableCategoryOptions.push({
9569
+ title: category
9570
+ });
9571
+ }
9572
+ });
9573
+ }
9574
+ return availableCategoryOptions;
9575
+ }, [availableCategories, categories]);
9576
+ const validateName = nameToValidate => __awaiter(this, void 0, void 0, function* () {
9577
+ return cancelablePromise(searchDashboards({
9578
+ name: nameToValidate
9579
+ })).then(response => {
9580
+ if (response === null || 'error' in response) {
9581
+ setNameError('Could not check existing names due to a server error.');
9582
+ return false;
9583
+ } else if (response.length > 0) {
9584
+ const matchingNames = response.filter(dashboard => dashboard.name.toLowerCase() === nameToValidate.toLowerCase() && (!editDashboard || dashboard.name !== editDashboard.name));
9585
+ if (matchingNames.length > 0) {
9586
+ setNameError(`Cannot use duplicate name '${name}'`);
9587
+ return false;
9588
+ }
9589
+ }
9590
+ return true;
9591
+ });
9592
+ });
9593
+ const handleNameBlur = useCallback(event => {
9594
+ const newName = event.target.value;
9595
+ if (newName) {
9596
+ validateName(newName);
9597
+ }
9598
+ }, [validateName]);
9599
+ return jsxs(StyledDashboardDialog, {
9600
+ cancelButtonProps: {
9601
+ 'data-testid': 'cancel-create-dashboard-button'
9602
+ },
9603
+ cancelButtonVisible: !editDashboard,
9604
+ closeOnClickAway: !editDashboard,
9605
+ closeOnSubmit: false,
9606
+ hasPrimaryAction: !editDashboard,
9607
+ open: open,
9608
+ onCancel: () => onClose(true),
9609
+ onSubmit: handleSubmitCreate,
9610
+ submitButtonProps: {
9611
+ 'data-testid': 'confirm-create-dashboard-button',
9612
+ disabled: !name || isLoadingSubmit,
9613
+ label: 'Continue'
9614
+ },
9615
+ title: title || 'Create dashboard',
9616
+ children: [jsx(DotInputText, {
9617
+ autoFocus: true,
9618
+ "data-testid": "dashboard-dialog-name-input",
9619
+ error: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH,
9620
+ helperText: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH && `Name must be ${DASHBOARD_NAME_MAX_LENGTH} characters or less`,
9621
+ id: "name",
9622
+ label: "Dashboard name",
9623
+ name: "name",
9624
+ onBlur: handleNameBlur,
9625
+ onChange: handleChange,
9626
+ required: true,
9627
+ value: name
9628
+ }), jsx(DotInputText, {
9629
+ "data-testid": "dashboard-dialog-description-input",
9630
+ error: description.length > DASHBOARD_DESCRIPTION_MAX_LENGTH,
9631
+ helperText: description.length > DASHBOARD_DESCRIPTION_MAX_LENGTH && `Description must be ${DASHBOARD_DESCRIPTION_MAX_LENGTH} characters or less`,
9632
+ id: "description",
9633
+ label: "Description",
9634
+ multiline: true,
9635
+ minRows: 4,
9636
+ maxRows: 4,
9637
+ name: "description",
9638
+ onChange: handleChange,
9639
+ value: description
9640
+ }), editDashboard && jsxs(Fragment, {
9641
+ children: [jsx(DotTypography, {
9642
+ variant: "h3",
9643
+ children: "Application type"
9644
+ }), jsx(DotInputSelect, {
9645
+ className: "dot-input-select",
9646
+ options: DashboardAppTypeOptions,
9647
+ id: "dashboard-apptype-select",
9648
+ "data-testid": "dashboard-dialog-apptype-input",
9649
+ name: "Select application",
9650
+ disabled: true,
9651
+ value: editDashboard.target_apps[0]
9652
+ })]
9653
+ }), jsx(DotTypography, {
9654
+ variant: "h3",
9655
+ children: "Category"
9656
+ }), jsx(DotTypography, {
9657
+ variant: "body2",
9658
+ children: "Please select the appropriate categories"
9659
+ }), jsx(DotAutoComplete, {
9660
+ "data-testid": "dashboard-dialog-categories-input",
9661
+ filterSelectedOptions: true,
9662
+ inputId: "dashboard-dialog-categories-input",
9663
+ onChange: handleChangeCategories,
9664
+ options: getAvailableCategoryOptions(),
9665
+ placeholder: "Select categories",
9666
+ label: "Category",
9667
+ required: editDashboard && editDashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED,
9668
+ value: getCategoryValues()
9669
+ }), editDashboard && jsx(Fragment, {
9670
+ children: jsxs(StyledDialogActions, {
9671
+ children: [jsx(DotButton, {
9672
+ className: "cancel-button",
9673
+ "data-testid": "cancel-edit-dashboard-button",
9674
+ onClick: () => onClose(true),
9675
+ type: "text",
9676
+ children: "Cancel"
9677
+ }), jsx(DotButton, {
9678
+ "data-testid": "save-edit-exit-dashboard-button",
9679
+ disabled: isLoadingSubmit || !isDirty,
9680
+ onClick: handleSubmitEditExit,
9681
+ type: "outlined",
9682
+ children: "Save and exit"
9683
+ }), jsx(DotButton, {
9684
+ "data-testid": "save-edit-continue-dashboard-button",
9685
+ disabled: isLoadingSubmit,
9686
+ onClick: handleSubmitEditContinue,
9687
+ type: "primary",
9688
+ children: isDirty ? 'Save and continue' : 'Continue'
9689
+ })]
9690
+ })
9691
+ })]
9692
+ });
9693
+ }
9694
+
9695
+ const getSnackbarTitleFromSeverity = severity => {
9696
+ switch (severity) {
9697
+ case 'success':
9698
+ return 'Success';
9699
+ case 'warning':
9700
+ return 'Warning';
9701
+ case 'error':
9702
+ return 'Error';
9703
+ case 'info':
9704
+ return 'Info';
9705
+ default:
9706
+ return 'Success';
9707
+ }
9708
+ };
9709
+ function getErrorText(error) {
9710
+ var _a, _b;
9711
+ if ('status' in error && error.status === 304) {
9712
+ return 'No changes made';
9713
+ } else if ('body' in error) {
9714
+ return ((_b = (_a = error.body) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) ? error.body.error.message : 'Unexpected API error';
9715
+ } else if ('message' in error) {
9716
+ return error.message;
9717
+ }
9718
+ return 'Unexpected API error';
9719
+ }
9720
+
9721
+ function addAutoHideDuration(severity) {
9722
+ return severity === 'error' ? null : 10000;
9723
+ }
9724
+
9725
+ const rootClassName$z = 'dot-snackbar';
9726
+ const StyledSnackbar = styled(Snackbar)`
9727
+ ${({
9728
+ theme,
9729
+ width,
9730
+ $anchorOriginTop
9731
+ }) => css`
9732
+ &.${rootClassName$z} {
9733
+ .MuiAlert-message {
9734
+ word-break: break-word;
9735
+ }
9736
+ .${rootClassName$16} {
9737
+ align-items: flex-start;
9738
+ }
9739
+ &.MuiSnackbar-anchorOriginTopLeft,
9740
+ &.MuiSnackbar-anchorOriginTopCenter,
9741
+ &.MuiSnackbar-anchorOriginTopRight {
9742
+ top: ${$anchorOriginTop}px;
9743
+ z-index: ${levelFourth};
9744
+ }
9745
+
9746
+ .dot-snackbar-actions {
9747
+ display: flex;
9748
+ align-items: center;
9749
+ margin-top: ${theme.spacing(1)};
9750
+ gap: ${theme.spacing(2)};
9751
+
9752
+ .primary-action-btn {
9753
+ background-color: transparent;
9754
+ }
9755
+ }
9756
+
9757
+ .MuiAlert-root {
9758
+ max-width: ${width ? 'unset' : '500px'};
9759
+ min-width: ${width ? 'unset' : '344px'};
9760
+ z-index: ${levelFourth};
9761
+ }
9762
+ }
9763
+ `}
9764
+ `;
9765
+
9766
+ const DEFAULT_ANCHOR_ORIGIN = {
9767
+ vertical: 'top',
9768
+ horizontal: 'right'
9769
+ };
9770
+ const DotSnackbar = ({
9771
+ anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
9772
+ anchorOriginTop = 108,
9773
+ ariaLabel,
9774
+ autoHideDuration,
9775
+ children,
9776
+ className,
9777
+ 'data-testid': dataTestId,
9778
+ hideOnClickAway = true,
9779
+ onClose,
9780
+ open,
9781
+ primaryAction,
9782
+ secondaryAction,
9783
+ severity,
9784
+ width
9785
+ }) => {
9786
+ const hasActions = !!(primaryAction || secondaryAction);
9787
+ const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
9788
+ const rootClasses = useStylesWithRootClass(rootClassName$z, className);
9789
+ const handleSnackbarClose = reason => {
9790
+ if (!reason || hideOnClickAway || !hideOnClickAway && reason !== 'clickaway') {
9791
+ onClose();
9792
+ }
9793
+ };
9794
+ return jsx(StyledSnackbar, {
9795
+ anchorOrigin: anchorOrigin,
9796
+ "$anchorOriginTop": anchorOriginTop,
9797
+ "aria-label": ariaLabel,
9798
+ autoHideDuration: calculatedAutoHideDuration,
9799
+ classes: {
9800
+ root: rootClasses
9801
+ },
9802
+ "data-testid": dataTestId,
9803
+ onClose: (_e, r) => handleSnackbarClose(r),
9804
+ open: open,
9805
+ severity: severity,
9806
+ width: width,
9807
+ children: jsx("div", {
9808
+ children: jsx(DotAlertBanner, {
9809
+ severity: severity,
9810
+ width: width,
9811
+ onClose: _e => handleSnackbarClose(),
9812
+ children: jsxs("div", {
9813
+ children: [jsx(DotTypography, {
9814
+ variant: "subtitle2",
9815
+ noMarginBottom: false,
9816
+ children: getSnackbarTitleFromSeverity(severity)
9817
+ }), isString$2(children) ? jsx(DotTypography, {
9818
+ ariaLabel: severity,
9819
+ variant: "body1",
9820
+ children: children
9821
+ }) : jsx("span", {
9822
+ "aria-label": severity,
9823
+ children: children
9824
+ }), hasActions && jsxs("div", {
9825
+ className: "dot-snackbar-actions",
9826
+ children: [primaryAction && jsx(DotButton, {
9827
+ className: "primary-action-btn",
9828
+ "data-testid": "primary-action-btn",
9829
+ onClick: primaryAction.onClick,
9830
+ size: "small",
9831
+ type: "outlined",
9832
+ children: primaryAction.label
9833
+ }), secondaryAction && jsx(DotLink, {
9834
+ "data-testid": "secondary-action-link",
9835
+ href: secondaryAction.href,
9836
+ color: "inherit",
9837
+ children: secondaryAction.label
9838
+ })]
9839
+ })]
9840
+ })
9841
+ })
9842
+ })
9843
+ });
9844
+ };
9845
+
9846
+ const rootClassName$y = 'dot-snackbar-container';
9847
+ const StyledSnackbarContainer = styled.div`
9848
+ ${() => css`
9849
+ &.${rootClassName$y} {
9850
+ position: absolute;
9851
+ top: 0;
9852
+ width: 250px;
9853
+ height: auto;
9854
+ right: 0;
9855
+ & > div {
9856
+ position: relative;
9857
+ }
9858
+ }
9859
+ `}
9860
+ `;
9861
+
9862
+ const DotSnackbarContext = createContext({
9863
+ alerts: [],
9864
+ enqueueMessage: (_message, _severity, _autoHideDuration, _primaryAction, _secondaryAction) => null,
9865
+ removeMessage: _id => null
9866
+ });
9867
+ const DotSnackbarContainer = ({
9868
+ hideOnClickAway
9869
+ }) => {
9870
+ const {
9871
+ alerts,
9872
+ removeMessage
9873
+ } = useDotSnackbarContext();
9874
+ function handleClose(id) {
9875
+ return () => {
9876
+ removeMessage(id);
9877
+ };
9878
+ }
9879
+ return jsx(StyledSnackbarContainer, {
9880
+ className: rootClassName$y,
9881
+ children: jsx("div", {
9882
+ className: rootClassName$y,
9883
+ "data-testid": rootClassName$y,
9884
+ children: alerts.slice().reverse().map(alert => {
9885
+ return jsx(DotSnackbar, {
9886
+ autoHideDuration: alert.autoHideDuration,
9887
+ hideOnClickAway: hideOnClickAway,
9888
+ onClose: handleClose(alert.id),
9889
+ open: alert.open,
9890
+ severity: alert.severity,
9891
+ primaryAction: alert.primaryAction,
9892
+ secondaryAction: alert.secondaryAction,
9893
+ children: alert.message
9894
+ }, alert.id);
9895
+ })
9896
+ })
9897
+ });
9898
+ };
9899
+ const DotSnackbarProvider = ({
9900
+ children,
9901
+ hideOnClickAway = true
9902
+ }) => {
9903
+ const [alerts, setAlerts] = useState([]);
9904
+ function enqueueMessage(message, severity, autoHideDuration, primaryAction, secondaryAction) {
9905
+ const id = CreateUUID();
9906
+ const queue = {
9907
+ id,
9908
+ message,
9909
+ severity,
9910
+ open: true,
9911
+ autoHideDuration,
9912
+ primaryAction,
9913
+ secondaryAction
9914
+ };
9915
+ setAlerts(prevState => {
9916
+ return [...prevState, Object.assign({}, queue)];
9917
+ });
9918
+ return id;
9919
+ }
9920
+ const removeMessage = id => {
9921
+ setAlerts(prev => {
9922
+ return prev.map(a => {
9923
+ return a.id === id ? Object.assign(Object.assign({}, a), {
9924
+ open: false
9925
+ }) : a;
9926
+ });
9927
+ });
9928
+ };
9929
+ const DotSnackbarValues = {
9930
+ alerts,
9931
+ enqueueMessage,
9932
+ removeMessage
9933
+ };
9934
+ const memoizedValues = useMemo(() => DotSnackbarValues, [alerts]);
9935
+ return jsxs(DotSnackbarContext.Provider, {
9936
+ value: memoizedValues,
9937
+ children: [jsx(DotSnackbarContainer, {
9938
+ hideOnClickAway: hideOnClickAway
9939
+ }), children]
9940
+ });
9941
+ };
9942
+ const useDotSnackbarContext = () => {
9943
+ return useContext(DotSnackbarContext);
9944
+ };
9945
+ const useEnqueueErrorMessage = error => {
9946
+ const {
9947
+ enqueueMessage
9948
+ } = useDotSnackbarContext();
9949
+ useEffect(() => {
9950
+ error && enqueueMessage(getErrorText(error), 'error');
9951
+ }, [error]);
9952
+ };
9953
+
9954
+ const InlineMessage = styled(DotTypography)`
9955
+ ${({
9956
+ theme
9957
+ }) => css`
9958
+ display: inline;
9959
+ margin-left: ${theme.spacing(1)};
9960
+ `}
9961
+ `;
9962
+ const StyledPublishConfirmDiv = styled.div`
9963
+ ${({
9964
+ theme
9965
+ }) => css`
9966
+ .dot-alert-banner {
9967
+ margin-bottom: ${theme.spacing(4)};
9968
+ }
9969
+ .dot-autocomplete,
9970
+ .dot-avatar {
9971
+ margin-bottom: ${theme.spacing(2)};
9972
+ }
9973
+ `}
9974
+ `;
9975
+ const StyledAppSelectDiv = styled.div`
9976
+ ${() => css`
9977
+ display: flex;
9978
+ gap: 24px;
9979
+ align-items: center;
9980
+ `}
9981
+ `;
9982
+ const StyledAppSelectDotAutoComplete = styled(DotAutoComplete)`
9983
+ width: 100%;
9984
+ `;
9985
+ const StyledAppSelectAutoCompleteOption = styled.li`
9986
+ ${({
9987
+ theme
9988
+ }) => css`
9989
+ display: flex;
9990
+ align-items: center;
9991
+ gap: 16px;
9992
+ padding: ${theme.spacing(0.75, 2, 0.75, 3)};
9993
+ &:hover,
9994
+ &:focus {
9995
+ background: ${theme.palette.grey[500]};
9996
+ }
9997
+ `}
9998
+ `;
9999
+
10000
+ const productNameCategoryMap = {
10001
+ Agility: 'AGILITY',
10002
+ Release: 'RELEASE',
10003
+ Deploy: 'DEPLOY',
10004
+ 'Continuous Testing': 'CONTINUOUSTEST',
10005
+ TeamForge: 'TEAMFORGE'
10006
+ };
10007
+ /**
10008
+ * Content displayed in the dialog when publishing
10009
+ */
10010
+ function ActivePublishMessage({
10011
+ applicationList,
10012
+ categories,
10013
+ dashboardName,
10014
+ initialCategories,
10015
+ published,
10016
+ publishing,
10017
+ onChange
10018
+ }) {
10019
+ const [selectedApp, setSelectedApp] = useState(applicationList.length > 0 ? applicationList[0] : null);
10020
+ const [selectedCategories, setSelectedCategories] = useState([]);
10021
+ const [appNameMap, setAppNameMap] = useState({});
10022
+ const [appNameMapLoading, setAppNameMapLoading] = useState(true);
10023
+ const [categoryOptions, setCategoryOptions] = useState([]);
10024
+ const appOptions = applicationList.map((application, index) => {
10025
+ return {
10026
+ title: application.name,
10027
+ imageUrl: (application === null || application === void 0 ? void 0 : application.logo) ? 'data:image/svg+xml;base64,' + application.logo : null,
10028
+ uid: index + 1
10029
+ };
10030
+ });
10031
+ useEffect(() => {
10032
+ if (applicationList) {
10033
+ const newAppNameMap = {};
10034
+ applicationList.forEach(application => {
10035
+ newAppNameMap[application.name] = application;
10036
+ });
10037
+ setAppNameMap(newAppNameMap);
10038
+ setAppNameMapLoading(false);
10039
+ }
10040
+ }, [applicationList]);
10041
+ useEffect(() => {
10042
+ const selectedCategoryOptions = [];
10043
+ if (selectedApp) {
10044
+ if (selectedApp.logo_product_name in productNameCategoryMap) {
10045
+ const categoryKey = productNameCategoryMap[selectedApp.logo_product_name];
10046
+ const appCategories = categories.categories[categoryKey];
10047
+ const newCategoryOptions = appCategories.map(category => ({
10048
+ title: category
10049
+ }));
10050
+ setCategoryOptions(newCategoryOptions);
10051
+ selectedCategoryOptions.push(...newCategoryOptions.filter(o => initialCategories.includes(o.title)));
10052
+ } else {
10053
+ setCategoryOptions([]);
10054
+ }
10055
+ } else {
10056
+ setCategoryOptions([]);
10057
+ }
10058
+ setSelectedCategories(selectedCategoryOptions);
10059
+ }, [selectedApp]);
10060
+ useEffect(() => {
10061
+ const selectedAppCategories = selectedCategories.map(c => c.title);
10062
+ onChange(selectedApp, selectedAppCategories);
10063
+ // selectedApp is excluded from dependency list on purpose
10064
+ // since selectedCategories is always updated when selectedApp changes
10065
+ }, [selectedCategories]);
10066
+ const handleApplicationSelect = useCallback((_event, value, _reason) => {
10067
+ if (value === null) {
10068
+ setSelectedApp(null);
10069
+ } else {
10070
+ let nameKey = null;
10071
+ if (typeof value === 'string') {
10072
+ nameKey = value;
10073
+ } else {
10074
+ nameKey = value.title;
10075
+ }
10076
+ const newSelectedApp = value ? appNameMap[nameKey] : null;
10077
+ setSelectedApp(newSelectedApp);
10078
+ }
10079
+ }, [appNameMap, onChange]);
10080
+ const handleChangeCategories = useCallback((_event, options, _reason) => {
10081
+ setSelectedCategories(options);
10082
+ }, []);
10083
+ if (published) {
10084
+ return jsxs(StyledPublishConfirmDiv, {
10085
+ children: [jsxs(DotAlertBanner, {
10086
+ severity: "success",
10087
+ children: ["Success! ", jsx("strong", {
10088
+ children: dashboardName
10089
+ }), " has been published."]
10090
+ }), jsxs(DotTypography, {
10091
+ children: ["To view your newly published dashboard in", ' ', jsxs("strong", {
10092
+ children: ["\"", selectedApp.name, "\""]
10093
+ }), ", go to the", ' ', jsx("strong", {
10094
+ children: "'Digital.ai Analytics'"
10095
+ }), " section and explore."]
10096
+ })]
10097
+ });
10098
+ }
10099
+ if (publishing) {
10100
+ return jsxs(Fragment, {
10101
+ children: [jsx(DotProgress, {
10102
+ ariaLabel: "Publishing",
10103
+ "data-testid": "publishing-spinner",
10104
+ size: "24px"
10105
+ }), jsxs(InlineMessage, {
10106
+ children: ["Publishing ", jsxs("strong", {
10107
+ children: ["\"", dashboardName, "\""]
10108
+ }), " to", ' ', jsxs("strong", {
10109
+ children: ["\"", selectedApp.name, "\""]
10110
+ }), "."]
10111
+ })]
10112
+ });
10113
+ }
10114
+ return jsx(StyledPublishConfirmDiv, {
10115
+ children: !appNameMapLoading && jsxs(Fragment, {
10116
+ children: [jsxs(DotAlertBanner, {
10117
+ severity: "info",
10118
+ children: ["By clicking publish to application,", ' ', jsxs("strong", {
10119
+ children: ["\"", dashboardName, "\""]
10120
+ }), " will be visible in the application instance."]
10121
+ }), jsxs(StyledAppSelectDiv, {
10122
+ children: [jsx(StyledAppSelectDotAutoComplete, {
10123
+ "data-testid": "publish-app-select",
10124
+ defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
10125
+ freesolo: false,
10126
+ multiple: false,
10127
+ filterSelectedOptions: true,
10128
+ inputId: "publish-app-select",
10129
+ label: "Select application",
10130
+ placeholder: "Select application",
10131
+ onChange: handleApplicationSelect,
10132
+ onInputChange: handleApplicationSelect,
10133
+ options: appOptions,
10134
+ required: true,
10135
+ dense: false,
10136
+ size: "medium",
10137
+ renderOption: (props, option) => {
10138
+ return jsxs(StyledAppSelectAutoCompleteOption, Object.assign({}, props, {
10139
+ children: [jsx(DotAvatar, {
10140
+ alt: "Application logo",
10141
+ imageSrc: option.imageUrl,
10142
+ iconId: "file-image",
10143
+ type: "image",
10144
+ variant: "circular",
10145
+ size: "large"
10146
+ }), jsx("div", {
10147
+ children: option.title
10148
+ })]
10149
+ }), option.uid);
10150
+ }
10151
+ }), (selectedApp === null || selectedApp === void 0 ? void 0 : selectedApp.logo) && jsx(DotAvatar, {
10152
+ alt: "Application logo",
10153
+ imageSrc: `data:${detectImageMimeType(selectedApp.logo)};base64,${selectedApp.logo}`,
10154
+ iconId: "file-image",
10155
+ type: 'image',
10156
+ variant: "circular",
10157
+ size: "large"
10158
+ })]
10159
+ }), (selectedApp === null || selectedApp === void 0 ? void 0 : selectedApp.logo_product_name) && selectedApp.logo_product_name in productNameCategoryMap && categories.categories[productNameCategoryMap[selectedApp.logo_product_name]].length > 0 && jsx(DotAutoComplete, {
10160
+ "data-testid": "publish-categories-input",
10161
+ inputId: "publish-categories-input",
10162
+ onChange: handleChangeCategories,
10163
+ options: categoryOptions,
10164
+ placeholder: "Select categories",
10165
+ value: selectedCategories,
10166
+ filterSelectedOptions: true
10167
+ }), jsxs(DotTypography, {
10168
+ children: ["You are about to publish ", jsxs("strong", {
10169
+ children: ["\"", dashboardName, "\""]
10170
+ }), ". Click", ' ', "the publish button to promote it to the selected instance."]
10171
+ })]
10172
+ })
10173
+ });
10174
+ }
10175
+ /**
10176
+ * Content displayed in the dialog when unpublishing
10177
+ */
10178
+ function ActiveUnpublishMessage({
10179
+ dashboardName,
10180
+ unpublished,
10181
+ unpublishing
10182
+ }) {
10183
+ const unpublishMessage = jsxs(DotTypography, {
10184
+ children: ["You are about to unpublish ", jsxs("strong", {
10185
+ children: ["\"", dashboardName, "\""]
10186
+ }), ". Click", ' ', jsx("strong", {
10187
+ children: "Unpublish"
10188
+ }), " to confirm."]
10189
+ });
10190
+ const unpublishingMessage = jsxs(Fragment, {
10191
+ children: [jsx(DotProgress, {
10192
+ ariaLabel: "Unpublishing",
10193
+ "data-testid": "unpublishing-spinner",
10194
+ size: "24px"
10195
+ }), jsxs(InlineMessage, {
10196
+ children: ["Unpublishing ", jsxs("strong", {
10197
+ children: ["\"", dashboardName, "\""]
10198
+ }), "."]
10199
+ })]
10200
+ });
10201
+ const unpublishedMessage = jsxs(StyledPublishConfirmDiv, {
10202
+ children: [jsxs(DotAlertBanner, {
10203
+ severity: "success",
10204
+ children: ["Success! ", jsxs("strong", {
10205
+ children: ["\"", dashboardName, "\""]
10206
+ }), " has been unpublished."]
10207
+ }), jsxs(DotTypography, {
10208
+ children: ["To view updates in the application instance, go to the", ' ', jsx("strong", {
10209
+ children: "'Digital.ai Analytics'"
10210
+ }), " section and explore."]
10211
+ })]
10212
+ });
10213
+ let activeUnpublishMesssage = unpublishMessage;
10214
+ if (unpublished) {
10215
+ activeUnpublishMesssage = unpublishedMessage;
10216
+ } else if (unpublishing) {
10217
+ activeUnpublishMesssage = unpublishingMessage;
10218
+ }
10219
+ return activeUnpublishMesssage;
10220
+ }
10221
+ function DotDashboardPublishConfirm({
10222
+ applicationList,
10223
+ categories,
10224
+ dashboardToPublish,
10225
+ dashboardToUnpublish,
10226
+ onClose,
10227
+ onStatusChanged
10228
+ }) {
10229
+ const [publishing, setPublishing] = useState(null);
10230
+ const [unpublishing, setUnpublishing] = useState(null);
10231
+ const [published, setPublished] = useState(false);
10232
+ const [unpublished, setUnpublished] = useState(false);
10233
+ const [publishAppInstance, setPublishAppInstance] = useState(null);
10234
+ const [publishCategories, setPublishCategories] = useState([]);
10235
+ const filteredApplications = applicationList === null || applicationList === void 0 ? void 0 : applicationList.filter(application => {
10236
+ return dashboardToPublish && application.logo_product_name in productNameCategoryMap && dashboardToPublish.target_apps.includes(productNameCategoryMap[application.logo_product_name]);
10237
+ });
10238
+ const {
10239
+ updateDashboard,
10240
+ dashboardsError
10241
+ } = useDotMetadataApiContext();
10242
+ const {
10243
+ cancelablePromise
10244
+ } = useCancelablePromise();
10245
+ const {
10246
+ enqueueMessage
10247
+ } = useDotSnackbarContext();
10248
+ useEnqueueErrorMessage(dashboardsError);
10249
+ useEffect(() => {
10250
+ if (dashboardToPublish === null) {
10251
+ setPublishing(null);
10252
+ setPublished(false);
10253
+ } else {
10254
+ setPublishCategories(dashboardToPublish.categories || []);
10255
+ }
10256
+ }, [dashboardToPublish]);
10257
+ useEffect(() => {
10258
+ if (dashboardToUnpublish === null) {
10259
+ setUnpublishing(null);
10260
+ setUnpublished(false);
10261
+ }
10262
+ }, [dashboardToUnpublish]);
10263
+ const handlePublish = useCallback(() => {
10264
+ const patchDashboard = {
10265
+ lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
10266
+ application_instances: [publishAppInstance.id],
10267
+ categories: publishCategories
10268
+ };
10269
+ setPublishing(cancelablePromise(updateDashboard(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
10270
+ setPublished(true);
10271
+ onStatusChanged(updatedDashboard);
10272
+ enqueueMessage('Dashboard has been published!', 'success');
10273
+ }).catch(() => {
10274
+ setPublishing(null);
10275
+ })));
10276
+ }, [dashboardToPublish, publishAppInstance, publishCategories, updateDashboard]);
10277
+ const handleCancelPublish = useCallback(() => {
10278
+ if (publishing !== null) {
10279
+ publishing.cancel();
10280
+ }
10281
+ onClose();
10282
+ }, [publishing, onClose]);
10283
+ const handleUnpublish = useCallback(() => {
10284
+ setUnpublishing(cancelablePromise(updateDashboard(dashboardToUnpublish.id, {
10285
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT
10286
+ }).then(updatedDashboard => {
10287
+ setUnpublished(true);
10288
+ onStatusChanged(updatedDashboard);
10289
+ enqueueMessage('Dashboard has been unpublished!', 'success');
10290
+ }).catch(() => {
10291
+ setUnpublishing(null);
10292
+ })));
10293
+ }, [dashboardToUnpublish, updateDashboard]);
10294
+ const handleCancelUnpublish = useCallback(() => {
10295
+ if (unpublishing !== null) {
10296
+ unpublishing.cancel();
10297
+ }
10298
+ onClose();
10299
+ }, [unpublishing, onClose]);
10300
+ const handlePublishChange = useCallback((selectedApplication, selectedCategories) => {
10301
+ setPublishAppInstance(selectedApplication);
10302
+ setPublishCategories(selectedCategories);
10303
+ }, []);
10304
+ return jsxs(Fragment, {
10305
+ children: [dashboardToPublish !== null && jsx(DotDialog, {
10306
+ cancelButtonVisible: !published,
10307
+ closeOnSubmit: false,
10308
+ hasPrimaryAction: publishing === null || published,
10309
+ open: dashboardToPublish !== null,
10310
+ title: "Publish to application",
10311
+ submitButtonProps: {
10312
+ 'data-testid': 'publish-confirm-button',
10313
+ disabled: publishAppInstance === null || (publishAppInstance === null || publishAppInstance === void 0 ? void 0 : publishAppInstance.logo_product_name) && publishAppInstance.logo_product_name in productNameCategoryMap && categories.categories[productNameCategoryMap[publishAppInstance.logo_product_name]].length > 0 && publishCategories.length === 0,
10314
+ label: published ? 'Got it' : 'Publish'
10315
+ },
10316
+ onCancel: handleCancelPublish,
10317
+ onSubmit: published ? handleCancelPublish : handlePublish,
10318
+ children: jsx(ActivePublishMessage, {
10319
+ applicationList: filteredApplications,
10320
+ categories: categories,
10321
+ dashboardName: dashboardToPublish === null || dashboardToPublish === void 0 ? void 0 : dashboardToPublish.name,
10322
+ initialCategories: publishCategories,
10323
+ published: published,
10324
+ publishing: publishing !== null,
10325
+ onChange: handlePublishChange
10326
+ })
10327
+ }), dashboardToUnpublish !== null && jsx(DotDialog, {
10328
+ cancelButtonVisible: !unpublished,
10329
+ closeOnSubmit: false,
10330
+ hasPrimaryAction: unpublishing === null || unpublished,
10331
+ open: dashboardToUnpublish !== null,
10332
+ title: "Unpublish",
10333
+ submitButtonProps: {
10334
+ 'data-testid': 'unpublish-confirm-button',
10335
+ label: unpublished ? 'Got it' : 'Unpublish'
10336
+ },
10337
+ onCancel: handleCancelUnpublish,
10338
+ onSubmit: unpublished ? handleCancelUnpublish : handleUnpublish,
10339
+ children: jsx(ActiveUnpublishMessage, {
10340
+ dashboardName: dashboardToUnpublish === null || dashboardToUnpublish === void 0 ? void 0 : dashboardToUnpublish.name,
10341
+ unpublished: unpublished,
10342
+ unpublishing: unpublishing !== null
10343
+ })
10344
+ })]
10345
+ });
10346
+ }
10347
+
10348
+ const StyledDotMenu = styled(DotMenu)`
10349
+ ${() => css`
10350
+ z-index: 9999;
10351
+ `}
10352
+ `;
10353
+
10354
+ function DotDashboardOptionsMenu({
10355
+ dashboard,
10356
+ isEdit = false,
10357
+ onStartDuplicate,
10358
+ onStartStatusChange,
10359
+ onViewMode
10360
+ }) {
10361
+ const [anchorEl, setAnchorEl] = useState(null);
10362
+ const [open, setOpen] = useState(false);
10363
+ const handleMenuClick = useCallback(event => {
10364
+ setAnchorEl(event.currentTarget);
10365
+ setOpen(orig => !orig);
10366
+ }, []);
10367
+ const handleMenuClose = useCallback(() => {
10368
+ setAnchorEl(null);
10369
+ setOpen(false);
10370
+ }, []);
10371
+ const handleEditClick = useCallback(() => {
10372
+ handleMenuClose();
10373
+ onViewMode(dashboard, 'edit');
10374
+ }, [dashboard, onViewMode]);
10375
+ const isDraft = dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT;
10376
+ const menuItems = [];
10377
+ if (!isEdit && onViewMode && !dashboard.is_ootb_dashboard) {
10378
+ menuItems.push({
10379
+ children: jsxs(DotLink, {
10380
+ ariaLabel: "Edit dashboard",
10381
+ color: "inherit",
10382
+ onClick: handleEditClick,
10383
+ underline: "none",
10384
+ children: [jsx(DotIcon, {
10385
+ iconId: "edit"
10386
+ }), " Edit"]
10387
+ }),
10388
+ key: 'edit',
10389
+ onclick: handleEditClick
10390
+ });
10391
+ }
10392
+ if (onStartStatusChange && !dashboard.is_ootb_dashboard && isDraft) {
10393
+ menuItems.push({
10394
+ key: 'publish',
10395
+ children: jsxs(DotLink, {
10396
+ ariaLabel: "Publish dashboard",
10397
+ color: "inherit",
10398
+ "data-testid": `publish-dashboard-button-${dashboard.id}`,
10399
+ onClick: () => {
10400
+ handleMenuClose();
10401
+ onStartStatusChange(dashboard, DashboardView.lifecycle_state.PUBLISHED);
10402
+ },
10403
+ underline: "none",
10404
+ children: [jsx(DotIcon, {
10405
+ iconId: "send-airplane"
10406
+ }), " ", 'Publish']
10407
+ }),
10408
+ onclick: () => {
10409
+ handleMenuClose();
10410
+ onStartStatusChange(dashboard, DashboardView.lifecycle_state.PUBLISHED);
10411
+ }
10412
+ });
10413
+ }
10414
+ if (onStartDuplicate) {
10415
+ const handleDuplicateClick = () => {
10416
+ handleMenuClose();
10417
+ onStartDuplicate(dashboard);
10418
+ };
10419
+ menuItems.push({
10420
+ children: jsxs(DotLink, {
10421
+ ariaLabel: "Duplicate dashboard",
10422
+ color: "inherit",
10423
+ onClick: handleDuplicateClick,
10424
+ underline: "none",
10425
+ children: [jsx(DotIcon, {
10426
+ iconId: "duplicate"
10427
+ }), " Duplicate"]
10428
+ }),
10429
+ key: 'duplicate',
10430
+ onclick: handleDuplicateClick
10431
+ });
10432
+ }
10433
+ return menuItems.length > 0 ? jsxs(Fragment, {
10434
+ children: [jsx(DotIconButton, {
10435
+ className: "expand-button",
10436
+ "data-testid": "card-header-action-button",
10437
+ iconId: "options",
10438
+ onClick: handleMenuClick,
10439
+ size: "medium"
10440
+ }), jsx(StyledDotMenu, {
10441
+ anchorEl: anchorEl,
10442
+ className: "card-header-action-menu",
10443
+ disablePortal: true,
10444
+ id: "card-header-action-menu",
10445
+ menuItems: menuItems,
10446
+ open: open,
10447
+ onLeave: handleMenuClose
10448
+ })]
10449
+ }) : null;
10450
+ }
10451
+
10452
+ const helpButtonClassName = 'help-button';
10453
+ const StyledDashboardActions = styled.div`
10454
+ ${({
10455
+ theme
10456
+ }) => css`
10457
+ button.${helpButtonClassName} {
10458
+ margin: ${theme.spacing(1)};
10459
+ }
10460
+ `}
10461
+ `;
10462
+
10463
+ function FavoriteButton({
10464
+ dashboard,
10465
+ onFavorite
10466
+ }) {
10467
+ const {
10468
+ dashboardsError,
10469
+ favoriteDashboard
10470
+ } = useDotMetadataApiContext();
10471
+ const {
10472
+ enqueueMessage
10473
+ } = useDotSnackbarContext();
10474
+ useEnqueueErrorMessage(dashboardsError);
10475
+ const handleFavorite = useCallback((dashboardId, favoriteValue) => {
10476
+ // being optimistic; if the api call fails, there will be an error message
10477
+ enqueueMessage(`Dashboard has been ${favoriteValue ? '' : 'un-'}favorited.`, 'success');
10478
+ onFavorite && onFavorite(dashboardId, favoriteValue);
10479
+ favoriteDashboard(dashboardId, favoriteValue);
10480
+ }, []);
10481
+ return jsx(DotIconButton, {
10482
+ iconId: `star-favorites-${dashboard.favorite ? 'active' : 'default'}`,
10483
+ "data-testid": `dashboard-favorite-icon-${dashboard.id}`,
10484
+ tooltip: dashboard.favorite ? 'Remove from favorites' : 'Add to favorites',
10485
+ onClick: () => handleFavorite(dashboard.id, !dashboard.favorite)
10486
+ });
10487
+ }
10488
+ function HelpButton({
10489
+ dashboard
10490
+ }) {
10491
+ const {
10492
+ getDashboardHelpContent
10493
+ } = useDotMetadataApiContext();
10494
+ const openHelpContent = useCallback(() => {
10495
+ return getDashboardHelpContent(dashboard.help_content_id).then(helpContentResponse => {
10496
+ const blob = new Blob([helpContentResponse], {
10497
+ type: 'text/html'
10498
+ });
10499
+ const url = URL.createObjectURL(blob);
10500
+ window.open(url, '_blank');
10501
+ });
10502
+ }, [dashboard]);
10503
+ return jsx(DotTooltip, {
10504
+ title: (dashboard === null || dashboard === void 0 ? void 0 : dashboard.help_content_id) ? 'Open dashboard help content in a new window' : 'Help is unavailable for this dashboard',
10505
+ children: jsx(DotButton, {
10506
+ className: helpButtonClassName,
10507
+ "data-testid": "help-content-button",
10508
+ disabled: !(dashboard === null || dashboard === void 0 ? void 0 : dashboard.help_content_id),
10509
+ onClick: openHelpContent,
10510
+ startIcon: jsx(DotIcon, {
10511
+ iconId: "help"
10512
+ }),
10513
+ type: "outlined",
10514
+ children: "Dashboard help"
10515
+ })
10516
+ });
10517
+ }
10518
+ function CloseButton({
10519
+ dashboard,
10520
+ onClose
10521
+ }) {
10522
+ return onClose ? jsx(DotIconButton, {
10523
+ iconId: "close",
10524
+ "data-testid": `dashboard-close-icon-${dashboard.id}`,
10525
+ tooltip: "Close dashboard",
10526
+ onClick: () => onClose(dashboard)
10527
+ }) : null;
10528
+ }
10529
+ function DotDashboardActions({
10530
+ applications,
10531
+ categories,
10532
+ dashboard,
10533
+ isEdit = false,
10534
+ canEdit = false,
10535
+ onClose,
10536
+ onFavorite,
10537
+ onStatusChanged,
10538
+ onDuplicated,
10539
+ onViewMode
10540
+ }) {
10541
+ // NOTE: useState functions need to stay at the top of the file so that
10542
+ // they are evaluated before any context imports. If they are evaluated
10543
+ // after they can cause React state issues when rendering.
10544
+ const [dashboardToCopy, setDashboardToCopy] = useState(null);
10545
+ const [dashboardToPublish, setDashboardToPublish] = useState(null);
10546
+ const [dashboardToUnpublish, setDashboardToUnpublish] = useState(null);
10547
+ const {
10548
+ duplicateDashboard
10549
+ } = useDotMetadataApiContext();
10550
+ const handlePublishConfirm = useCallback(publishedDashboard => {
10551
+ setDashboardToPublish(null);
10552
+ setDashboardToUnpublish(null);
10553
+ onStatusChanged && onStatusChanged(publishedDashboard);
10554
+ }, []);
10555
+ const handlePublishConfirmClose = useCallback(() => {
10556
+ setDashboardToPublish(null);
10557
+ setDashboardToUnpublish(null);
10558
+ }, []);
10559
+ const handleStartStatusChange = useCallback(() => {
10560
+ setDashboardToUnpublish(null);
10561
+ setDashboardToPublish(dashboard);
10562
+ }, [dashboard]);
10563
+ const handleDuplicateClose = useCallback(() => {
10564
+ setDashboardToCopy(null);
10565
+ }, []);
10566
+ const handleDuplicateSubmit = useCallback((data, isDone = true) => {
10567
+ setDashboardToCopy(null);
10568
+ const copyData = {
10569
+ name: data.name,
10570
+ description: data.description,
10571
+ categories: data.categories
10572
+ };
10573
+ return duplicateDashboard(dashboard.id, copyData).then(result => {
10574
+ if (result && 'id' in result) {
10575
+ onDuplicated(result, isDone);
10576
+ }
10577
+ });
10578
+ }, [dashboard]);
10579
+ const handleStartDuplicate = useCallback(dashboardToDupe => {
10580
+ setDashboardToCopy(dashboardToDupe);
10581
+ }, []);
10582
+ const handleStartDuplicateIfConfig = onDuplicated ? handleStartDuplicate : undefined;
10583
+ const handleStartStatusChangeIfConfig = onStatusChanged ? handleStartStatusChange : undefined;
10584
+ return jsxs(StyledDashboardActions, {
10585
+ "data-testid": "dot-dashboard-actions",
10586
+ children: [jsx(DotDashboardPublishConfirm, {
10587
+ applicationList: applications,
10588
+ categories: categories,
10589
+ dashboardToPublish: dashboardToPublish,
10590
+ dashboardToUnpublish: dashboardToUnpublish,
10591
+ onClose: handlePublishConfirmClose,
10592
+ onStatusChanged: handlePublishConfirm
10593
+ }), categories && dashboardToCopy && jsx(DotDashboardDialog, {
10594
+ title: "Create dashboard",
10595
+ availableCategories: categories === null || categories === void 0 ? void 0 : categories.categories[dashboard.target_apps[0]],
10596
+ copyDashboard: dashboardToCopy,
10597
+ open: true,
10598
+ onClose: handleDuplicateClose,
10599
+ onSubmit: handleDuplicateSubmit
10600
+ }), jsx(HelpButton, {
10601
+ dashboard: dashboard
10602
+ }), onFavorite && jsx(FavoriteButton, {
10603
+ dashboard: dashboard,
10604
+ onFavorite: onFavorite
10605
+ }), canEdit && jsx(DotDashboardOptionsMenu, {
10606
+ dashboard: dashboard,
10607
+ isEdit: isEdit,
10608
+ onViewMode: onViewMode,
10609
+ onStartStatusChange: handleStartStatusChangeIfConfig,
10610
+ onStartDuplicate: handleStartDuplicateIfConfig
10611
+ }), jsx(CloseButton, {
10612
+ dashboard: dashboard,
10613
+ onClose: onClose
10614
+ })]
10615
+ });
10616
+ }
10617
+
10618
+ const StyledDashboardHeader = styled(DotActionToolbar)`
10619
+ ${({
10620
+ theme
10621
+ }) => css`
10622
+ display: flex;
10623
+ justify-content: space-between;
10624
+ align-items: center;
10625
+ padding: ${theme.spacing(0, 2)};
10626
+ `}
10627
+ `;
10628
+
10629
+ function DotDashboardHeader({
10630
+ accountId,
10631
+ dashboard,
10632
+ isEdit = false,
10633
+ canEdit = false,
10634
+ onClose,
10635
+ onFavorite,
10636
+ onStatusChanged,
10637
+ onDuplicated,
10638
+ onViewMode
10639
+ }) {
10640
+ const {
10641
+ applications,
10642
+ applicationsError,
10643
+ applicationsLoading,
10644
+ loadApplications
10645
+ } = useDotCoreApiContext();
10646
+ const {
10647
+ categories,
10648
+ categoriesLoading,
10649
+ dashboardsError,
10650
+ getCategories
10651
+ } = useDotMetadataApiContext();
10652
+ useEnqueueErrorMessage(!applicationsLoading && applicationsError);
10653
+ useEnqueueErrorMessage(!categoriesLoading && dashboardsError);
10654
+ useEffect(() => {
10655
+ loadApplications(accountId);
10656
+ getCategories();
10657
+ }, []);
10658
+ return jsxs(StyledDashboardHeader, {
10659
+ children: [jsx(DotTypography, {
10660
+ component: "h2",
10661
+ variant: "h2",
10662
+ children: dashboard === null || dashboard === void 0 ? void 0 : dashboard.name
10663
+ }), jsx(DotDashboardActions, {
10664
+ applications: applications,
10665
+ categories: categories,
10666
+ dashboard: dashboard,
10667
+ isEdit: isEdit,
10668
+ canEdit: canEdit,
10669
+ onClose: onClose,
10670
+ onFavorite: onFavorite,
10671
+ onStatusChanged: onStatusChanged,
10672
+ onDuplicated: onDuplicated,
10673
+ onViewMode: onViewMode
10674
+ })]
10675
+ });
10676
+ }
10677
+
10678
+ const rootClassName$x = 'dot-empty-state';
10679
+ const StyledEmptyState = styled.div`
10680
+ ${({
10681
+ theme
10682
+ }) => css`
10683
+ &.dot-empty-state {
10684
+ margin: 0 auto;
10685
+ max-width: 600px;
10686
+ text-align: center;
10687
+
10688
+ .empty-state-image-container {
10689
+ display: flex;
10690
+ justify-content: center;
10691
+ }
10692
+
10693
+ .empty-state-image {
10694
+ min-height: ${theme.spacing(10)};
10695
+ margin-bottom: ${theme.spacing(5)};
10696
+ }
10697
+
10698
+ h2 {
10699
+ margin-bottom: ${theme.spacing(1)};
10700
+ }
10701
+
10702
+ .dot-tooltip {
10703
+ display: inline-block;
10704
+ }
10705
+
10706
+ .dot-button {
10707
+ margin-top: ${theme.spacing(4)};
10708
+ }
10709
+ }
10710
+ `}
10711
+ `;
10712
+
10713
+ const rootClassName$w = 'dot-illustration';
10714
+ const StyledIllustration = styled.span`
10715
+ &.${rootClassName$w} {
10716
+ display: inline-block;
10717
+ }
10718
+ `;
10719
+
10720
+ const DotIllustration = ({
10721
+ alt,
10722
+ ariaLabel,
10723
+ ariaRole = 'img',
10724
+ className,
10725
+ 'data-testid': dataTestId,
10726
+ illustrationId,
10727
+ theme = 'light',
10728
+ title,
10729
+ tooltip,
10730
+ tooltipPlacement = 'right-end'
10731
+ }) => {
10732
+ const rootClasses = useStylesWithRootClass(rootClassName$w, className);
10733
+ return jsx(DotTooltip, {
10734
+ title: tooltip,
10735
+ placement: tooltipPlacement,
10736
+ "data-testid": `${dataTestId || rootClassName$w}-tooltip`,
10737
+ children: jsx(StyledIllustration, {
10738
+ "aria-hidden": "false",
10739
+ "aria-label": ariaLabel || title || 'Illustration',
10740
+ className: rootClasses,
10741
+ "data-testid": dataTestId || rootClassName$w,
10742
+ role: ariaRole,
10743
+ children: jsx("img", {
10744
+ alt: alt || 'Illustration',
10745
+ "aria-label": ariaLabel || title || 'Illustration',
10746
+ className: `illustration-${illustrationId}-${theme} dot-img`,
10747
+ "data-testid": dataTestId && `${dataTestId}-img`,
10748
+ role: ariaRole,
10749
+ title: title || 'Illustration'
10750
+ })
10751
+ })
10752
+ });
10753
+ };
10754
+
10755
+ const DotEmptyState = ({
10756
+ ariaLabel,
10757
+ buttonProps,
10758
+ className,
10759
+ 'data-testid': dataTestId,
10760
+ illustrationId,
10761
+ imageAltText,
10762
+ imageSrc,
10763
+ subtitle,
10764
+ title
10765
+ }) => {
10766
+ const rootClasses = useStylesWithRootClass(rootClassName$x, className);
10767
+ return jsxs(StyledEmptyState, {
10768
+ "aria-label": ariaLabel,
10769
+ className: rootClasses,
10770
+ "data-testid": dataTestId,
10771
+ children: [jsxs("div", {
10772
+ className: "empty-state-image-container",
10773
+ children: [illustrationId && jsx(DotIllustration, {
10774
+ alt: imageAltText || title,
10775
+ className: "empty-state-image",
10776
+ illustrationId: illustrationId,
10777
+ title: imageAltText || title
10778
+ }), !illustrationId && imageSrc && jsx("img", {
10779
+ alt: imageAltText || title,
10780
+ className: "empty-state-image",
10781
+ src: imageSrc,
10782
+ title: imageAltText || title
10783
+ })]
10784
+ }), jsx(DotTypography, {
10785
+ variant: "h2",
10786
+ children: title
10787
+ }), subtitle && jsx(DotTypography, {
10788
+ variant: "body1",
10789
+ children: subtitle
10790
+ }), buttonProps && jsx(DotButton, Object.assign({}, buttonProps))]
10791
+ });
10792
+ };
10793
+
10794
+ const DotEmptyFilterState = ({
10795
+ ariaLabel,
10796
+ className,
8296
10797
  'data-testid': dataTestId,
8297
10798
  illustrationId = 'digitalai-empty',
8298
10799
  imageAltText = 'no results found'
@@ -8350,13 +10851,13 @@ const StyledRadioGroup = styled(RadioGroup)`
8350
10851
  `}
8351
10852
  `;
8352
10853
 
8353
- const rootClassName$x = 'dot-date-picker';
10854
+ const rootClassName$v = 'dot-date-picker';
8354
10855
  const popperClassName = 'dot-date-picker-popper';
8355
10856
  const containerClassName$2 = 'dot-date-picker-container';
8356
10857
  const rectanglePickersDayClassName = 'dot-rectangle-pickers-day';
8357
10858
  const StyledDatePickerContainer = styled.div`
8358
10859
  ${() => css`
8359
- &.${rootClassName$x} .full-width {
10860
+ &.${rootClassName$v} .full-width {
8360
10861
  width: 100%;
8361
10862
  }
8362
10863
  `}
@@ -8365,7 +10866,7 @@ const StyledDatePicker = styled(DatePicker)`
8365
10866
  ${({
8366
10867
  theme
8367
10868
  }) => css`
8368
- &.${rootClassName$x} {
10869
+ &.${rootClassName$v} {
8369
10870
  ${pickerInputStyles(theme)};
8370
10871
 
8371
10872
  .Mui-disabled.MuiInputBase-root,
@@ -8405,7 +10906,7 @@ const StyledPickersDay = styled(PickersDay)`
8405
10906
  `}
8406
10907
  `;
8407
10908
 
8408
- const rootClassName$w = 'dot-time-picker';
10909
+ const rootClassName$u = 'dot-time-picker';
8409
10910
  const containerClassName$1 = 'dot-time-picker-container';
8410
10911
  const TIME_SELECTION_HEIGHT_SPACING = 34.5;
8411
10912
  const TIME_SELECTION_WIDTH_SPACING = 14.5;
@@ -8476,7 +10977,7 @@ const StyledTimePicker = styled(TimePicker)`
8476
10977
  ${({
8477
10978
  theme
8478
10979
  }) => css`
8479
- &.${rootClassName$w} {
10980
+ &.${rootClassName$u} {
8480
10981
  ${pickerInputStyles(theme)};
8481
10982
 
8482
10983
  .Mui-disabled.MuiInputBase-root,
@@ -8495,20 +10996,20 @@ const StyledTimePicker = styled(TimePicker)`
8495
10996
  `}
8496
10997
  `;
8497
10998
 
8498
- const rootClassName$v = 'dot-form';
10999
+ const rootClassName$t = 'dot-form';
8499
11000
  const StyledFormContainer = styled.div`
8500
11001
  ${({
8501
11002
  theme
8502
11003
  }) => css`
8503
- &.${rootClassName$v} {
11004
+ &.${rootClassName$t} {
8504
11005
  margin: ${theme.spacing(3, 0)};
8505
11006
 
8506
11007
  .${rootClassName$E},
8507
11008
  .${rootClassName$G},
8508
11009
  .${rootClassName$18},
8509
11010
  .${rootSelectClassName},
8510
- .${rootClassName$x},
8511
- .${rootClassName$w} {
11011
+ .${rootClassName$v},
11012
+ .${rootClassName$u} {
8512
11013
  margin: ${theme.spacing(1, 0)};
8513
11014
  }
8514
11015
 
@@ -8517,9 +11018,9 @@ const StyledFormContainer = styled.div`
8517
11018
  label
8518
11019
  + .${rootSelectClassName},
8519
11020
  label
8520
- + .${rootClassName$x},
11021
+ + .${rootClassName$v},
8521
11022
  label
8522
- + .${rootClassName$w} {
11023
+ + .${rootClassName$u} {
8523
11024
  margin: ${theme.spacing(0, 0, 1, 0)};
8524
11025
  }
8525
11026
 
@@ -8539,7 +11040,7 @@ const DotForm = ({
8539
11040
  'data-testid': dataTestId,
8540
11041
  onSubmit
8541
11042
  }) => {
8542
- const rootClasses = useStylesWithRootClass(rootClassName$v, className);
11043
+ const rootClasses = useStylesWithRootClass(rootClassName$t, className);
8543
11044
  return jsx("form", {
8544
11045
  "aria-label": ariaLabel,
8545
11046
  "data-testid": dataTestId,
@@ -8552,10 +11053,10 @@ const DotForm = ({
8552
11053
  });
8553
11054
  };
8554
11055
 
8555
- const rootClassName$u = 'dot-dynamic-form';
11056
+ const rootClassName$s = 'dot-dynamic-form';
8556
11057
  const StyledDynamicForm = styled(DotForm)`
8557
11058
  ${() => css`
8558
- &.${rootClassName$u} {
11059
+ &.${rootClassName$s} {
8559
11060
  }
8560
11061
  `}
8561
11062
  `;
@@ -8730,135 +11231,24 @@ const checkIfFormDataValid = formState => {
8730
11231
  for (const formDataKey in formData) {
8731
11232
  const formValues = getOutputFormData(formState);
8732
11233
  const isHidden = checkIfHiddenControl(formData[formDataKey].hidden, formValues);
8733
- if (!formData[formDataKey].isValid && !isHidden) return false;
8734
- }
8735
- return true;
8736
- };
8737
-
8738
- const DotInputSelect = ({
8739
- ariaLabel,
8740
- autoFocus,
8741
- className,
8742
- 'data-pendoid': dataPendoId = rootSelectClassName,
8743
- 'data-testid': dataTestId,
8744
- defaultValue,
8745
- disabled = false,
8746
- endIcon,
8747
- endText,
8748
- error = false,
8749
- fullWidth = true,
8750
- helperText,
8751
- id,
8752
- inputRef,
8753
- label,
8754
- name,
8755
- onBlur,
8756
- onChange,
8757
- onFocus,
8758
- onKeyDown,
8759
- options = [],
8760
- persistentLabel,
8761
- readOnly = false,
8762
- required,
8763
- shrink,
8764
- size = 'small',
8765
- startIcon,
8766
- success,
8767
- value,
8768
- warning = false
8769
- }) => {
8770
- const hasWarning = !error && warning && warningClassName;
8771
- const hasSuccess = !error && !warning && success && successClassName;
8772
- const endAdornment = endIcon || endText;
8773
- const inputStyles = useStylesWithRootClass('dot-select', readOnly && readOnlyClassName$1);
8774
- const rootStyles = useStylesWithRootClass(rootSelectClassName, hasSuccess, hasWarning);
8775
- const getOption = option => {
8776
- return typeof option === 'string' ? option : option.option;
8777
- };
8778
- const getValue = option => {
8779
- return typeof option === 'string' ? option : (option === null || option === void 0 ? void 0 : option.value) || option.option;
8780
- };
8781
- return jsxs("div", {
8782
- className: className,
8783
- children: [persistentLabel && jsx(DotInputLabel, {
8784
- disabled,
8785
- error,
8786
- id,
8787
- label,
8788
- required
8789
- }), jsx(StyledTextField, {
8790
- InputProps: {
8791
- startAdornment: startIcon && jsx(StyledAdornment, {
8792
- className: `${adornmentIconClassName} start`,
8793
- position: "start",
8794
- children: startIcon
8795
- }),
8796
- endAdornment: endAdornment && jsx(StyledAdornment, {
8797
- className: `${adornmentIconClassName} end`,
8798
- position: "end",
8799
- children: endAdornment
8800
- })
8801
- },
8802
- SelectProps: {
8803
- native: !readOnly,
8804
- readOnly,
8805
- open: readOnly ? false : undefined
8806
- },
8807
- "aria-label": ariaLabel || label,
8808
- autoFocus: autoFocus,
8809
- className: rootStyles,
8810
- defaultValue: defaultValue,
8811
- disabled: disabled,
8812
- error: error,
8813
- fullWidth: fullWidth,
8814
- helperText: helperText,
8815
- id: id,
8816
- InputLabelProps: {
8817
- shrink: shrink
8818
- },
8819
- inputProps: {
8820
- 'aria-label': ariaLabel,
8821
- 'data-pendoid': dataPendoId,
8822
- 'data-testid': dataTestId,
8823
- className: inputStyles,
8824
- readOnly
8825
- },
8826
- inputRef: inputRef,
8827
- label: persistentLabel ? null : label,
8828
- multiline: false,
8829
- name: name,
8830
- onBlur: onBlur,
8831
- onChange: onChange,
8832
- onFocus: onFocus,
8833
- onKeyDown: onKeyDown,
8834
- required: required,
8835
- role: "textbox",
8836
- select: true,
8837
- size: size,
8838
- value: value,
8839
- variant: "outlined",
8840
- children: options.map(option => jsx("option", {
8841
- className: "dot-option",
8842
- value: getValue(option),
8843
- children: getOption(option)
8844
- }, getValue(option)))
8845
- })]
8846
- });
11234
+ if (!formData[formDataKey].isValid && !isHidden) return false;
11235
+ }
11236
+ return true;
8847
11237
  };
8848
11238
 
8849
- const rootClassName$t = 'dot-progress-button';
11239
+ const rootClassName$r = 'dot-progress-button';
8850
11240
  const StyledProgressButton = styled(DotButton)`
8851
11241
  ${({
8852
11242
  theme
8853
11243
  }) => css`
8854
- &.${rootClassName$t} {
11244
+ &.${rootClassName$r} {
8855
11245
  .hidden {
8856
11246
  // hide children but preserve its space so that
8857
11247
  // button's dimensions don't change
8858
11248
  visibility: hidden;
8859
11249
  }
8860
- .progress-circle {
8861
- color: ${theme.palette.figma.typography.black};
11250
+ .dot-circular-progress {
11251
+ color: ${theme.palette.figma.typography.black} !important;
8862
11252
  position: absolute;
8863
11253
  top: 0;
8864
11254
  right: 0;
@@ -8876,7 +11266,7 @@ const DotProgressButton = ({
8876
11266
  ariaLabel,
8877
11267
  children,
8878
11268
  className,
8879
- 'data-pendoid': dataPendoId = rootClassName$t,
11269
+ 'data-pendoid': dataPendoId = rootClassName$r,
8880
11270
  'data-testid': dataTestId,
8881
11271
  disabled = false,
8882
11272
  disableRipple = false,
@@ -8889,7 +11279,7 @@ const DotProgressButton = ({
8889
11279
  tooltip,
8890
11280
  type = 'primary'
8891
11281
  }) => {
8892
- const rootClasses = useStylesWithRootClass(rootClassName$t, className);
11282
+ const rootClasses = useStylesWithRootClass(rootClassName$r, className);
8893
11283
  const isButtonDisabled = disabled || isLoading;
8894
11284
  const titleClasses = useStylesWithRootClass(isLoading ? 'hidden' : '');
8895
11285
  const progressCircleSize = size === 'large' ? SPINNER_LARGE_SIZE : SPINNER_DEFAULT_SIZE;
@@ -8911,18 +11301,19 @@ const DotProgressButton = ({
8911
11301
  className: titleClasses,
8912
11302
  children: children
8913
11303
  }), isLoading && jsx(DotProgress, {
11304
+ ariaLabel: "loading",
8914
11305
  className: "progress-circle",
8915
11306
  size: progressCircleSize
8916
11307
  })]
8917
11308
  });
8918
11309
  };
8919
11310
 
8920
- const rootClassName$s = 'dot-radio';
11311
+ const rootClassName$q = 'dot-radio';
8921
11312
  const StyledRadioButton = styled(Radio)`
8922
11313
  ${({
8923
11314
  theme
8924
11315
  }) => css`
8925
- &.${rootClassName$s} {
11316
+ &.${rootClassName$q} {
8926
11317
  padding: 8px;
8927
11318
 
8928
11319
  svg {
@@ -8961,7 +11352,7 @@ function DotRadioButton({
8961
11352
  const radioControl = jsx(StyledRadioButton, {
8962
11353
  checked: checked,
8963
11354
  classes: {
8964
- root: rootClassName$s
11355
+ root: rootClassName$q
8965
11356
  },
8966
11357
  color: "primary",
8967
11358
  "data-pendoid": dataPendoId,
@@ -9072,7 +11463,7 @@ const DotRadioGroup = ({
9072
11463
  });
9073
11464
  };
9074
11465
 
9075
- const rootClassName$r = 'dot-switch';
11466
+ const rootClassName$p = 'dot-switch';
9076
11467
  const StyledSwitch = styled(Switch)`
9077
11468
  ${({
9078
11469
  theme
@@ -9101,7 +11492,7 @@ const DotSwitch = ({
9101
11492
  checked,
9102
11493
  className,
9103
11494
  color,
9104
- 'data-pendoid': dataPendoId = rootClassName$r,
11495
+ 'data-pendoid': dataPendoId = rootClassName$p,
9105
11496
  'data-testid': dataTestId,
9106
11497
  disabled = false,
9107
11498
  id,
@@ -9111,7 +11502,7 @@ const DotSwitch = ({
9111
11502
  onChange,
9112
11503
  size = 'medium'
9113
11504
  }) => {
9114
- const rootClasses = useStylesWithRootClass(rootClassName$r, className);
11505
+ const rootClasses = useStylesWithRootClass(rootClassName$p, className);
9115
11506
  const handleChange = event => {
9116
11507
  onChange && onChange(event);
9117
11508
  };
@@ -9462,7 +11853,7 @@ const DotDynamicForm = ({
9462
11853
  onChange,
9463
11854
  onSubmit
9464
11855
  }) => {
9465
- const rootClasses = useStylesWithRootClass(rootClassName$u, className);
11856
+ const rootClasses = useStylesWithRootClass(rootClassName$s, className);
9466
11857
  // Memoize this operation so that is doesn't get executed each time this
9467
11858
  // component re-renders
9468
11859
  const initialFormState = useMemo(() => getInitialFormState(config, liveValidation), [config, liveValidation, getInitialFormState]);
@@ -9708,7 +12099,7 @@ const DotDynamicForm = ({
9708
12099
  });
9709
12100
  };
9710
12101
 
9711
- const rootClassName$q = 'dot-inline-edit';
12102
+ const rootClassName$o = 'dot-inline-edit';
9712
12103
  const editModeClassName = 'dot-edit-mode';
9713
12104
  const viewModeClassName = 'dot-view-mode';
9714
12105
  const placeholderClassName = 'dot-placeholder';
@@ -9720,7 +12111,7 @@ const StyledInlineEdit = styled.div`
9720
12111
  theme,
9721
12112
  fullWidth
9722
12113
  }) => css`
9723
- &.${rootClassName$q} {
12114
+ &.${rootClassName$o} {
9724
12115
  align-items: center;
9725
12116
  color: ${theme.palette.figma.typography.black};
9726
12117
  display: ${fullWidth ? 'flex' : 'inline-flex'};
@@ -9932,7 +12323,7 @@ const DotInlineEdit = ({
9932
12323
  bindings,
9933
12324
  charactersLimit,
9934
12325
  className,
9935
- 'data-pendoid': dataPendoId = rootClassName$q,
12326
+ 'data-pendoid': dataPendoId = rootClassName$o,
9936
12327
  'data-testid': dataTestId,
9937
12328
  fullWidth = true,
9938
12329
  hideActionButtons,
@@ -9965,7 +12356,7 @@ const DotInlineEdit = ({
9965
12356
  }
9966
12357
  }, [value]);
9967
12358
  const isSaveDisabled = checkIfEmptyValue(inputValue);
9968
- const rootClasses = useStylesWithRootClass(rootClassName$q, className, editing ? editModeClassName : '');
12359
+ const rootClasses = useStylesWithRootClass(rootClassName$o, className, editing ? editModeClassName : '');
9969
12360
  const handleShowTooltip = visible => {
9970
12361
  if (!editing) {
9971
12362
  setShowTooltip(visible);
@@ -10144,13 +12535,13 @@ const DotInlineEdit = ({
10144
12535
  });
10145
12536
  };
10146
12537
 
10147
- const rootClassName$p = 'dot-navigation-rail';
12538
+ const rootClassName$n = 'dot-navigation-rail';
10148
12539
  const StyledNavigationRail = styled.div`
10149
12540
  ${({
10150
12541
  theme,
10151
12542
  railItemPosition
10152
12543
  }) => css`
10153
- &.${rootClassName$p} {
12544
+ &.${rootClassName$n} {
10154
12545
  background: ${theme.palette.figma.neutral.elevated};
10155
12546
  border-left: 1px solid ${theme.palette.figma.border.default};
10156
12547
  display: flex;
@@ -10197,7 +12588,7 @@ const DotNavigationRail = ({
10197
12588
  railItems,
10198
12589
  selectedIndex = 0
10199
12590
  }) => {
10200
- const rootClasses = useStylesWithRootClass(rootClassName$p, className);
12591
+ const rootClasses = useStylesWithRootClass(rootClassName$n, className);
10201
12592
  const [selectedItemIndex, setSelectedItemIndex] = useState(selectedIndex);
10202
12593
  /* Used to change selected index programmatically from the consumer component */
10203
12594
  useEffect(() => {
@@ -10248,12 +12639,12 @@ const DotNavigationRail = ({
10248
12639
  });
10249
12640
  };
10250
12641
 
10251
- const rootClassName$o = 'dot-pill';
12642
+ const rootClassName$m = 'dot-pill';
10252
12643
  const StyledPill = styled(Chip)`
10253
12644
  ${({
10254
12645
  theme
10255
12646
  }) => css`
10256
- &.${rootClassName$o} {
12647
+ &.${rootClassName$m} {
10257
12648
  background-color: ${({
10258
12649
  backgroundcolor,
10259
12650
  variant
@@ -10376,7 +12767,7 @@ const DotPill = ({
10376
12767
  status = 'default',
10377
12768
  variant = 'filled'
10378
12769
  }) => {
10379
- const rootClasses = useStylesWithRootClass(rootClassName$o, className, status);
12770
+ const rootClasses = useStylesWithRootClass(rootClassName$m, className, status);
10380
12771
  return jsx(StyledPill, {
10381
12772
  "aria-label": ariaLabel,
10382
12773
  bordercolor: bordercolor,
@@ -10394,12 +12785,12 @@ const DotPill = ({
10394
12785
  });
10395
12786
  };
10396
12787
 
10397
- const rootClassName$n = 'dot-skeleton';
12788
+ const rootClassName$l = 'dot-skeleton';
10398
12789
  const StyledSkeleton = styled(Skeleton)`
10399
12790
  ${({
10400
12791
  theme
10401
12792
  }) => css`
10402
- &.${rootClassName$n} {
12793
+ &.${rootClassName$l} {
10403
12794
  background-color: ${theme.palette.figma.border.darker};
10404
12795
  }
10405
12796
  `}
@@ -10414,7 +12805,7 @@ const DotSkeleton = ({
10414
12805
  width,
10415
12806
  variant
10416
12807
  }) => {
10417
- const rootClasses = useStylesWithRootClass(rootClassName$n, className);
12808
+ const rootClasses = useStylesWithRootClass(rootClassName$l, className);
10418
12809
  return jsx(StyledSkeleton, {
10419
12810
  animation: "wave",
10420
12811
  "aria-label": ariaLabel,
@@ -10429,246 +12820,6 @@ const DotSkeleton = ({
10429
12820
  });
10430
12821
  };
10431
12822
 
10432
- function addAutoHideDuration(severity) {
10433
- return severity === 'error' ? null : 10000;
10434
- }
10435
-
10436
- const getSnackbarTitleFromSeverity = severity => {
10437
- switch (severity) {
10438
- case 'success':
10439
- return 'Success';
10440
- case 'warning':
10441
- return 'Warning';
10442
- case 'error':
10443
- return 'Error';
10444
- case 'info':
10445
- return 'Info';
10446
- default:
10447
- return 'Success';
10448
- }
10449
- };
10450
-
10451
- const rootClassName$m = 'dot-snackbar';
10452
- const StyledSnackbar = styled(Snackbar)`
10453
- ${({
10454
- theme,
10455
- width,
10456
- $anchorOriginTop
10457
- }) => css`
10458
- &.${rootClassName$m} {
10459
- .MuiAlert-message {
10460
- word-break: break-word;
10461
- }
10462
- .${rootClassName$16} {
10463
- align-items: flex-start;
10464
- }
10465
- &.MuiSnackbar-anchorOriginTopLeft,
10466
- &.MuiSnackbar-anchorOriginTopCenter,
10467
- &.MuiSnackbar-anchorOriginTopRight {
10468
- top: ${$anchorOriginTop}px;
10469
- z-index: ${levelFourth};
10470
- }
10471
-
10472
- .dot-snackbar-actions {
10473
- display: flex;
10474
- align-items: center;
10475
- margin-top: ${theme.spacing(1)};
10476
- gap: ${theme.spacing(2)};
10477
-
10478
- .primary-action-btn {
10479
- background-color: transparent;
10480
- }
10481
- }
10482
-
10483
- .MuiAlert-root {
10484
- max-width: ${width ? 'unset' : '500px'};
10485
- min-width: ${width ? 'unset' : '344px'};
10486
- z-index: ${levelFourth};
10487
- }
10488
- }
10489
- `}
10490
- `;
10491
-
10492
- const DEFAULT_ANCHOR_ORIGIN = {
10493
- vertical: 'top',
10494
- horizontal: 'right'
10495
- };
10496
- const DotSnackbar = ({
10497
- anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
10498
- anchorOriginTop = 108,
10499
- ariaLabel,
10500
- autoHideDuration,
10501
- children,
10502
- className,
10503
- 'data-testid': dataTestId,
10504
- hideOnClickAway = true,
10505
- onClose,
10506
- open,
10507
- primaryAction,
10508
- secondaryAction,
10509
- severity,
10510
- width
10511
- }) => {
10512
- const hasActions = !!(primaryAction || secondaryAction);
10513
- const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
10514
- const rootClasses = useStylesWithRootClass(rootClassName$m, className);
10515
- const handleSnackbarClose = reason => {
10516
- if (!reason || hideOnClickAway || !hideOnClickAway && reason !== 'clickaway') {
10517
- onClose();
10518
- }
10519
- };
10520
- return jsx(StyledSnackbar, {
10521
- anchorOrigin: anchorOrigin,
10522
- "$anchorOriginTop": anchorOriginTop,
10523
- "aria-label": ariaLabel,
10524
- autoHideDuration: calculatedAutoHideDuration,
10525
- classes: {
10526
- root: rootClasses
10527
- },
10528
- "data-testid": dataTestId,
10529
- onClose: (_e, r) => handleSnackbarClose(r),
10530
- open: open,
10531
- severity: severity,
10532
- width: width,
10533
- children: jsx("div", {
10534
- children: jsx(DotAlertBanner, {
10535
- severity: severity,
10536
- width: width,
10537
- onClose: _e => handleSnackbarClose(),
10538
- children: jsxs("div", {
10539
- children: [jsx(DotTypography, {
10540
- variant: "subtitle2",
10541
- noMarginBottom: false,
10542
- children: getSnackbarTitleFromSeverity(severity)
10543
- }), isString$1(children) ? jsx(DotTypography, {
10544
- ariaLabel: severity,
10545
- variant: "body1",
10546
- children: children
10547
- }) : jsx("span", {
10548
- "aria-label": severity,
10549
- children: children
10550
- }), hasActions && jsxs("div", {
10551
- className: "dot-snackbar-actions",
10552
- children: [primaryAction && jsx(DotButton, {
10553
- className: "primary-action-btn",
10554
- "data-testid": "primary-action-btn",
10555
- onClick: primaryAction.onClick,
10556
- size: "small",
10557
- type: "outlined",
10558
- children: primaryAction.label
10559
- }), secondaryAction && jsx(DotLink, {
10560
- "data-testid": "secondary-action-link",
10561
- href: secondaryAction.href,
10562
- color: "inherit",
10563
- children: secondaryAction.label
10564
- })]
10565
- })]
10566
- })
10567
- })
10568
- })
10569
- });
10570
- };
10571
-
10572
- const rootClassName$l = 'dot-snackbar-container';
10573
- const StyledSnackbarContainer = styled.div`
10574
- ${() => css`
10575
- &.${rootClassName$l} {
10576
- position: absolute;
10577
- top: 0;
10578
- width: 250px;
10579
- height: auto;
10580
- right: 0;
10581
- & > div {
10582
- position: relative;
10583
- }
10584
- }
10585
- `}
10586
- `;
10587
-
10588
- const DotSnackbarContext = createContext({
10589
- alerts: [],
10590
- enqueueMessage: (_message, _severity, _autoHideDuration, _primaryAction, _secondaryAction) => null,
10591
- removeMessage: _id => null
10592
- });
10593
- const DotSnackbarContainer = ({
10594
- hideOnClickAway
10595
- }) => {
10596
- const {
10597
- alerts,
10598
- removeMessage
10599
- } = useDotSnackbarContext();
10600
- function handleClose(id) {
10601
- return () => {
10602
- removeMessage(id);
10603
- };
10604
- }
10605
- return jsx(StyledSnackbarContainer, {
10606
- className: rootClassName$l,
10607
- children: jsx("div", {
10608
- className: rootClassName$l,
10609
- "data-testid": rootClassName$l,
10610
- children: alerts.slice().reverse().map(alert => {
10611
- return jsx(DotSnackbar, {
10612
- autoHideDuration: alert.autoHideDuration,
10613
- hideOnClickAway: hideOnClickAway,
10614
- onClose: handleClose(alert.id),
10615
- open: alert.open,
10616
- severity: alert.severity,
10617
- primaryAction: alert.primaryAction,
10618
- secondaryAction: alert.secondaryAction,
10619
- children: alert.message
10620
- }, alert.id);
10621
- })
10622
- })
10623
- });
10624
- };
10625
- const DotSnackbarProvider = ({
10626
- children,
10627
- hideOnClickAway = true
10628
- }) => {
10629
- const [alerts, setAlerts] = useState([]);
10630
- function enqueueMessage(message, severity, autoHideDuration, primaryAction, secondaryAction) {
10631
- const id = CreateUUID();
10632
- const queue = {
10633
- id,
10634
- message,
10635
- severity,
10636
- open: true,
10637
- autoHideDuration,
10638
- primaryAction,
10639
- secondaryAction
10640
- };
10641
- setAlerts(prevState => {
10642
- return [...prevState, Object.assign({}, queue)];
10643
- });
10644
- return id;
10645
- }
10646
- const removeMessage = id => {
10647
- setAlerts(prev => {
10648
- return prev.map(a => {
10649
- return a.id === id ? Object.assign(Object.assign({}, a), {
10650
- open: false
10651
- }) : a;
10652
- });
10653
- });
10654
- };
10655
- const DotSnackbarValues = {
10656
- alerts,
10657
- enqueueMessage,
10658
- removeMessage
10659
- };
10660
- const memoizedValues = useMemo(() => DotSnackbarValues, [alerts]);
10661
- return jsxs(DotSnackbarContext.Provider, {
10662
- value: memoizedValues,
10663
- children: [jsx(DotSnackbarContainer, {
10664
- hideOnClickAway: hideOnClickAway
10665
- }), children]
10666
- });
10667
- };
10668
- const useDotSnackbarContext = () => {
10669
- return useContext(DotSnackbarContext);
10670
- };
10671
-
10672
12823
  const rootClassName$k = 'dot-split-button-group';
10673
12824
  const StyledSplitButtonGroup = styled(ButtonGroup)`
10674
12825
  ${({
@@ -11261,13 +13412,13 @@ const DotStepper = ({
11261
13412
  return [step.className, isActive ? 'active' : 'inactive', step.completed ? 'completed' : '', step.disabled ? 'disabled' : '', step.error ? 'error' : '', step.inProgress ? 'in-progress' : ''].concat().join(' ').trim();
11262
13413
  };
11263
13414
  const getContent = () => {
11264
- return isString$1(step.description) ? jsx(StepDescription, {
13415
+ return isString$2(step.description) ? jsx(StepDescription, {
11265
13416
  variant: "body2",
11266
13417
  children: step.description
11267
13418
  }) : step.description;
11268
13419
  };
11269
13420
  const getHorizontalDescription = () => {
11270
- return isString$1(step.description) ? jsx(DotTypography, {
13421
+ return isString$2(step.description) ? jsx(DotTypography, {
11271
13422
  variant: "body2",
11272
13423
  className: "horizontal-step-description",
11273
13424
  children: step.description
@@ -11655,7 +13806,7 @@ const StyledTableBody = styled(TableBody)`
11655
13806
  const getFormattedTableCellValue = (
11656
13807
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11657
13808
  value, typographyVariant) => {
11658
- if (isString$1(value) || isNumber(value)) {
13809
+ if (isString$2(value) || isNumber(value)) {
11659
13810
  return jsx(DotTypography, {
11660
13811
  className: "dot-cell-typography",
11661
13812
  variant: typographyVariant,
@@ -12086,7 +14237,7 @@ const DotHeaderCell = ({
12086
14237
  value,
12087
14238
  width
12088
14239
  }) => {
12089
- const headerTitle = isString$1(value) ? value : null;
14240
+ const headerTitle = isString$2(value) ? value : null;
12090
14241
  const formattedValue = getFormattedTableCellValue(value, typography);
12091
14242
  const getCellValue = () => {
12092
14243
  if (sortable) {
@@ -13818,7 +15969,7 @@ const DotDatePicker = ({
13818
15969
  autoFocus = false,
13819
15970
  className,
13820
15971
  closeOnSelect = true,
13821
- 'data-pendoid': dataPendoId = rootClassName$x,
15972
+ 'data-pendoid': dataPendoId = rootClassName$v,
13822
15973
  'data-testid': dataTestId,
13823
15974
  defaultValue,
13824
15975
  disableOpenPicker,
@@ -13858,7 +16009,7 @@ const DotDatePicker = ({
13858
16009
  const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
13859
16010
  const isInputReadOnly = readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
13860
16011
  const inputRef = useRef(null);
13861
- const rootClasses = useStylesWithRootClass(rootClassName$x, className, isInputReadOnly ? 'read-only' : '');
16012
+ const rootClasses = useStylesWithRootClass(rootClassName$v, className, isInputReadOnly ? 'read-only' : '');
13862
16013
  const containerClasses = useStylesWithRootClass(containerClassName$2, fullWidth ? 'full-width' : '', className);
13863
16014
  const focusInput = ref => {
13864
16015
  setTimeout(() => {
@@ -14077,7 +16228,7 @@ const DotTimePicker = ({
14077
16228
  ariaLabel,
14078
16229
  autoFocus = false,
14079
16230
  className,
14080
- 'data-pendoid': dataPendoId = rootClassName$w,
16231
+ 'data-pendoid': dataPendoId = rootClassName$u,
14081
16232
  'data-testid': dataTestId,
14082
16233
  defaultValue,
14083
16234
  disableOpenPicker = false,
@@ -14109,7 +16260,7 @@ const DotTimePicker = ({
14109
16260
  const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
14110
16261
  const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
14111
16262
  const isComponentReadOnly = readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
14112
- const rootClasses = useStylesWithRootClass(rootClassName$w, className, isComponentReadOnly ? 'read-only' : '');
16263
+ const rootClasses = useStylesWithRootClass(rootClassName$u, className, isComponentReadOnly ? 'read-only' : '');
14113
16264
  const containerClasses = useStylesWithRootClass(containerClassName$1, fullWidth ? 'full-width' : '', className);
14114
16265
  const inputRef = useRef(null);
14115
16266
  const [isPickerOpened, setIsPickerOpened] = useState(false);
@@ -14713,4 +16864,4 @@ const DotStickyWithBorder = ({
14713
16864
  });
14714
16865
  };
14715
16866
 
14716
- export { ApiError, Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCarousel, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyFilterState, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotIllustration, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotStickyWithBorder, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, breakpointOptions, checkIfValidDate, darkFigmaColors, lightThemeColors as lightColors, lightFigmaColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotSnackbarContext };
16867
+ export { ApiError$1 as ApiError, Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, DashboardAppTypeOptions, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCarousel, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDashboardActions, DotDashboardDialog, DotDashboardHeader, DotDashboardOptionsMenu, DotDashboardPublishConfirm, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyFilterState, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotIllustration, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotMetadataApiProvider, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotStickyWithBorder, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, breakpointOptions, checkIfValidDate, darkFigmaColors, lightThemeColors as lightColors, lightFigmaColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotMetadataApiContext, useDotSnackbarContext, useEnqueueErrorMessage };