@digital-ai/dot-components 3.7.0 → 3.8.1

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 (98) hide show
  1. package/index.esm.js +2675 -590
  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/snackbar/SnackbarProvider.d.ts +2 -0
  95. package/src/lib/components/snackbar/index.d.ts +1 -1
  96. package/src/lib/components/snackbar/utils/helpers.d.ts +9 -0
  97. package/src/lib/utils/index.d.ts +10 -0
  98. /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
@@ -2991,7 +3020,7 @@ const StyledPopper$1 = styled(Popper)`
2991
3020
 
2992
3021
  const flyoutMenuClassName = 'dot-flyout-menu';
2993
3022
  const rootClassName$$ = 'dot-menu';
2994
- const getListMaxHeight = maxHeight => isString$1(maxHeight) ? maxHeight : `${maxHeight}px`;
3023
+ const getListMaxHeight = maxHeight => isString$2(maxHeight) ? maxHeight : `${maxHeight}px`;
2995
3024
  const StyledPopper = styled(Popper)`
2996
3025
  ${({
2997
3026
  theme
@@ -6351,7 +6380,7 @@ const getChipsFromAutocomplete = ({
6351
6380
  if (values === undefined) return;
6352
6381
  return values.map((option, index) => {
6353
6382
  if (!option) return null;
6354
- const hasStringValue = isString$1(option);
6383
+ const hasStringValue = isString$2(option);
6355
6384
  const optionAsString = option;
6356
6385
  const optionAsObject = option;
6357
6386
  const chipError = hasStringValue ? undefined : optionAsObject.error;
@@ -6501,7 +6530,7 @@ const DotAutoComplete = ({
6501
6530
  // If simple text, we need to give it a class so that styling for
6502
6531
  // displaying ellipsis on a long text can be applied. If it is
6503
6532
  // custom node coming from the consumer, then leave it as it is.
6504
- const itemTextNode = isString$1(itemText) ? jsx("span", {
6533
+ const itemTextNode = isString$2(itemText) ? jsx("span", {
6505
6534
  className: "dot-action-item-text",
6506
6535
  children: itemText
6507
6536
  }) : itemText;
@@ -6577,7 +6606,7 @@ const DotAutoComplete = ({
6577
6606
  values
6578
6607
  });
6579
6608
  const handleTagsRender = () => {
6580
- if (!multiple || isString$1(defaultValue)) return;
6609
+ if (!multiple || isString$2(defaultValue)) return;
6581
6610
  return renderTags || handleRenderChips;
6582
6611
  };
6583
6612
  const renderErrorOrWarningIcon = () => {
@@ -6615,7 +6644,7 @@ const DotAutoComplete = ({
6615
6644
  },
6616
6645
  "data-pendoid": dataPendoId,
6617
6646
  "data-testid": dataTestId,
6618
- defaultValue: multiple && isString$1(defaultValue) ? [defaultValue] : defaultValue,
6647
+ defaultValue: multiple && isString$2(defaultValue) ? [defaultValue] : defaultValue,
6619
6648
  disabled: disabled,
6620
6649
  filterOptions: filterOptions,
6621
6650
  filterSelectedOptions: filterSelectedOptions,
@@ -8243,95 +8272,2502 @@ const CssGridDebug = ({
8243
8272
  });
8244
8273
  };
8245
8274
 
8246
- const rootClassName$z = 'dot-empty-state';
8247
- const StyledEmptyState = styled.div`
8248
- ${({
8249
- theme
8250
- }) => css`
8251
- &.dot-empty-state {
8252
- margin: 0 auto;
8253
- max-width: 600px;
8254
- text-align: center;
8255
-
8256
- .empty-state-image-container {
8257
- display: flex;
8258
- justify-content: center;
8259
- }
8260
-
8261
- .empty-state-image {
8262
- min-height: ${theme.spacing(10)};
8263
- margin-bottom: ${theme.spacing(5)};
8264
- }
8265
-
8266
- h2 {
8267
- margin-bottom: ${theme.spacing(1)};
8268
- }
8269
-
8270
- .dot-tooltip {
8271
- display: inline-block;
8272
- }
8273
-
8274
- .dot-button {
8275
- margin-top: ${theme.spacing(4)};
8276
- }
8277
- }
8278
- `}
8279
- `;
8280
-
8281
- const rootClassName$y = 'dot-illustration';
8282
- const StyledIllustration = styled.span`
8283
- &.${rootClassName$y} {
8284
- display: inline-block;
8285
- }
8286
- `;
8287
-
8288
- const DotIllustration = ({
8289
- alt,
8275
+ const DotInputSelect = ({
8290
8276
  ariaLabel,
8291
- ariaRole = 'img',
8277
+ autoFocus,
8292
8278
  className,
8279
+ 'data-pendoid': dataPendoId = rootSelectClassName,
8293
8280
  'data-testid': dataTestId,
8294
- illustrationId,
8295
- theme = 'light',
8296
- title,
8297
- tooltip,
8298
- tooltipPlacement = 'right-end'
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
8299
8306
  }) => {
8300
- const rootClasses = useStylesWithRootClass(rootClassName$y, className);
8301
- return jsx(DotTooltip, {
8302
- title: tooltip,
8303
- placement: tooltipPlacement,
8304
- "data-testid": `${dataTestId || rootClassName$y}-tooltip`,
8305
- children: jsx(StyledIllustration, {
8306
- "aria-hidden": "false",
8307
- "aria-label": ariaLabel || title || 'Illustration',
8308
- className: rootClasses,
8309
- "data-testid": dataTestId || rootClassName$y,
8310
- role: ariaRole,
8311
- children: jsx("img", {
8312
- alt: alt || 'Illustration',
8313
- "aria-label": ariaLabel || title || 'Illustration',
8314
- className: `illustration-${illustrationId}-${theme} dot-img`,
8315
- "data-testid": dataTestId && `${dataTestId}-img`,
8316
- role: ariaRole,
8317
- title: title || 'Illustration'
8318
- })
8319
- })
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
+ })]
8320
8383
  });
8321
8384
  };
8322
8385
 
8323
- const DotEmptyState = ({
8324
- ariaLabel,
8325
- buttonProps,
8326
- className,
8327
- 'data-testid': dataTestId,
8328
- illustrationId,
8329
- imageAltText,
8330
- imageSrc,
8331
- subtitle,
8332
- title
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: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMg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MuODkwMiAxMy4xOTA1IDEzLjc1M0MxMy40ODQ1IDEzLjYxNTggMTMuNzQyNCAxMy40MTE2IDEzLjk0MzMgMTMuMTU2OFoiIGZpbGw9IndoaXRlIi8+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
+ id: '5',
9209
+ created_date: '2023-05-24T20:56:43.905064+00:00',
9210
+ logo: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIGZpbGw9IiMyNzlGRUEiLz4KPHBhdGggZD0iTTE0LjE4NjcgMTEuMjY2N0wxMi4xNjM0IDEwLjA4MzNMMTAuMTM2NyAxMS4yNjY3VjEzLjYyTDEyLjE2MzQgMTQuNzg2N0wxNC4xODY3IDEzLjYyVjExLjI2NjdaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNOC40MzY2NiAxMi4wMDAxTDcuNDczMzMgMTEuMTUwMVYxNS4xNjY3TDEwLjQxIDE2LjgzNjdWMTUuNzAzNEw4LjQzNjY2IDE0LjU0MDFWMTIuMDAwMVoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0xNS44OTY1IDEyVjE0LjU4MzNMMTMuOTYzMiAxNS43MDMzVjE2LjkzNjdMMTYuODUzMiAxNS4xNTMzVjExLjA5NjdMMTUuODk2NSAxMloiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0xMi4xNTY1IDguMTMzMzNMMTQuNzE2NSA5LjYxMzMzTDE1LjQxNjUgOC44OUwxMi4xNTY1IDdMOC44Nzk4OCA4LjkwNjY3TDkuNTc5ODggOS42MzMzM0wxMi4xNTY1IDguMTMzMzNaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K',
9211
+ logo_product_name: 'Deploy',
9212
+ modified_date: '2023-05-24T20:56: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: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIGZpbGw9IiNGN0I3MzEiLz4KPHBhdGggZD0iTTE3LjAxNjggMTAuNDgzNkMxNi44NTk4IDEwLjQ4MTkgMTYuNzA0IDEwLjUxMTEgMTYuNTU4MyAxMC41Njk3QzE2LjQxMjYgMTAuNjI4MiAxNi4yNzk5IDEwLjcxNSAxNi4xNjc5IDEwLjgyNDlDMTYuMDU1OCAxMC45MzQ4IDE1Ljk2NjUgMTEuMDY1OCAxNS45MDUxIDExLjIxMDNDMTUuODQzNyAxMS4zNTQ4IDE1LjgxMTQgMTEuNTEgMTUuODEwMSAxMS42NjdDMTUuODEyNSAxMS44ODg3IDE1Ljg3NTkgMTIuMTA1NiAxNS45OTM0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uMTUxNCAxMC40Nzc0IDE2Ljk5MDEgMTAuNDgzNkgxNy4wMTY4Wk0xMS4zNTAxIDEzLjI0MzZDMTEuMTE2MSAxMy4yMzc3IDEwLjg4OTEgMTMuMTYzIDEwLjY5NzMgMTMuMDI4N0MxMC41MDU2IDEyLjg5NDQgMTAuMzU3OCAxMi43MDY1IDEwLjI3MjMgMTIuNDg4NkMxMC4xODY4IDEyLjI3MDcgMTAuMTY3NSAxMi4wMzI1IDEwLjIxNjcgMTEuODAzNkMxMC4yNjYgMTEuNTc0OCAxMC4zODE2IDExLjM2NTYgMTAuNTQ5MiAxMS4yMDIxQzEwLjcxNjcgMTEuMDM4NyAxMC45Mjg4IDEwLjkyODMgMTEuMTU4OCAxMC44ODQ4QzExLjM4ODcgMTAuODQxMiAxMS42MjY0IDEwLjg2NjUgMTEuODQyMiAxMC45NTc0QzEyLjA1NzkgMTEuMDQ4MyAxMi4yNDIgMTEuMjAwNyAxMi4zNzE0IDExLjM5NTdDMTzIuNTAwOSAxMS41OTA3IDEyLjU3IDExLjgxOTYgMTIuNTcwMSAxMi4wNTM2QzEyLjU2NTcgMTIuMzcxOSAxMi40MzU3IDEyLjY3NTYgMTIuMjA4NSAxMi44OTg1QzExLjk4MTIgMTMuMTIxNCAxMS42NzUxIDEzLjI0NTQgMTEuMzU2OCAxMy4yNDM2SDExLjM1MDFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K',
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: 'PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzM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k1MDA2IDcuNTIzNDhWOC41MjM0OEwxMS40OTY3IDcuNjMwMTVWMTEuNjg2OEw4LjAwMDA2IDEzLjgxNjhWMTIuMDIwMkw3LjEyMDA2IDEyLjUyMzVWMTQuODIwMkw4Ljk2NjcyIDE1Ljg1MDJMOS44NjY3MiAxNS4zMzM1TDguNDAwMDYgMTQuNTI2OEwxMi4wMDAxIDEyLjQzNjhMMTUuNTU2NyAxNC41MDM1TDE0LjEzMDEgMTUuMzI2OEwxNS4wNTY3IDE1Ljg3MDFMMTYuODcwMSAxNC44MjY4TDE2Ljg4MDEgMTIuNTQzNVoiIGZpbGw9IndoaXRlIi8+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
+ if (dashboards) {
9337
+ dashboards.push(response);
9338
+ setDashboards(dashboards.slice());
9339
+ } else {
9340
+ setDashboards([response]);
9341
+ }
9342
+ return response;
9343
+ }).catch(error => {
9344
+ setDashboardsError(error);
9345
+ return null;
9346
+ });
9347
+ },
9348
+ favoriteDashboard: (dashboardId, favoriteValue) => {
9349
+ setAccountIdHeader(accountId);
9350
+ if (favoriteValue) {
9351
+ return cancelablePromise(DashboardsService.postDashboardsService2(dashboardId)).then(response => {
9352
+ setDashboardsError(null);
9353
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9354
+ return response;
9355
+ }).catch(error => {
9356
+ setDashboardsError(error);
9357
+ return null;
9358
+ });
9359
+ } else {
9360
+ return cancelablePromise(DashboardsService.deleteDashboardsService1(dashboardId)).then(response => {
9361
+ setDashboardsError(null);
9362
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9363
+ return response;
9364
+ }).catch(error => {
9365
+ setDashboardsError(error);
9366
+ return null;
9367
+ });
9368
+ }
9369
+ },
9370
+ updateDashboard: (dashboardId, dashboard, isSync = false) => __awaiter(void 0, void 0, void 0, function* () {
9371
+ setAccountIdHeader(accountId);
9372
+ return cancelablePromise(DashboardsService.patchDashboardsService(dashboardId, dashboard, isSync)).then(response => {
9373
+ setDashboardsError(null);
9374
+ setDashboards(orig => handleUpdateDashboard(orig, response));
9375
+ return response;
9376
+ }).catch(error => setDashboardsError(error));
9377
+ }),
9378
+ getCategories: () => __awaiter(void 0, void 0, void 0, function* () {
9379
+ setCategoriesLoading(true);
9380
+ if (OpenAPI.BASE === MOCK_API_URL) {
9381
+ setDashboardsError(null);
9382
+ setCategoriesLoading(false);
9383
+ setCategories(getCategoriesMock);
9384
+ return getCategoriesMock;
9385
+ } else {
9386
+ return cancelablePromise(CategoriesService.getCategoriesService()).then(response => {
9387
+ setDashboardsError(null);
9388
+ setCategoriesLoading(false);
9389
+ setCategories(response);
9390
+ return response;
9391
+ }).catch(error => {
9392
+ setCategoriesLoading(false);
9393
+ setDashboardsError(error);
9394
+ return null;
9395
+ });
9396
+ }
9397
+ }),
9398
+ getDashboardHelpContent: helpContentId => __awaiter(void 0, void 0, void 0, function* () {
9399
+ setHelpContentLoading(true);
9400
+ if (OpenAPI.BASE === MOCK_API_URL) {
9401
+ setDashboardsError(null);
9402
+ setHelpContentLoading(false);
9403
+ return helpContent;
9404
+ } else {
9405
+ setAccountIdHeader(accountId);
9406
+ return cancelablePromise(HelpContentService.getHelpContentById(helpContentId)).then(response => {
9407
+ setHelpContentLoading(false);
9408
+ return response.content;
9409
+ }).catch(error => {
9410
+ setHelpContentLoading(false);
9411
+ setDashboardsError(error);
9412
+ });
9413
+ }
9414
+ })
9415
+ }), [categories, categoriesLoading, dashboards, dashboardsError, dashboardsLoading, platformConsoleUrl]);
9416
+ if (apiUrl && OpenAPI.BASE !== apiUrl) {
9417
+ OpenAPI.BASE = apiUrl;
9418
+ }
9419
+ const demoUrl = 'https://digitalai.staging.digitalai.cloud/';
9420
+ if (token && OpenAPI.TOKEN !== token) {
9421
+ OpenAPI.TOKEN = token;
9422
+ setPlatformConsoleUrl(getPlatformConsoleUrlFromToken(token));
9423
+ } else if (OpenAPI.BASE === MOCK_API_URL && platformConsoleUrl !== demoUrl) {
9424
+ setPlatformConsoleUrl(demoUrl);
9425
+ }
9426
+ return jsx(DotMetadataApiContext.Provider, {
9427
+ value: memoizedValues,
9428
+ children: children
9429
+ });
9430
+ };
9431
+ const useDotMetadataApiContext = () => {
9432
+ return useContext(DotMetadataApiContext);
9433
+ };
9434
+
9435
+ const StyledDashboardDialog = styled(DotDialog)`
9436
+ ${({
9437
+ theme
9438
+ }) => css`
9439
+ .dot-text-field {
9440
+ margin-bottom: ${theme.spacing(2)};
9441
+ width: 40vw;
9442
+ }
9443
+ .dot-autocomplete {
9444
+ margin-top: ${theme.spacing(1.5)};
9445
+ }
9446
+ .dot-input-select {
9447
+ margin-bottom: ${theme.spacing(2)};
9448
+ }
9449
+ `}
9450
+ `;
9451
+ const StyledDialogActions = styled(DialogActions)`
9452
+ padding-right: 0;
9453
+ `;
9454
+
9455
+ const DashboardAppTypeOptions = [
9456
+ // Matches target_app values in Dashboard model
9457
+ {
9458
+ option: 'Agility',
9459
+ value: 'AGILITY'
9460
+ }, {
9461
+ option: 'Release',
9462
+ value: 'RELEASE'
9463
+ }, {
9464
+ option: 'Deploy',
9465
+ value: 'DEPLOY'
9466
+ }, {
9467
+ option: 'Continuous Testing',
9468
+ value: 'CONTINUOUSTEST'
9469
+ }, {
9470
+ option: 'TeamForge',
9471
+ value: 'TEAMFORGE'
9472
+ }];
9473
+ const initialFormState = {
9474
+ categories: [],
9475
+ description: '',
9476
+ name: ''
9477
+ };
9478
+ const DASHBOARD_NAME_MAX_LENGTH = 250;
9479
+ const DASHBOARD_DESCRIPTION_MAX_LENGTH = 250;
9480
+ function DotDashboardDialog({
9481
+ availableCategories,
9482
+ copyDashboard,
9483
+ editDashboard,
9484
+ open,
9485
+ onClose,
9486
+ onSubmit,
9487
+ onContinue,
9488
+ title
9489
+ }) {
9490
+ const [isDirty, setIsDirty] = useState(false);
9491
+ const [isLoadingSubmit, setIsLoadingSubmit] = useState(false);
9492
+ const [nameError, setNameError] = useState(null);
9493
+ const [formValues, setFormValues] = useState(initialFormState);
9494
+ const {
9495
+ categories,
9496
+ description,
9497
+ name
9498
+ } = formValues;
9499
+ const {
9500
+ searchDashboards
9501
+ } = useDotMetadataApiContext();
9502
+ const {
9503
+ cancelablePromise
9504
+ } = useCancelablePromise();
9505
+ useEffect(() => {
9506
+ if (copyDashboard) {
9507
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9508
+ name: copyDashboard.name + ' (copy)',
9509
+ description: copyDashboard.description,
9510
+ categories: copyDashboard.categories
9511
+ }));
9512
+ }
9513
+ if (editDashboard) {
9514
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9515
+ name: editDashboard.name,
9516
+ description: editDashboard.description,
9517
+ categories: editDashboard.categories
9518
+ }));
9519
+ }
9520
+ return () => {
9521
+ onClose(false);
9522
+ };
9523
+ }, []);
9524
+ const handleSubmit = useCallback(returnToList => __awaiter(this, void 0, void 0, function* () {
9525
+ setIsLoadingSubmit(true);
9526
+ const useFormValues = Object.assign(Object.assign({}, formValues), {
9527
+ id: editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
9528
+ });
9529
+ const validName = yield validateName(useFormValues.name);
9530
+ if (validName) {
9531
+ yield onSubmit(useFormValues, returnToList);
9532
+ }
9533
+ setIsLoadingSubmit(false);
9534
+ }), [formValues, editDashboard]);
9535
+ const handleSubmitCreate = useCallback(() => {
9536
+ handleSubmit(false);
9537
+ }, [handleSubmit]);
9538
+ const handleSubmitEditExit = useCallback(() => {
9539
+ handleSubmit(true);
9540
+ }, [handleSubmit]);
9541
+ const handleSubmitEditContinue = useCallback(() => {
9542
+ if (isDirty || !onContinue) {
9543
+ handleSubmit(false);
9544
+ } else {
9545
+ onContinue();
9546
+ }
9547
+ }, [isDirty, handleSubmit, onContinue]);
9548
+ const handleChange = useCallback(event => {
9549
+ const targetName = event.target.name;
9550
+ const value = event.target.value;
9551
+ setNameError(null);
9552
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9553
+ [targetName]: value
9554
+ }));
9555
+ setIsDirty(true);
9556
+ }, [formValues]);
9557
+ const handleChangeCategories = useCallback((_event, options, _reason) => {
9558
+ const values = options.map(option => option.title);
9559
+ setFormValues(orig => Object.assign(Object.assign({}, orig), {
9560
+ categories: values
9561
+ }));
9562
+ setIsDirty(true);
9563
+ }, [formValues]);
9564
+ const getCategoryValues = useCallback(() => categories.map(category => ({
9565
+ title: category
9566
+ })), [categories]);
9567
+ const getAvailableCategoryOptions = useCallback(() => {
9568
+ const availableCategoryOptions = [];
9569
+ if (availableCategories) {
9570
+ availableCategories.forEach(category => {
9571
+ if (!categories.includes(category)) {
9572
+ availableCategoryOptions.push({
9573
+ title: category
9574
+ });
9575
+ }
9576
+ });
9577
+ }
9578
+ return availableCategoryOptions;
9579
+ }, [availableCategories, categories]);
9580
+ const validateName = nameToValidate => __awaiter(this, void 0, void 0, function* () {
9581
+ return cancelablePromise(searchDashboards({
9582
+ name: nameToValidate
9583
+ })).then(response => {
9584
+ if (response === null || 'error' in response) {
9585
+ setNameError('Could not check existing names due to a server error.');
9586
+ return false;
9587
+ } else if (response.length > 0) {
9588
+ const matchingNames = response.filter(dashboard => dashboard.name.toLowerCase() === nameToValidate.toLowerCase() && (!editDashboard || dashboard.name !== editDashboard.name));
9589
+ if (matchingNames.length > 0) {
9590
+ setNameError(`Cannot use duplicate name '${name}'`);
9591
+ return false;
9592
+ }
9593
+ }
9594
+ return true;
9595
+ });
9596
+ });
9597
+ const handleNameBlur = useCallback(event => {
9598
+ const newName = event.target.value;
9599
+ if (newName) {
9600
+ validateName(newName);
9601
+ }
9602
+ }, [validateName]);
9603
+ return jsxs(StyledDashboardDialog, {
9604
+ cancelButtonProps: {
9605
+ 'data-testid': 'cancel-create-dashboard-button'
9606
+ },
9607
+ cancelButtonVisible: !editDashboard,
9608
+ closeOnClickAway: !editDashboard,
9609
+ closeOnSubmit: false,
9610
+ hasPrimaryAction: !editDashboard,
9611
+ open: open,
9612
+ onCancel: () => onClose(true),
9613
+ onSubmit: handleSubmitCreate,
9614
+ submitButtonProps: {
9615
+ 'data-testid': 'confirm-create-dashboard-button',
9616
+ disabled: !name || isLoadingSubmit,
9617
+ label: 'Continue'
9618
+ },
9619
+ title: title || 'Create dashboard',
9620
+ children: [jsx(DotInputText, {
9621
+ autoFocus: true,
9622
+ "data-testid": "dashboard-dialog-name-input",
9623
+ error: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH,
9624
+ helperText: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH && `Name must be ${DASHBOARD_NAME_MAX_LENGTH} characters or less`,
9625
+ id: "name",
9626
+ label: "Dashboard name",
9627
+ name: "name",
9628
+ onBlur: handleNameBlur,
9629
+ onChange: handleChange,
9630
+ required: true,
9631
+ value: name
9632
+ }), jsx(DotInputText, {
9633
+ "data-testid": "dashboard-dialog-description-input",
9634
+ error: description.length > DASHBOARD_DESCRIPTION_MAX_LENGTH,
9635
+ helperText: description.length > DASHBOARD_DESCRIPTION_MAX_LENGTH && `Description must be ${DASHBOARD_DESCRIPTION_MAX_LENGTH} characters or less`,
9636
+ id: "description",
9637
+ label: "Description",
9638
+ multiline: true,
9639
+ minRows: 4,
9640
+ maxRows: 4,
9641
+ name: "description",
9642
+ onChange: handleChange,
9643
+ value: description
9644
+ }), editDashboard && jsxs(Fragment, {
9645
+ children: [jsx(DotTypography, {
9646
+ variant: "h3",
9647
+ children: "Application type"
9648
+ }), jsx(DotInputSelect, {
9649
+ className: "dot-input-select",
9650
+ options: DashboardAppTypeOptions,
9651
+ id: "dashboard-apptype-select",
9652
+ "data-testid": "dashboard-dialog-apptype-input",
9653
+ name: "Select application",
9654
+ disabled: true,
9655
+ value: editDashboard.target_apps[0]
9656
+ })]
9657
+ }), jsx(DotTypography, {
9658
+ variant: "h3",
9659
+ children: "Category"
9660
+ }), jsx(DotTypography, {
9661
+ variant: "body2",
9662
+ children: "Please select the appropriate categories"
9663
+ }), jsx(DotAutoComplete, {
9664
+ "data-testid": "dashboard-dialog-categories-input",
9665
+ filterSelectedOptions: true,
9666
+ inputId: "dashboard-dialog-categories-input",
9667
+ onChange: handleChangeCategories,
9668
+ options: getAvailableCategoryOptions(),
9669
+ placeholder: "Select categories",
9670
+ label: "Category",
9671
+ required: editDashboard && editDashboard.lifecycle_state === DashboardView.lifecycle_state.PUBLISHED,
9672
+ value: getCategoryValues()
9673
+ }), editDashboard && jsx(Fragment, {
9674
+ children: jsxs(StyledDialogActions, {
9675
+ children: [jsx(DotButton, {
9676
+ className: "cancel-button",
9677
+ "data-testid": "cancel-edit-dashboard-button",
9678
+ onClick: () => onClose(true),
9679
+ type: "text",
9680
+ children: "Cancel"
9681
+ }), jsx(DotButton, {
9682
+ "data-testid": "save-edit-exit-dashboard-button",
9683
+ disabled: isLoadingSubmit || !isDirty,
9684
+ onClick: handleSubmitEditExit,
9685
+ type: "outlined",
9686
+ children: "Save and exit"
9687
+ }), jsx(DotButton, {
9688
+ "data-testid": "save-edit-continue-dashboard-button",
9689
+ disabled: isLoadingSubmit,
9690
+ onClick: handleSubmitEditContinue,
9691
+ type: "primary",
9692
+ children: isDirty ? 'Save and continue' : 'Continue'
9693
+ })]
9694
+ })
9695
+ })]
9696
+ });
9697
+ }
9698
+
9699
+ const getSnackbarTitleFromSeverity = severity => {
9700
+ switch (severity) {
9701
+ case 'success':
9702
+ return 'Success';
9703
+ case 'warning':
9704
+ return 'Warning';
9705
+ case 'error':
9706
+ return 'Error';
9707
+ case 'info':
9708
+ return 'Info';
9709
+ default:
9710
+ return 'Success';
9711
+ }
9712
+ };
9713
+ function getErrorText(error) {
9714
+ var _a, _b;
9715
+ if ('status' in error && error.status === 304) {
9716
+ return 'No changes made';
9717
+ } else if ('body' in error) {
9718
+ 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';
9719
+ } else if ('message' in error) {
9720
+ return error.message;
9721
+ }
9722
+ return 'Unexpected API error';
9723
+ }
9724
+
9725
+ function addAutoHideDuration(severity) {
9726
+ return severity === 'error' ? null : 10000;
9727
+ }
9728
+
9729
+ const rootClassName$z = 'dot-snackbar';
9730
+ const StyledSnackbar = styled(Snackbar)`
9731
+ ${({
9732
+ theme,
9733
+ width,
9734
+ $anchorOriginTop
9735
+ }) => css`
9736
+ &.${rootClassName$z} {
9737
+ .MuiAlert-message {
9738
+ word-break: break-word;
9739
+ }
9740
+ .${rootClassName$16} {
9741
+ align-items: flex-start;
9742
+ }
9743
+ &.MuiSnackbar-anchorOriginTopLeft,
9744
+ &.MuiSnackbar-anchorOriginTopCenter,
9745
+ &.MuiSnackbar-anchorOriginTopRight {
9746
+ top: ${$anchorOriginTop}px;
9747
+ z-index: ${levelFourth};
9748
+ }
9749
+
9750
+ .dot-snackbar-actions {
9751
+ display: flex;
9752
+ align-items: center;
9753
+ margin-top: ${theme.spacing(1)};
9754
+ gap: ${theme.spacing(2)};
9755
+
9756
+ .primary-action-btn {
9757
+ background-color: transparent;
9758
+ }
9759
+ }
9760
+
9761
+ .MuiAlert-root {
9762
+ max-width: ${width ? 'unset' : '500px'};
9763
+ min-width: ${width ? 'unset' : '344px'};
9764
+ z-index: ${levelFourth};
9765
+ }
9766
+ }
9767
+ `}
9768
+ `;
9769
+
9770
+ const DEFAULT_ANCHOR_ORIGIN = {
9771
+ vertical: 'top',
9772
+ horizontal: 'right'
9773
+ };
9774
+ const DotSnackbar = ({
9775
+ anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
9776
+ anchorOriginTop = 108,
9777
+ ariaLabel,
9778
+ autoHideDuration,
9779
+ children,
9780
+ className,
9781
+ 'data-testid': dataTestId,
9782
+ hideOnClickAway = true,
9783
+ onClose,
9784
+ open,
9785
+ primaryAction,
9786
+ secondaryAction,
9787
+ severity,
9788
+ width
9789
+ }) => {
9790
+ const hasActions = !!(primaryAction || secondaryAction);
9791
+ const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
9792
+ const rootClasses = useStylesWithRootClass(rootClassName$z, className);
9793
+ const handleSnackbarClose = reason => {
9794
+ if (!reason || hideOnClickAway || !hideOnClickAway && reason !== 'clickaway') {
9795
+ onClose();
9796
+ }
9797
+ };
9798
+ return jsx(StyledSnackbar, {
9799
+ anchorOrigin: anchorOrigin,
9800
+ "$anchorOriginTop": anchorOriginTop,
9801
+ "aria-label": ariaLabel,
9802
+ autoHideDuration: calculatedAutoHideDuration,
9803
+ classes: {
9804
+ root: rootClasses
9805
+ },
9806
+ "data-testid": dataTestId,
9807
+ onClose: (_e, r) => handleSnackbarClose(r),
9808
+ open: open,
9809
+ severity: severity,
9810
+ width: width,
9811
+ children: jsx("div", {
9812
+ children: jsx(DotAlertBanner, {
9813
+ severity: severity,
9814
+ width: width,
9815
+ onClose: _e => handleSnackbarClose(),
9816
+ children: jsxs("div", {
9817
+ children: [jsx(DotTypography, {
9818
+ variant: "subtitle2",
9819
+ noMarginBottom: false,
9820
+ children: getSnackbarTitleFromSeverity(severity)
9821
+ }), isString$2(children) ? jsx(DotTypography, {
9822
+ ariaLabel: severity,
9823
+ variant: "body1",
9824
+ children: children
9825
+ }) : jsx("span", {
9826
+ "aria-label": severity,
9827
+ children: children
9828
+ }), hasActions && jsxs("div", {
9829
+ className: "dot-snackbar-actions",
9830
+ children: [primaryAction && jsx(DotButton, {
9831
+ className: "primary-action-btn",
9832
+ "data-testid": "primary-action-btn",
9833
+ onClick: primaryAction.onClick,
9834
+ size: "small",
9835
+ type: "outlined",
9836
+ children: primaryAction.label
9837
+ }), secondaryAction && jsx(DotLink, {
9838
+ "data-testid": "secondary-action-link",
9839
+ href: secondaryAction.href,
9840
+ color: "inherit",
9841
+ children: secondaryAction.label
9842
+ })]
9843
+ })]
9844
+ })
9845
+ })
9846
+ })
9847
+ });
9848
+ };
9849
+
9850
+ const rootClassName$y = 'dot-snackbar-container';
9851
+ const StyledSnackbarContainer = styled.div`
9852
+ ${() => css`
9853
+ &.${rootClassName$y} {
9854
+ position: absolute;
9855
+ top: 0;
9856
+ width: 250px;
9857
+ height: auto;
9858
+ right: 0;
9859
+ & > div {
9860
+ position: relative;
9861
+ }
9862
+ }
9863
+ `}
9864
+ `;
9865
+
9866
+ const DotSnackbarContext = createContext({
9867
+ alerts: [],
9868
+ enqueueMessage: (_message, _severity, _autoHideDuration, _primaryAction, _secondaryAction) => null,
9869
+ removeMessage: _id => null
9870
+ });
9871
+ const DotSnackbarContainer = ({
9872
+ hideOnClickAway
9873
+ }) => {
9874
+ const {
9875
+ alerts,
9876
+ removeMessage
9877
+ } = useDotSnackbarContext();
9878
+ function handleClose(id) {
9879
+ return () => {
9880
+ removeMessage(id);
9881
+ };
9882
+ }
9883
+ return jsx(StyledSnackbarContainer, {
9884
+ className: rootClassName$y,
9885
+ children: jsx("div", {
9886
+ className: rootClassName$y,
9887
+ "data-testid": rootClassName$y,
9888
+ children: alerts.slice().reverse().map(alert => {
9889
+ return jsx(DotSnackbar, {
9890
+ autoHideDuration: alert.autoHideDuration,
9891
+ hideOnClickAway: hideOnClickAway,
9892
+ onClose: handleClose(alert.id),
9893
+ open: alert.open,
9894
+ severity: alert.severity,
9895
+ primaryAction: alert.primaryAction,
9896
+ secondaryAction: alert.secondaryAction,
9897
+ children: alert.message
9898
+ }, alert.id);
9899
+ })
9900
+ })
9901
+ });
9902
+ };
9903
+ const DotSnackbarProvider = ({
9904
+ children,
9905
+ hideOnClickAway = true
9906
+ }) => {
9907
+ const [alerts, setAlerts] = useState([]);
9908
+ function enqueueMessage(message, severity, autoHideDuration, primaryAction, secondaryAction) {
9909
+ const id = CreateUUID();
9910
+ const queue = {
9911
+ id,
9912
+ message,
9913
+ severity,
9914
+ open: true,
9915
+ autoHideDuration,
9916
+ primaryAction,
9917
+ secondaryAction
9918
+ };
9919
+ setAlerts(prevState => {
9920
+ return [...prevState, Object.assign({}, queue)];
9921
+ });
9922
+ return id;
9923
+ }
9924
+ const removeMessage = id => {
9925
+ setAlerts(prev => {
9926
+ return prev.map(a => {
9927
+ return a.id === id ? Object.assign(Object.assign({}, a), {
9928
+ open: false
9929
+ }) : a;
9930
+ });
9931
+ });
9932
+ };
9933
+ const DotSnackbarValues = {
9934
+ alerts,
9935
+ enqueueMessage,
9936
+ removeMessage
9937
+ };
9938
+ const memoizedValues = useMemo(() => DotSnackbarValues, [alerts]);
9939
+ return jsxs(DotSnackbarContext.Provider, {
9940
+ value: memoizedValues,
9941
+ children: [jsx(DotSnackbarContainer, {
9942
+ hideOnClickAway: hideOnClickAway
9943
+ }), children]
9944
+ });
9945
+ };
9946
+ const useDotSnackbarContext = () => {
9947
+ return useContext(DotSnackbarContext);
9948
+ };
9949
+ const useEnqueueErrorMessage = error => {
9950
+ const {
9951
+ enqueueMessage
9952
+ } = useDotSnackbarContext();
9953
+ useEffect(() => {
9954
+ error && enqueueMessage(getErrorText(error), 'error');
9955
+ }, [error]);
9956
+ };
9957
+
9958
+ const InlineMessage = styled(DotTypography)`
9959
+ ${({
9960
+ theme
9961
+ }) => css`
9962
+ display: inline;
9963
+ margin-left: ${theme.spacing(1)};
9964
+ `}
9965
+ `;
9966
+ const StyledPublishConfirmDiv = styled.div`
9967
+ ${({
9968
+ theme
9969
+ }) => css`
9970
+ .dot-alert-banner {
9971
+ margin-bottom: ${theme.spacing(4)};
9972
+ }
9973
+ .dot-autocomplete,
9974
+ .dot-avatar {
9975
+ margin-bottom: ${theme.spacing(2)};
9976
+ }
9977
+ `}
9978
+ `;
9979
+ const StyledAppSelectDiv = styled.div`
9980
+ ${() => css`
9981
+ display: flex;
9982
+ gap: 24px;
9983
+ align-items: center;
9984
+ `}
9985
+ `;
9986
+ const StyledAppSelectDotAutoComplete = styled(DotAutoComplete)`
9987
+ width: 100%;
9988
+ `;
9989
+ const StyledAppSelectAutoCompleteOption = styled.li`
9990
+ ${({
9991
+ theme
9992
+ }) => css`
9993
+ display: flex;
9994
+ align-items: center;
9995
+ gap: 16px;
9996
+ padding: ${theme.spacing(0.75, 2, 0.75, 3)};
9997
+ &:hover,
9998
+ &:focus {
9999
+ background: ${theme.palette.grey[500]};
10000
+ }
10001
+ `}
10002
+ `;
10003
+
10004
+ const productNameCategoryMap = {
10005
+ Agility: 'AGILITY',
10006
+ Release: 'RELEASE',
10007
+ Deploy: 'DEPLOY',
10008
+ 'Continuous Testing': 'CONTINUOUSTEST',
10009
+ TeamForge: 'TEAMFORGE'
10010
+ };
10011
+ /**
10012
+ * Content displayed in the dialog when publishing
10013
+ */
10014
+ function ActivePublishMessage({
10015
+ applicationList,
10016
+ categories,
10017
+ dashboardName,
10018
+ initialCategories,
10019
+ published,
10020
+ publishing,
10021
+ onChange
10022
+ }) {
10023
+ const [selectedApp, setSelectedApp] = useState(applicationList.length > 0 ? applicationList[0] : null);
10024
+ const [selectedCategories, setSelectedCategories] = useState([]);
10025
+ const [appNameMap, setAppNameMap] = useState({});
10026
+ const [appNameMapLoading, setAppNameMapLoading] = useState(true);
10027
+ const [categoryOptions, setCategoryOptions] = useState([]);
10028
+ const appOptions = applicationList.map((application, index) => {
10029
+ return {
10030
+ title: application.name,
10031
+ imageUrl: (application === null || application === void 0 ? void 0 : application.logo) ? 'data:image/svg+xml;base64,' + application.logo : null,
10032
+ uid: index + 1
10033
+ };
10034
+ });
10035
+ useEffect(() => {
10036
+ if (applicationList) {
10037
+ const newAppNameMap = {};
10038
+ applicationList.forEach(application => {
10039
+ newAppNameMap[application.name] = application;
10040
+ });
10041
+ setAppNameMap(newAppNameMap);
10042
+ setAppNameMapLoading(false);
10043
+ }
10044
+ }, [applicationList]);
10045
+ useEffect(() => {
10046
+ const selectedCategoryOptions = [];
10047
+ if (selectedApp) {
10048
+ if (selectedApp.logo_product_name in productNameCategoryMap) {
10049
+ const categoryKey = productNameCategoryMap[selectedApp.logo_product_name];
10050
+ const appCategories = categories.categories[categoryKey];
10051
+ const newCategoryOptions = appCategories.map(category => ({
10052
+ title: category
10053
+ }));
10054
+ setCategoryOptions(newCategoryOptions);
10055
+ selectedCategoryOptions.push(...newCategoryOptions.filter(o => initialCategories.includes(o.title)));
10056
+ } else {
10057
+ setCategoryOptions([]);
10058
+ }
10059
+ } else {
10060
+ setCategoryOptions([]);
10061
+ }
10062
+ setSelectedCategories(selectedCategoryOptions);
10063
+ }, [selectedApp]);
10064
+ useEffect(() => {
10065
+ const selectedAppCategories = selectedCategories.map(c => c.title);
10066
+ onChange(selectedApp, selectedAppCategories);
10067
+ // selectedApp is excluded from dependency list on purpose
10068
+ // since selectedCategories is always updated when selectedApp changes
10069
+ }, [selectedCategories]);
10070
+ const handleApplicationSelect = useCallback((_event, value, _reason) => {
10071
+ if (value === null) {
10072
+ setSelectedApp(null);
10073
+ } else {
10074
+ let nameKey = null;
10075
+ if (typeof value === 'string') {
10076
+ nameKey = value;
10077
+ } else {
10078
+ nameKey = value.title;
10079
+ }
10080
+ const newSelectedApp = value ? appNameMap[nameKey] : null;
10081
+ setSelectedApp(newSelectedApp);
10082
+ }
10083
+ }, [appNameMap, onChange]);
10084
+ const handleChangeCategories = useCallback((_event, options, _reason) => {
10085
+ setSelectedCategories(options);
10086
+ }, []);
10087
+ if (published) {
10088
+ return jsxs(StyledPublishConfirmDiv, {
10089
+ children: [jsxs(DotAlertBanner, {
10090
+ severity: "success",
10091
+ children: ["Success! ", jsx("strong", {
10092
+ children: dashboardName
10093
+ }), " has been published."]
10094
+ }), jsxs(DotTypography, {
10095
+ children: ["To view your newly published dashboard in", ' ', jsxs("strong", {
10096
+ children: ["\"", selectedApp.name, "\""]
10097
+ }), ", go to the", ' ', jsx("strong", {
10098
+ children: "'Digital.ai Analytics'"
10099
+ }), " section and explore."]
10100
+ })]
10101
+ });
10102
+ }
10103
+ if (publishing) {
10104
+ return jsxs(Fragment, {
10105
+ children: [jsx(DotProgress, {
10106
+ ariaLabel: "Publishing",
10107
+ "data-testid": "publishing-spinner",
10108
+ size: "24px"
10109
+ }), jsxs(InlineMessage, {
10110
+ children: ["Publishing ", jsxs("strong", {
10111
+ children: ["\"", dashboardName, "\""]
10112
+ }), " to", ' ', jsxs("strong", {
10113
+ children: ["\"", selectedApp.name, "\""]
10114
+ }), "."]
10115
+ })]
10116
+ });
10117
+ }
10118
+ return jsx(StyledPublishConfirmDiv, {
10119
+ children: !appNameMapLoading && jsxs(Fragment, {
10120
+ children: [jsxs(DotAlertBanner, {
10121
+ severity: "info",
10122
+ children: ["By clicking publish to application,", ' ', jsxs("strong", {
10123
+ children: ["\"", dashboardName, "\""]
10124
+ }), " will be visible in the application instance."]
10125
+ }), jsxs(StyledAppSelectDiv, {
10126
+ children: [jsx(StyledAppSelectDotAutoComplete, {
10127
+ "data-testid": "publish-app-select",
10128
+ defaultValue: applicationList.length > 0 ? applicationList[0].name : undefined,
10129
+ freesolo: false,
10130
+ multiple: false,
10131
+ filterSelectedOptions: true,
10132
+ inputId: "publish-app-select",
10133
+ label: "Select application",
10134
+ placeholder: "Select application",
10135
+ onChange: handleApplicationSelect,
10136
+ onInputChange: handleApplicationSelect,
10137
+ options: appOptions,
10138
+ required: true,
10139
+ dense: false,
10140
+ size: "medium",
10141
+ renderOption: (props, option) => {
10142
+ return jsxs(StyledAppSelectAutoCompleteOption, Object.assign({}, props, {
10143
+ children: [jsx(DotAvatar, {
10144
+ alt: "Application logo",
10145
+ imageSrc: option.imageUrl,
10146
+ iconId: "file-image",
10147
+ type: "image",
10148
+ variant: "circular",
10149
+ size: "large"
10150
+ }), jsx("div", {
10151
+ children: option.title
10152
+ })]
10153
+ }), option.uid);
10154
+ }
10155
+ }), (selectedApp === null || selectedApp === void 0 ? void 0 : selectedApp.logo) && jsx(DotAvatar, {
10156
+ alt: "Application logo",
10157
+ imageSrc: `data:${detectImageMimeType(selectedApp.logo)};base64,${selectedApp.logo}`,
10158
+ iconId: "file-image",
10159
+ type: 'image',
10160
+ variant: "circular",
10161
+ size: "large"
10162
+ })]
10163
+ }), (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, {
10164
+ "data-testid": "publish-categories-input",
10165
+ inputId: "publish-categories-input",
10166
+ onChange: handleChangeCategories,
10167
+ options: categoryOptions,
10168
+ placeholder: "Select categories",
10169
+ value: selectedCategories,
10170
+ filterSelectedOptions: true
10171
+ }), jsxs(DotTypography, {
10172
+ children: ["You are about to publish ", jsxs("strong", {
10173
+ children: ["\"", dashboardName, "\""]
10174
+ }), ". Click", ' ', "the publish button to promote it to the selected instance."]
10175
+ })]
10176
+ })
10177
+ });
10178
+ }
10179
+ /**
10180
+ * Content displayed in the dialog when unpublishing
10181
+ */
10182
+ function ActiveUnpublishMessage({
10183
+ dashboardName,
10184
+ unpublished,
10185
+ unpublishing
10186
+ }) {
10187
+ const unpublishMessage = jsxs(DotTypography, {
10188
+ children: ["You are about to unpublish ", jsxs("strong", {
10189
+ children: ["\"", dashboardName, "\""]
10190
+ }), ". Click", ' ', jsx("strong", {
10191
+ children: "Unpublish"
10192
+ }), " to confirm."]
10193
+ });
10194
+ const unpublishingMessage = jsxs(Fragment, {
10195
+ children: [jsx(DotProgress, {
10196
+ ariaLabel: "Unpublishing",
10197
+ "data-testid": "unpublishing-spinner",
10198
+ size: "24px"
10199
+ }), jsxs(InlineMessage, {
10200
+ children: ["Unpublishing ", jsxs("strong", {
10201
+ children: ["\"", dashboardName, "\""]
10202
+ }), "."]
10203
+ })]
10204
+ });
10205
+ const unpublishedMessage = jsxs(StyledPublishConfirmDiv, {
10206
+ children: [jsxs(DotAlertBanner, {
10207
+ severity: "success",
10208
+ children: ["Success! ", jsxs("strong", {
10209
+ children: ["\"", dashboardName, "\""]
10210
+ }), " has been unpublished."]
10211
+ }), jsxs(DotTypography, {
10212
+ children: ["To view updates in the application instance, go to the", ' ', jsx("strong", {
10213
+ children: "'Digital.ai Analytics'"
10214
+ }), " section and explore."]
10215
+ })]
10216
+ });
10217
+ let activeUnpublishMesssage = unpublishMessage;
10218
+ if (unpublished) {
10219
+ activeUnpublishMesssage = unpublishedMessage;
10220
+ } else if (unpublishing) {
10221
+ activeUnpublishMesssage = unpublishingMessage;
10222
+ }
10223
+ return activeUnpublishMesssage;
10224
+ }
10225
+ function DotDashboardPublishConfirm({
10226
+ applicationList,
10227
+ categories,
10228
+ dashboardToPublish,
10229
+ dashboardToUnpublish,
10230
+ onClose,
10231
+ onStatusChanged
10232
+ }) {
10233
+ const [publishing, setPublishing] = useState(null);
10234
+ const [unpublishing, setUnpublishing] = useState(null);
10235
+ const [published, setPublished] = useState(false);
10236
+ const [unpublished, setUnpublished] = useState(false);
10237
+ const [publishAppInstance, setPublishAppInstance] = useState(null);
10238
+ const [publishCategories, setPublishCategories] = useState([]);
10239
+ const filteredApplications = applicationList === null || applicationList === void 0 ? void 0 : applicationList.filter(application => {
10240
+ return dashboardToPublish && application.logo_product_name in productNameCategoryMap && dashboardToPublish.target_apps.includes(productNameCategoryMap[application.logo_product_name]);
10241
+ });
10242
+ const {
10243
+ updateDashboard,
10244
+ dashboardsError
10245
+ } = useDotMetadataApiContext();
10246
+ const {
10247
+ cancelablePromise
10248
+ } = useCancelablePromise();
10249
+ const {
10250
+ enqueueMessage
10251
+ } = useDotSnackbarContext();
10252
+ useEnqueueErrorMessage(dashboardsError);
10253
+ useEffect(() => {
10254
+ if (dashboardToPublish === null) {
10255
+ setPublishing(null);
10256
+ setPublished(false);
10257
+ } else {
10258
+ setPublishCategories(dashboardToPublish.categories || []);
10259
+ }
10260
+ }, [dashboardToPublish]);
10261
+ useEffect(() => {
10262
+ if (dashboardToUnpublish === null) {
10263
+ setUnpublishing(null);
10264
+ setUnpublished(false);
10265
+ }
10266
+ }, [dashboardToUnpublish]);
10267
+ const handlePublish = useCallback(() => {
10268
+ const patchDashboard = {
10269
+ lifecycle_state: DashboardView.lifecycle_state.PUBLISHED,
10270
+ application_instances: [publishAppInstance.id],
10271
+ categories: publishCategories
10272
+ };
10273
+ setPublishing(cancelablePromise(updateDashboard(dashboardToPublish.id, patchDashboard).then(updatedDashboard => {
10274
+ setPublished(true);
10275
+ onStatusChanged(updatedDashboard);
10276
+ enqueueMessage('Dashboard has been published!', 'success');
10277
+ }).catch(() => {
10278
+ setPublishing(null);
10279
+ })));
10280
+ }, [dashboardToPublish, publishAppInstance, publishCategories, updateDashboard]);
10281
+ const handleCancelPublish = useCallback(() => {
10282
+ if (publishing !== null) {
10283
+ publishing.cancel();
10284
+ }
10285
+ onClose();
10286
+ }, [publishing, onClose]);
10287
+ const handleUnpublish = useCallback(() => {
10288
+ setUnpublishing(cancelablePromise(updateDashboard(dashboardToUnpublish.id, {
10289
+ lifecycle_state: DashboardView.lifecycle_state.DRAFT
10290
+ }).then(updatedDashboard => {
10291
+ setUnpublished(true);
10292
+ onStatusChanged(updatedDashboard);
10293
+ enqueueMessage('Dashboard has been unpublished!', 'success');
10294
+ }).catch(() => {
10295
+ setUnpublishing(null);
10296
+ })));
10297
+ }, [dashboardToUnpublish, updateDashboard]);
10298
+ const handleCancelUnpublish = useCallback(() => {
10299
+ if (unpublishing !== null) {
10300
+ unpublishing.cancel();
10301
+ }
10302
+ onClose();
10303
+ }, [unpublishing, onClose]);
10304
+ const handlePublishChange = useCallback((selectedApplication, selectedCategories) => {
10305
+ setPublishAppInstance(selectedApplication);
10306
+ setPublishCategories(selectedCategories);
10307
+ }, []);
10308
+ return jsxs(Fragment, {
10309
+ children: [dashboardToPublish !== null && jsx(DotDialog, {
10310
+ cancelButtonVisible: !published,
10311
+ closeOnSubmit: false,
10312
+ hasPrimaryAction: publishing === null || published,
10313
+ open: dashboardToPublish !== null,
10314
+ title: "Publish to application",
10315
+ submitButtonProps: {
10316
+ 'data-testid': 'publish-confirm-button',
10317
+ 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,
10318
+ label: published ? 'Got it' : 'Publish'
10319
+ },
10320
+ onCancel: handleCancelPublish,
10321
+ onSubmit: published ? handleCancelPublish : handlePublish,
10322
+ children: jsx(ActivePublishMessage, {
10323
+ applicationList: filteredApplications,
10324
+ categories: categories,
10325
+ dashboardName: dashboardToPublish === null || dashboardToPublish === void 0 ? void 0 : dashboardToPublish.name,
10326
+ initialCategories: publishCategories,
10327
+ published: published,
10328
+ publishing: publishing !== null,
10329
+ onChange: handlePublishChange
10330
+ })
10331
+ }), dashboardToUnpublish !== null && jsx(DotDialog, {
10332
+ cancelButtonVisible: !unpublished,
10333
+ closeOnSubmit: false,
10334
+ hasPrimaryAction: unpublishing === null || unpublished,
10335
+ open: dashboardToUnpublish !== null,
10336
+ title: "Unpublish",
10337
+ submitButtonProps: {
10338
+ 'data-testid': 'unpublish-confirm-button',
10339
+ label: unpublished ? 'Got it' : 'Unpublish'
10340
+ },
10341
+ onCancel: handleCancelUnpublish,
10342
+ onSubmit: unpublished ? handleCancelUnpublish : handleUnpublish,
10343
+ children: jsx(ActiveUnpublishMessage, {
10344
+ dashboardName: dashboardToUnpublish === null || dashboardToUnpublish === void 0 ? void 0 : dashboardToUnpublish.name,
10345
+ unpublished: unpublished,
10346
+ unpublishing: unpublishing !== null
10347
+ })
10348
+ })]
10349
+ });
10350
+ }
10351
+
10352
+ const StyledDotMenu = styled(DotMenu)`
10353
+ ${() => css`
10354
+ z-index: 9999;
10355
+ `}
10356
+ `;
10357
+
10358
+ function DotDashboardOptionsMenu({
10359
+ dashboard,
10360
+ isEdit = false,
10361
+ onStartDuplicate,
10362
+ onStartStatusChange,
10363
+ onViewMode
10364
+ }) {
10365
+ const [anchorEl, setAnchorEl] = useState(null);
10366
+ const [open, setOpen] = useState(false);
10367
+ const handleMenuClick = useCallback(event => {
10368
+ setAnchorEl(event.currentTarget);
10369
+ setOpen(orig => !orig);
10370
+ }, []);
10371
+ const handleMenuClose = useCallback(() => {
10372
+ setAnchorEl(null);
10373
+ setOpen(false);
10374
+ }, []);
10375
+ const handleEditClick = useCallback(() => {
10376
+ handleMenuClose();
10377
+ onViewMode(dashboard, 'edit');
10378
+ }, [dashboard, onViewMode]);
10379
+ const isDraft = dashboard.lifecycle_state === DashboardView.lifecycle_state.DRAFT;
10380
+ const menuItems = [];
10381
+ if (!isEdit && onViewMode && !dashboard.is_ootb_dashboard) {
10382
+ menuItems.push({
10383
+ children: jsxs(DotLink, {
10384
+ ariaLabel: "Edit dashboard",
10385
+ color: "inherit",
10386
+ onClick: handleEditClick,
10387
+ underline: "none",
10388
+ children: [jsx(DotIcon, {
10389
+ iconId: "edit"
10390
+ }), " Edit"]
10391
+ }),
10392
+ key: 'edit',
10393
+ onclick: handleEditClick
10394
+ });
10395
+ }
10396
+ if (onStartStatusChange && !dashboard.is_ootb_dashboard && isDraft) {
10397
+ menuItems.push({
10398
+ key: 'publish',
10399
+ children: jsxs(DotLink, {
10400
+ ariaLabel: "Publish dashboard",
10401
+ color: "inherit",
10402
+ "data-testid": `publish-dashboard-button-${dashboard.id}`,
10403
+ onClick: () => {
10404
+ handleMenuClose();
10405
+ onStartStatusChange(dashboard, DashboardView.lifecycle_state.PUBLISHED);
10406
+ },
10407
+ underline: "none",
10408
+ children: [jsx(DotIcon, {
10409
+ iconId: "send-airplane"
10410
+ }), " ", 'Publish']
10411
+ }),
10412
+ onclick: () => {
10413
+ handleMenuClose();
10414
+ onStartStatusChange(dashboard, DashboardView.lifecycle_state.PUBLISHED);
10415
+ }
10416
+ });
10417
+ }
10418
+ if (onStartDuplicate) {
10419
+ const handleDuplicateClick = () => {
10420
+ handleMenuClose();
10421
+ onStartDuplicate(dashboard);
10422
+ };
10423
+ menuItems.push({
10424
+ children: jsxs(DotLink, {
10425
+ ariaLabel: "Duplicate dashboard",
10426
+ color: "inherit",
10427
+ onClick: handleDuplicateClick,
10428
+ underline: "none",
10429
+ children: [jsx(DotIcon, {
10430
+ iconId: "duplicate"
10431
+ }), " Duplicate"]
10432
+ }),
10433
+ key: 'duplicate',
10434
+ onclick: handleDuplicateClick
10435
+ });
10436
+ }
10437
+ return menuItems.length > 0 ? jsxs(Fragment, {
10438
+ children: [jsx(DotIconButton, {
10439
+ className: "expand-button",
10440
+ "data-testid": "card-header-action-button",
10441
+ iconId: "options",
10442
+ onClick: handleMenuClick,
10443
+ size: "medium"
10444
+ }), jsx(StyledDotMenu, {
10445
+ anchorEl: anchorEl,
10446
+ className: "card-header-action-menu",
10447
+ disablePortal: true,
10448
+ id: "card-header-action-menu",
10449
+ menuItems: menuItems,
10450
+ open: open,
10451
+ onLeave: handleMenuClose
10452
+ })]
10453
+ }) : null;
10454
+ }
10455
+
10456
+ const helpButtonClassName = 'help-button';
10457
+ const StyledDashboardActions = styled.div`
10458
+ ${({
10459
+ theme
10460
+ }) => css`
10461
+ button.${helpButtonClassName} {
10462
+ margin: ${theme.spacing(1)};
10463
+ }
10464
+ `}
10465
+ `;
10466
+
10467
+ function FavoriteButton({
10468
+ dashboard,
10469
+ onFavorite
10470
+ }) {
10471
+ const {
10472
+ dashboardsError,
10473
+ favoriteDashboard
10474
+ } = useDotMetadataApiContext();
10475
+ const {
10476
+ enqueueMessage
10477
+ } = useDotSnackbarContext();
10478
+ useEnqueueErrorMessage(dashboardsError);
10479
+ const handleFavorite = useCallback((dashboardId, favoriteValue) => {
10480
+ // being optimistic; if the api call fails, there will be an error message
10481
+ enqueueMessage(`Dashboard has been ${favoriteValue ? '' : 'un-'}favorited.`, 'success');
10482
+ onFavorite && onFavorite(dashboardId, favoriteValue);
10483
+ favoriteDashboard(dashboardId, favoriteValue);
10484
+ }, []);
10485
+ return jsx(DotIconButton, {
10486
+ iconId: `star-favorites-${dashboard.favorite ? 'active' : 'default'}`,
10487
+ "data-testid": `dashboard-favorite-icon-${dashboard.id}`,
10488
+ tooltip: dashboard.favorite ? 'Remove from favorites' : 'Add to favorites',
10489
+ onClick: () => handleFavorite(dashboard.id, !dashboard.favorite)
10490
+ });
10491
+ }
10492
+ function HelpButton({
10493
+ dashboard
10494
+ }) {
10495
+ const {
10496
+ getDashboardHelpContent
10497
+ } = useDotMetadataApiContext();
10498
+ const openHelpContent = useCallback(() => {
10499
+ return getDashboardHelpContent(dashboard.help_content_id).then(helpContentResponse => {
10500
+ const blob = new Blob([helpContentResponse], {
10501
+ type: 'text/html'
10502
+ });
10503
+ const url = URL.createObjectURL(blob);
10504
+ window.open(url, '_blank');
10505
+ });
10506
+ }, [dashboard]);
10507
+ return jsx(DotTooltip, {
10508
+ 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',
10509
+ children: jsx(DotButton, {
10510
+ className: helpButtonClassName,
10511
+ "data-testid": "help-content-button",
10512
+ disabled: !(dashboard === null || dashboard === void 0 ? void 0 : dashboard.help_content_id),
10513
+ onClick: openHelpContent,
10514
+ startIcon: jsx(DotIcon, {
10515
+ iconId: "help"
10516
+ }),
10517
+ type: "outlined",
10518
+ children: "Dashboard help"
10519
+ })
10520
+ });
10521
+ }
10522
+ function CloseButton({
10523
+ dashboard,
10524
+ onClose
10525
+ }) {
10526
+ return onClose ? jsx(DotIconButton, {
10527
+ iconId: "close",
10528
+ "data-testid": `dashboard-close-icon-${dashboard.id}`,
10529
+ tooltip: "Close dashboard",
10530
+ onClick: () => onClose(dashboard)
10531
+ }) : null;
10532
+ }
10533
+ function DotDashboardActions({
10534
+ applications,
10535
+ categories,
10536
+ dashboard,
10537
+ isEdit = false,
10538
+ canEdit = false,
10539
+ onClose,
10540
+ onFavorite,
10541
+ onStatusChanged,
10542
+ onDuplicated,
10543
+ onViewMode
10544
+ }) {
10545
+ // NOTE: useState functions need to stay at the top of the file so that
10546
+ // they are evaluated before any context imports. If they are evaluated
10547
+ // after they can cause React state issues when rendering.
10548
+ const [dashboardToCopy, setDashboardToCopy] = useState(null);
10549
+ const [dashboardToPublish, setDashboardToPublish] = useState(null);
10550
+ const [dashboardToUnpublish, setDashboardToUnpublish] = useState(null);
10551
+ const {
10552
+ duplicateDashboard
10553
+ } = useDotMetadataApiContext();
10554
+ const handlePublishConfirm = useCallback(publishedDashboard => {
10555
+ setDashboardToPublish(null);
10556
+ setDashboardToUnpublish(null);
10557
+ onStatusChanged && onStatusChanged(publishedDashboard);
10558
+ }, []);
10559
+ const handlePublishConfirmClose = useCallback(() => {
10560
+ setDashboardToPublish(null);
10561
+ setDashboardToUnpublish(null);
10562
+ }, []);
10563
+ const handleStartStatusChange = useCallback(() => {
10564
+ setDashboardToUnpublish(null);
10565
+ setDashboardToPublish(dashboard);
10566
+ }, [dashboard]);
10567
+ const handleDuplicateClose = useCallback(() => {
10568
+ setDashboardToCopy(null);
10569
+ }, []);
10570
+ const handleDuplicateSubmit = useCallback((data, isDone = true) => {
10571
+ setDashboardToCopy(null);
10572
+ const copyData = {
10573
+ name: data.name,
10574
+ description: data.description,
10575
+ categories: data.categories
10576
+ };
10577
+ return duplicateDashboard(dashboard.id, copyData).then(result => {
10578
+ if (result && 'id' in result) {
10579
+ onDuplicated(result, isDone);
10580
+ }
10581
+ });
10582
+ }, [dashboard]);
10583
+ const handleStartDuplicate = useCallback(dashboardToDupe => {
10584
+ setDashboardToCopy(dashboardToDupe);
10585
+ }, []);
10586
+ const handleStartDuplicateIfConfig = onDuplicated ? handleStartDuplicate : undefined;
10587
+ const handleStartStatusChangeIfConfig = onStatusChanged ? handleStartStatusChange : undefined;
10588
+ return jsxs(StyledDashboardActions, {
10589
+ "data-testid": "dot-dashboard-actions",
10590
+ children: [jsx(DotDashboardPublishConfirm, {
10591
+ applicationList: applications,
10592
+ categories: categories,
10593
+ dashboardToPublish: dashboardToPublish,
10594
+ dashboardToUnpublish: dashboardToUnpublish,
10595
+ onClose: handlePublishConfirmClose,
10596
+ onStatusChanged: handlePublishConfirm
10597
+ }), categories && dashboardToCopy && jsx(DotDashboardDialog, {
10598
+ title: "Create dashboard",
10599
+ availableCategories: categories === null || categories === void 0 ? void 0 : categories.categories[dashboard.target_apps[0]],
10600
+ copyDashboard: dashboardToCopy,
10601
+ open: true,
10602
+ onClose: handleDuplicateClose,
10603
+ onSubmit: handleDuplicateSubmit
10604
+ }), jsx(HelpButton, {
10605
+ dashboard: dashboard
10606
+ }), onFavorite && jsx(FavoriteButton, {
10607
+ dashboard: dashboard,
10608
+ onFavorite: onFavorite
10609
+ }), canEdit && jsx(DotDashboardOptionsMenu, {
10610
+ dashboard: dashboard,
10611
+ isEdit: isEdit,
10612
+ onViewMode: onViewMode,
10613
+ onStartStatusChange: handleStartStatusChangeIfConfig,
10614
+ onStartDuplicate: handleStartDuplicateIfConfig
10615
+ }), jsx(CloseButton, {
10616
+ dashboard: dashboard,
10617
+ onClose: onClose
10618
+ })]
10619
+ });
10620
+ }
10621
+
10622
+ const StyledDashboardHeader = styled(DotActionToolbar)`
10623
+ ${({
10624
+ theme
10625
+ }) => css`
10626
+ display: flex;
10627
+ justify-content: space-between;
10628
+ align-items: center;
10629
+ padding: ${theme.spacing(0, 2)};
10630
+ `}
10631
+ `;
10632
+
10633
+ function DotDashboardHeader({
10634
+ accountId,
10635
+ dashboard,
10636
+ isEdit = false,
10637
+ canEdit = false,
10638
+ onClose,
10639
+ onFavorite,
10640
+ onStatusChanged,
10641
+ onDuplicated,
10642
+ onViewMode
10643
+ }) {
10644
+ const {
10645
+ applications,
10646
+ applicationsError,
10647
+ applicationsLoading,
10648
+ loadApplications
10649
+ } = useDotCoreApiContext();
10650
+ const {
10651
+ categories,
10652
+ categoriesLoading,
10653
+ dashboardsError,
10654
+ getCategories
10655
+ } = useDotMetadataApiContext();
10656
+ useEnqueueErrorMessage(!applicationsLoading && applicationsError);
10657
+ useEnqueueErrorMessage(!categoriesLoading && dashboardsError);
10658
+ useEffect(() => {
10659
+ loadApplications(accountId);
10660
+ getCategories();
10661
+ }, []);
10662
+ return jsxs(StyledDashboardHeader, {
10663
+ children: [jsx(DotTypography, {
10664
+ component: "h2",
10665
+ variant: "h2",
10666
+ children: dashboard === null || dashboard === void 0 ? void 0 : dashboard.name
10667
+ }), jsx(DotDashboardActions, {
10668
+ applications: applications,
10669
+ categories: categories,
10670
+ dashboard: dashboard,
10671
+ isEdit: isEdit,
10672
+ canEdit: canEdit,
10673
+ onClose: onClose,
10674
+ onFavorite: onFavorite,
10675
+ onStatusChanged: onStatusChanged,
10676
+ onDuplicated: onDuplicated,
10677
+ onViewMode: onViewMode
10678
+ })]
10679
+ });
10680
+ }
10681
+
10682
+ const rootClassName$x = 'dot-empty-state';
10683
+ const StyledEmptyState = styled.div`
10684
+ ${({
10685
+ theme
10686
+ }) => css`
10687
+ &.dot-empty-state {
10688
+ margin: 0 auto;
10689
+ max-width: 600px;
10690
+ text-align: center;
10691
+
10692
+ .empty-state-image-container {
10693
+ display: flex;
10694
+ justify-content: center;
10695
+ }
10696
+
10697
+ .empty-state-image {
10698
+ min-height: ${theme.spacing(10)};
10699
+ margin-bottom: ${theme.spacing(5)};
10700
+ }
10701
+
10702
+ h2 {
10703
+ margin-bottom: ${theme.spacing(1)};
10704
+ }
10705
+
10706
+ .dot-tooltip {
10707
+ display: inline-block;
10708
+ }
10709
+
10710
+ .dot-button {
10711
+ margin-top: ${theme.spacing(4)};
10712
+ }
10713
+ }
10714
+ `}
10715
+ `;
10716
+
10717
+ const rootClassName$w = 'dot-illustration';
10718
+ const StyledIllustration = styled.span`
10719
+ &.${rootClassName$w} {
10720
+ display: inline-block;
10721
+ }
10722
+ `;
10723
+
10724
+ const DotIllustration = ({
10725
+ alt,
10726
+ ariaLabel,
10727
+ ariaRole = 'img',
10728
+ className,
10729
+ 'data-testid': dataTestId,
10730
+ illustrationId,
10731
+ theme = 'light',
10732
+ title,
10733
+ tooltip,
10734
+ tooltipPlacement = 'right-end'
8333
10735
  }) => {
8334
- const rootClasses = useStylesWithRootClass(rootClassName$z, className);
10736
+ const rootClasses = useStylesWithRootClass(rootClassName$w, className);
10737
+ return jsx(DotTooltip, {
10738
+ title: tooltip,
10739
+ placement: tooltipPlacement,
10740
+ "data-testid": `${dataTestId || rootClassName$w}-tooltip`,
10741
+ children: jsx(StyledIllustration, {
10742
+ "aria-hidden": "false",
10743
+ "aria-label": ariaLabel || title || 'Illustration',
10744
+ className: rootClasses,
10745
+ "data-testid": dataTestId || rootClassName$w,
10746
+ role: ariaRole,
10747
+ children: jsx("img", {
10748
+ alt: alt || 'Illustration',
10749
+ "aria-label": ariaLabel || title || 'Illustration',
10750
+ className: `illustration-${illustrationId}-${theme} dot-img`,
10751
+ "data-testid": dataTestId && `${dataTestId}-img`,
10752
+ role: ariaRole,
10753
+ title: title || 'Illustration'
10754
+ })
10755
+ })
10756
+ });
10757
+ };
10758
+
10759
+ const DotEmptyState = ({
10760
+ ariaLabel,
10761
+ buttonProps,
10762
+ className,
10763
+ 'data-testid': dataTestId,
10764
+ illustrationId,
10765
+ imageAltText,
10766
+ imageSrc,
10767
+ subtitle,
10768
+ title
10769
+ }) => {
10770
+ const rootClasses = useStylesWithRootClass(rootClassName$x, className);
8335
10771
  return jsxs(StyledEmptyState, {
8336
10772
  "aria-label": ariaLabel,
8337
10773
  className: rootClasses,
@@ -8419,13 +10855,13 @@ const StyledRadioGroup = styled(RadioGroup)`
8419
10855
  `}
8420
10856
  `;
8421
10857
 
8422
- const rootClassName$x = 'dot-date-picker';
10858
+ const rootClassName$v = 'dot-date-picker';
8423
10859
  const popperClassName = 'dot-date-picker-popper';
8424
10860
  const containerClassName$2 = 'dot-date-picker-container';
8425
10861
  const rectanglePickersDayClassName = 'dot-rectangle-pickers-day';
8426
10862
  const StyledDatePickerContainer = styled.div`
8427
10863
  ${() => css`
8428
- &.${rootClassName$x} .full-width {
10864
+ &.${rootClassName$v} .full-width {
8429
10865
  width: 100%;
8430
10866
  }
8431
10867
  `}
@@ -8434,7 +10870,7 @@ const StyledDatePicker = styled(DatePicker)`
8434
10870
  ${({
8435
10871
  theme
8436
10872
  }) => css`
8437
- &.${rootClassName$x} {
10873
+ &.${rootClassName$v} {
8438
10874
  ${pickerInputStyles(theme)};
8439
10875
 
8440
10876
  .Mui-disabled.MuiInputBase-root,
@@ -8474,7 +10910,7 @@ const StyledPickersDay = styled(PickersDay)`
8474
10910
  `}
8475
10911
  `;
8476
10912
 
8477
- const rootClassName$w = 'dot-time-picker';
10913
+ const rootClassName$u = 'dot-time-picker';
8478
10914
  const containerClassName$1 = 'dot-time-picker-container';
8479
10915
  const TIME_SELECTION_HEIGHT_SPACING = 34.5;
8480
10916
  const TIME_SELECTION_WIDTH_SPACING = 14.5;
@@ -8545,7 +10981,7 @@ const StyledTimePicker = styled(TimePicker)`
8545
10981
  ${({
8546
10982
  theme
8547
10983
  }) => css`
8548
- &.${rootClassName$w} {
10984
+ &.${rootClassName$u} {
8549
10985
  ${pickerInputStyles(theme)};
8550
10986
 
8551
10987
  .Mui-disabled.MuiInputBase-root,
@@ -8564,20 +11000,20 @@ const StyledTimePicker = styled(TimePicker)`
8564
11000
  `}
8565
11001
  `;
8566
11002
 
8567
- const rootClassName$v = 'dot-form';
11003
+ const rootClassName$t = 'dot-form';
8568
11004
  const StyledFormContainer = styled.div`
8569
11005
  ${({
8570
11006
  theme
8571
11007
  }) => css`
8572
- &.${rootClassName$v} {
11008
+ &.${rootClassName$t} {
8573
11009
  margin: ${theme.spacing(3, 0)};
8574
11010
 
8575
11011
  .${rootClassName$E},
8576
11012
  .${rootClassName$G},
8577
11013
  .${rootClassName$18},
8578
11014
  .${rootSelectClassName},
8579
- .${rootClassName$x},
8580
- .${rootClassName$w} {
11015
+ .${rootClassName$v},
11016
+ .${rootClassName$u} {
8581
11017
  margin: ${theme.spacing(1, 0)};
8582
11018
  }
8583
11019
 
@@ -8586,9 +11022,9 @@ const StyledFormContainer = styled.div`
8586
11022
  label
8587
11023
  + .${rootSelectClassName},
8588
11024
  label
8589
- + .${rootClassName$x},
11025
+ + .${rootClassName$v},
8590
11026
  label
8591
- + .${rootClassName$w} {
11027
+ + .${rootClassName$u} {
8592
11028
  margin: ${theme.spacing(0, 0, 1, 0)};
8593
11029
  }
8594
11030
 
@@ -8608,7 +11044,7 @@ const DotForm = ({
8608
11044
  'data-testid': dataTestId,
8609
11045
  onSubmit
8610
11046
  }) => {
8611
- const rootClasses = useStylesWithRootClass(rootClassName$v, className);
11047
+ const rootClasses = useStylesWithRootClass(rootClassName$t, className);
8612
11048
  return jsx("form", {
8613
11049
  "aria-label": ariaLabel,
8614
11050
  "data-testid": dataTestId,
@@ -8621,10 +11057,10 @@ const DotForm = ({
8621
11057
  });
8622
11058
  };
8623
11059
 
8624
- const rootClassName$u = 'dot-dynamic-form';
11060
+ const rootClassName$s = 'dot-dynamic-form';
8625
11061
  const StyledDynamicForm = styled(DotForm)`
8626
11062
  ${() => css`
8627
- &.${rootClassName$u} {
11063
+ &.${rootClassName$s} {
8628
11064
  }
8629
11065
  `}
8630
11066
  `;
@@ -8798,129 +11234,18 @@ const checkIfFormDataValid = formState => {
8798
11234
  const formData = formState.data;
8799
11235
  for (const formDataKey in formData) {
8800
11236
  const formValues = getOutputFormData(formState);
8801
- const isHidden = checkIfHiddenControl(formData[formDataKey].hidden, formValues);
8802
- if (!formData[formDataKey].isValid && !isHidden) return false;
8803
- }
8804
- return true;
8805
- };
8806
-
8807
- const DotInputSelect = ({
8808
- ariaLabel,
8809
- autoFocus,
8810
- className,
8811
- 'data-pendoid': dataPendoId = rootSelectClassName,
8812
- 'data-testid': dataTestId,
8813
- defaultValue,
8814
- disabled = false,
8815
- endIcon,
8816
- endText,
8817
- error = false,
8818
- fullWidth = true,
8819
- helperText,
8820
- id,
8821
- inputRef,
8822
- label,
8823
- name,
8824
- onBlur,
8825
- onChange,
8826
- onFocus,
8827
- onKeyDown,
8828
- options = [],
8829
- persistentLabel,
8830
- readOnly = false,
8831
- required,
8832
- shrink,
8833
- size = 'small',
8834
- startIcon,
8835
- success,
8836
- value,
8837
- warning = false
8838
- }) => {
8839
- const hasWarning = !error && warning && warningClassName;
8840
- const hasSuccess = !error && !warning && success && successClassName;
8841
- const endAdornment = endIcon || endText;
8842
- const inputStyles = useStylesWithRootClass('dot-select', readOnly && readOnlyClassName$1);
8843
- const rootStyles = useStylesWithRootClass(rootSelectClassName, hasSuccess, hasWarning);
8844
- const getOption = option => {
8845
- return typeof option === 'string' ? option : option.option;
8846
- };
8847
- const getValue = option => {
8848
- return typeof option === 'string' ? option : (option === null || option === void 0 ? void 0 : option.value) || option.option;
8849
- };
8850
- return jsxs("div", {
8851
- className: className,
8852
- children: [persistentLabel && jsx(DotInputLabel, {
8853
- disabled,
8854
- error,
8855
- id,
8856
- label,
8857
- required
8858
- }), jsx(StyledTextField, {
8859
- InputProps: {
8860
- startAdornment: startIcon && jsx(StyledAdornment, {
8861
- className: `${adornmentIconClassName} start`,
8862
- position: "start",
8863
- children: startIcon
8864
- }),
8865
- endAdornment: endAdornment && jsx(StyledAdornment, {
8866
- className: `${adornmentIconClassName} end`,
8867
- position: "end",
8868
- children: endAdornment
8869
- })
8870
- },
8871
- SelectProps: {
8872
- native: !readOnly,
8873
- readOnly,
8874
- open: readOnly ? false : undefined
8875
- },
8876
- "aria-label": ariaLabel || label,
8877
- autoFocus: autoFocus,
8878
- className: rootStyles,
8879
- defaultValue: defaultValue,
8880
- disabled: disabled,
8881
- error: error,
8882
- fullWidth: fullWidth,
8883
- helperText: helperText,
8884
- id: id,
8885
- InputLabelProps: {
8886
- shrink: shrink
8887
- },
8888
- inputProps: {
8889
- 'aria-label': ariaLabel,
8890
- 'data-pendoid': dataPendoId,
8891
- 'data-testid': dataTestId,
8892
- className: inputStyles,
8893
- readOnly
8894
- },
8895
- inputRef: inputRef,
8896
- label: persistentLabel ? null : label,
8897
- multiline: false,
8898
- name: name,
8899
- onBlur: onBlur,
8900
- onChange: onChange,
8901
- onFocus: onFocus,
8902
- onKeyDown: onKeyDown,
8903
- required: required,
8904
- role: "textbox",
8905
- select: true,
8906
- size: size,
8907
- value: value,
8908
- variant: "outlined",
8909
- children: options.map(option => jsx("option", {
8910
- className: "dot-option",
8911
- value: getValue(option),
8912
- children: getOption(option)
8913
- }, getValue(option)))
8914
- })]
8915
- });
11237
+ const isHidden = checkIfHiddenControl(formData[formDataKey].hidden, formValues);
11238
+ if (!formData[formDataKey].isValid && !isHidden) return false;
11239
+ }
11240
+ return true;
8916
11241
  };
8917
11242
 
8918
- const rootClassName$t = 'dot-progress-button';
11243
+ const rootClassName$r = 'dot-progress-button';
8919
11244
  const StyledProgressButton = styled(DotButton)`
8920
11245
  ${({
8921
11246
  theme
8922
11247
  }) => css`
8923
- &.${rootClassName$t} {
11248
+ &.${rootClassName$r} {
8924
11249
  .hidden {
8925
11250
  // hide children but preserve its space so that
8926
11251
  // button's dimensions don't change
@@ -8945,7 +11270,7 @@ const DotProgressButton = ({
8945
11270
  ariaLabel,
8946
11271
  children,
8947
11272
  className,
8948
- 'data-pendoid': dataPendoId = rootClassName$t,
11273
+ 'data-pendoid': dataPendoId = rootClassName$r,
8949
11274
  'data-testid': dataTestId,
8950
11275
  disabled = false,
8951
11276
  disableRipple = false,
@@ -8958,7 +11283,7 @@ const DotProgressButton = ({
8958
11283
  tooltip,
8959
11284
  type = 'primary'
8960
11285
  }) => {
8961
- const rootClasses = useStylesWithRootClass(rootClassName$t, className);
11286
+ const rootClasses = useStylesWithRootClass(rootClassName$r, className);
8962
11287
  const isButtonDisabled = disabled || isLoading;
8963
11288
  const titleClasses = useStylesWithRootClass(isLoading ? 'hidden' : '');
8964
11289
  const progressCircleSize = size === 'large' ? SPINNER_LARGE_SIZE : SPINNER_DEFAULT_SIZE;
@@ -8987,12 +11312,12 @@ const DotProgressButton = ({
8987
11312
  });
8988
11313
  };
8989
11314
 
8990
- const rootClassName$s = 'dot-radio';
11315
+ const rootClassName$q = 'dot-radio';
8991
11316
  const StyledRadioButton = styled(Radio)`
8992
11317
  ${({
8993
11318
  theme
8994
11319
  }) => css`
8995
- &.${rootClassName$s} {
11320
+ &.${rootClassName$q} {
8996
11321
  padding: 8px;
8997
11322
 
8998
11323
  svg {
@@ -9031,7 +11356,7 @@ function DotRadioButton({
9031
11356
  const radioControl = jsx(StyledRadioButton, {
9032
11357
  checked: checked,
9033
11358
  classes: {
9034
- root: rootClassName$s
11359
+ root: rootClassName$q
9035
11360
  },
9036
11361
  color: "primary",
9037
11362
  "data-pendoid": dataPendoId,
@@ -9142,7 +11467,7 @@ const DotRadioGroup = ({
9142
11467
  });
9143
11468
  };
9144
11469
 
9145
- const rootClassName$r = 'dot-switch';
11470
+ const rootClassName$p = 'dot-switch';
9146
11471
  const StyledSwitch = styled(Switch)`
9147
11472
  ${({
9148
11473
  theme
@@ -9171,7 +11496,7 @@ const DotSwitch = ({
9171
11496
  checked,
9172
11497
  className,
9173
11498
  color,
9174
- 'data-pendoid': dataPendoId = rootClassName$r,
11499
+ 'data-pendoid': dataPendoId = rootClassName$p,
9175
11500
  'data-testid': dataTestId,
9176
11501
  disabled = false,
9177
11502
  id,
@@ -9181,7 +11506,7 @@ const DotSwitch = ({
9181
11506
  onChange,
9182
11507
  size = 'medium'
9183
11508
  }) => {
9184
- const rootClasses = useStylesWithRootClass(rootClassName$r, className);
11509
+ const rootClasses = useStylesWithRootClass(rootClassName$p, className);
9185
11510
  const handleChange = event => {
9186
11511
  onChange && onChange(event);
9187
11512
  };
@@ -9532,7 +11857,7 @@ const DotDynamicForm = ({
9532
11857
  onChange,
9533
11858
  onSubmit
9534
11859
  }) => {
9535
- const rootClasses = useStylesWithRootClass(rootClassName$u, className);
11860
+ const rootClasses = useStylesWithRootClass(rootClassName$s, className);
9536
11861
  // Memoize this operation so that is doesn't get executed each time this
9537
11862
  // component re-renders
9538
11863
  const initialFormState = useMemo(() => getInitialFormState(config, liveValidation), [config, liveValidation, getInitialFormState]);
@@ -9778,7 +12103,7 @@ const DotDynamicForm = ({
9778
12103
  });
9779
12104
  };
9780
12105
 
9781
- const rootClassName$q = 'dot-inline-edit';
12106
+ const rootClassName$o = 'dot-inline-edit';
9782
12107
  const editModeClassName = 'dot-edit-mode';
9783
12108
  const viewModeClassName = 'dot-view-mode';
9784
12109
  const placeholderClassName = 'dot-placeholder';
@@ -9790,7 +12115,7 @@ const StyledInlineEdit = styled.div`
9790
12115
  theme,
9791
12116
  fullWidth
9792
12117
  }) => css`
9793
- &.${rootClassName$q} {
12118
+ &.${rootClassName$o} {
9794
12119
  align-items: center;
9795
12120
  color: ${theme.palette.figma.typography.black};
9796
12121
  display: ${fullWidth ? 'flex' : 'inline-flex'};
@@ -10002,7 +12327,7 @@ const DotInlineEdit = ({
10002
12327
  bindings,
10003
12328
  charactersLimit,
10004
12329
  className,
10005
- 'data-pendoid': dataPendoId = rootClassName$q,
12330
+ 'data-pendoid': dataPendoId = rootClassName$o,
10006
12331
  'data-testid': dataTestId,
10007
12332
  fullWidth = true,
10008
12333
  hideActionButtons,
@@ -10035,7 +12360,7 @@ const DotInlineEdit = ({
10035
12360
  }
10036
12361
  }, [value]);
10037
12362
  const isSaveDisabled = checkIfEmptyValue(inputValue);
10038
- const rootClasses = useStylesWithRootClass(rootClassName$q, className, editing ? editModeClassName : '');
12363
+ const rootClasses = useStylesWithRootClass(rootClassName$o, className, editing ? editModeClassName : '');
10039
12364
  const handleShowTooltip = visible => {
10040
12365
  if (!editing) {
10041
12366
  setShowTooltip(visible);
@@ -10214,13 +12539,13 @@ const DotInlineEdit = ({
10214
12539
  });
10215
12540
  };
10216
12541
 
10217
- const rootClassName$p = 'dot-navigation-rail';
12542
+ const rootClassName$n = 'dot-navigation-rail';
10218
12543
  const StyledNavigationRail = styled.div`
10219
12544
  ${({
10220
12545
  theme,
10221
12546
  railItemPosition
10222
12547
  }) => css`
10223
- &.${rootClassName$p} {
12548
+ &.${rootClassName$n} {
10224
12549
  background: ${theme.palette.figma.neutral.elevated};
10225
12550
  border-left: 1px solid ${theme.palette.figma.border.default};
10226
12551
  display: flex;
@@ -10267,7 +12592,7 @@ const DotNavigationRail = ({
10267
12592
  railItems,
10268
12593
  selectedIndex = 0
10269
12594
  }) => {
10270
- const rootClasses = useStylesWithRootClass(rootClassName$p, className);
12595
+ const rootClasses = useStylesWithRootClass(rootClassName$n, className);
10271
12596
  const [selectedItemIndex, setSelectedItemIndex] = useState(selectedIndex);
10272
12597
  /* Used to change selected index programmatically from the consumer component */
10273
12598
  useEffect(() => {
@@ -10318,12 +12643,12 @@ const DotNavigationRail = ({
10318
12643
  });
10319
12644
  };
10320
12645
 
10321
- const rootClassName$o = 'dot-pill';
12646
+ const rootClassName$m = 'dot-pill';
10322
12647
  const StyledPill = styled(Chip)`
10323
12648
  ${({
10324
12649
  theme
10325
12650
  }) => css`
10326
- &.${rootClassName$o} {
12651
+ &.${rootClassName$m} {
10327
12652
  background-color: ${({
10328
12653
  backgroundcolor,
10329
12654
  variant
@@ -10446,7 +12771,7 @@ const DotPill = ({
10446
12771
  status = 'default',
10447
12772
  variant = 'filled'
10448
12773
  }) => {
10449
- const rootClasses = useStylesWithRootClass(rootClassName$o, className, status);
12774
+ const rootClasses = useStylesWithRootClass(rootClassName$m, className, status);
10450
12775
  return jsx(StyledPill, {
10451
12776
  "aria-label": ariaLabel,
10452
12777
  bordercolor: bordercolor,
@@ -10464,12 +12789,12 @@ const DotPill = ({
10464
12789
  });
10465
12790
  };
10466
12791
 
10467
- const rootClassName$n = 'dot-skeleton';
12792
+ const rootClassName$l = 'dot-skeleton';
10468
12793
  const StyledSkeleton = styled(Skeleton)`
10469
12794
  ${({
10470
12795
  theme
10471
12796
  }) => css`
10472
- &.${rootClassName$n} {
12797
+ &.${rootClassName$l} {
10473
12798
  background-color: ${theme.palette.figma.border.darker};
10474
12799
  }
10475
12800
  `}
@@ -10484,7 +12809,7 @@ const DotSkeleton = ({
10484
12809
  width,
10485
12810
  variant
10486
12811
  }) => {
10487
- const rootClasses = useStylesWithRootClass(rootClassName$n, className);
12812
+ const rootClasses = useStylesWithRootClass(rootClassName$l, className);
10488
12813
  return jsx(StyledSkeleton, {
10489
12814
  animation: "wave",
10490
12815
  "aria-label": ariaLabel,
@@ -10499,246 +12824,6 @@ const DotSkeleton = ({
10499
12824
  });
10500
12825
  };
10501
12826
 
10502
- function addAutoHideDuration(severity) {
10503
- return severity === 'error' ? null : 10000;
10504
- }
10505
-
10506
- const getSnackbarTitleFromSeverity = severity => {
10507
- switch (severity) {
10508
- case 'success':
10509
- return 'Success';
10510
- case 'warning':
10511
- return 'Warning';
10512
- case 'error':
10513
- return 'Error';
10514
- case 'info':
10515
- return 'Info';
10516
- default:
10517
- return 'Success';
10518
- }
10519
- };
10520
-
10521
- const rootClassName$m = 'dot-snackbar';
10522
- const StyledSnackbar = styled(Snackbar)`
10523
- ${({
10524
- theme,
10525
- width,
10526
- $anchorOriginTop
10527
- }) => css`
10528
- &.${rootClassName$m} {
10529
- .MuiAlert-message {
10530
- word-break: break-word;
10531
- }
10532
- .${rootClassName$16} {
10533
- align-items: flex-start;
10534
- }
10535
- &.MuiSnackbar-anchorOriginTopLeft,
10536
- &.MuiSnackbar-anchorOriginTopCenter,
10537
- &.MuiSnackbar-anchorOriginTopRight {
10538
- top: ${$anchorOriginTop}px;
10539
- z-index: ${levelFourth};
10540
- }
10541
-
10542
- .dot-snackbar-actions {
10543
- display: flex;
10544
- align-items: center;
10545
- margin-top: ${theme.spacing(1)};
10546
- gap: ${theme.spacing(2)};
10547
-
10548
- .primary-action-btn {
10549
- background-color: transparent;
10550
- }
10551
- }
10552
-
10553
- .MuiAlert-root {
10554
- max-width: ${width ? 'unset' : '500px'};
10555
- min-width: ${width ? 'unset' : '344px'};
10556
- z-index: ${levelFourth};
10557
- }
10558
- }
10559
- `}
10560
- `;
10561
-
10562
- const DEFAULT_ANCHOR_ORIGIN = {
10563
- vertical: 'top',
10564
- horizontal: 'right'
10565
- };
10566
- const DotSnackbar = ({
10567
- anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
10568
- anchorOriginTop = 108,
10569
- ariaLabel,
10570
- autoHideDuration,
10571
- children,
10572
- className,
10573
- 'data-testid': dataTestId,
10574
- hideOnClickAway = true,
10575
- onClose,
10576
- open,
10577
- primaryAction,
10578
- secondaryAction,
10579
- severity,
10580
- width
10581
- }) => {
10582
- const hasActions = !!(primaryAction || secondaryAction);
10583
- const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
10584
- const rootClasses = useStylesWithRootClass(rootClassName$m, className);
10585
- const handleSnackbarClose = reason => {
10586
- if (!reason || hideOnClickAway || !hideOnClickAway && reason !== 'clickaway') {
10587
- onClose();
10588
- }
10589
- };
10590
- return jsx(StyledSnackbar, {
10591
- anchorOrigin: anchorOrigin,
10592
- "$anchorOriginTop": anchorOriginTop,
10593
- "aria-label": ariaLabel,
10594
- autoHideDuration: calculatedAutoHideDuration,
10595
- classes: {
10596
- root: rootClasses
10597
- },
10598
- "data-testid": dataTestId,
10599
- onClose: (_e, r) => handleSnackbarClose(r),
10600
- open: open,
10601
- severity: severity,
10602
- width: width,
10603
- children: jsx("div", {
10604
- children: jsx(DotAlertBanner, {
10605
- severity: severity,
10606
- width: width,
10607
- onClose: _e => handleSnackbarClose(),
10608
- children: jsxs("div", {
10609
- children: [jsx(DotTypography, {
10610
- variant: "subtitle2",
10611
- noMarginBottom: false,
10612
- children: getSnackbarTitleFromSeverity(severity)
10613
- }), isString$1(children) ? jsx(DotTypography, {
10614
- ariaLabel: severity,
10615
- variant: "body1",
10616
- children: children
10617
- }) : jsx("span", {
10618
- "aria-label": severity,
10619
- children: children
10620
- }), hasActions && jsxs("div", {
10621
- className: "dot-snackbar-actions",
10622
- children: [primaryAction && jsx(DotButton, {
10623
- className: "primary-action-btn",
10624
- "data-testid": "primary-action-btn",
10625
- onClick: primaryAction.onClick,
10626
- size: "small",
10627
- type: "outlined",
10628
- children: primaryAction.label
10629
- }), secondaryAction && jsx(DotLink, {
10630
- "data-testid": "secondary-action-link",
10631
- href: secondaryAction.href,
10632
- color: "inherit",
10633
- children: secondaryAction.label
10634
- })]
10635
- })]
10636
- })
10637
- })
10638
- })
10639
- });
10640
- };
10641
-
10642
- const rootClassName$l = 'dot-snackbar-container';
10643
- const StyledSnackbarContainer = styled.div`
10644
- ${() => css`
10645
- &.${rootClassName$l} {
10646
- position: absolute;
10647
- top: 0;
10648
- width: 250px;
10649
- height: auto;
10650
- right: 0;
10651
- & > div {
10652
- position: relative;
10653
- }
10654
- }
10655
- `}
10656
- `;
10657
-
10658
- const DotSnackbarContext = createContext({
10659
- alerts: [],
10660
- enqueueMessage: (_message, _severity, _autoHideDuration, _primaryAction, _secondaryAction) => null,
10661
- removeMessage: _id => null
10662
- });
10663
- const DotSnackbarContainer = ({
10664
- hideOnClickAway
10665
- }) => {
10666
- const {
10667
- alerts,
10668
- removeMessage
10669
- } = useDotSnackbarContext();
10670
- function handleClose(id) {
10671
- return () => {
10672
- removeMessage(id);
10673
- };
10674
- }
10675
- return jsx(StyledSnackbarContainer, {
10676
- className: rootClassName$l,
10677
- children: jsx("div", {
10678
- className: rootClassName$l,
10679
- "data-testid": rootClassName$l,
10680
- children: alerts.slice().reverse().map(alert => {
10681
- return jsx(DotSnackbar, {
10682
- autoHideDuration: alert.autoHideDuration,
10683
- hideOnClickAway: hideOnClickAway,
10684
- onClose: handleClose(alert.id),
10685
- open: alert.open,
10686
- severity: alert.severity,
10687
- primaryAction: alert.primaryAction,
10688
- secondaryAction: alert.secondaryAction,
10689
- children: alert.message
10690
- }, alert.id);
10691
- })
10692
- })
10693
- });
10694
- };
10695
- const DotSnackbarProvider = ({
10696
- children,
10697
- hideOnClickAway = true
10698
- }) => {
10699
- const [alerts, setAlerts] = useState([]);
10700
- function enqueueMessage(message, severity, autoHideDuration, primaryAction, secondaryAction) {
10701
- const id = CreateUUID();
10702
- const queue = {
10703
- id,
10704
- message,
10705
- severity,
10706
- open: true,
10707
- autoHideDuration,
10708
- primaryAction,
10709
- secondaryAction
10710
- };
10711
- setAlerts(prevState => {
10712
- return [...prevState, Object.assign({}, queue)];
10713
- });
10714
- return id;
10715
- }
10716
- const removeMessage = id => {
10717
- setAlerts(prev => {
10718
- return prev.map(a => {
10719
- return a.id === id ? Object.assign(Object.assign({}, a), {
10720
- open: false
10721
- }) : a;
10722
- });
10723
- });
10724
- };
10725
- const DotSnackbarValues = {
10726
- alerts,
10727
- enqueueMessage,
10728
- removeMessage
10729
- };
10730
- const memoizedValues = useMemo(() => DotSnackbarValues, [alerts]);
10731
- return jsxs(DotSnackbarContext.Provider, {
10732
- value: memoizedValues,
10733
- children: [jsx(DotSnackbarContainer, {
10734
- hideOnClickAway: hideOnClickAway
10735
- }), children]
10736
- });
10737
- };
10738
- const useDotSnackbarContext = () => {
10739
- return useContext(DotSnackbarContext);
10740
- };
10741
-
10742
12827
  const rootClassName$k = 'dot-split-button-group';
10743
12828
  const StyledSplitButtonGroup = styled(ButtonGroup)`
10744
12829
  ${({
@@ -11331,13 +13416,13 @@ const DotStepper = ({
11331
13416
  return [step.className, isActive ? 'active' : 'inactive', step.completed ? 'completed' : '', step.disabled ? 'disabled' : '', step.error ? 'error' : '', step.inProgress ? 'in-progress' : ''].concat().join(' ').trim();
11332
13417
  };
11333
13418
  const getContent = () => {
11334
- return isString$1(step.description) ? jsx(StepDescription, {
13419
+ return isString$2(step.description) ? jsx(StepDescription, {
11335
13420
  variant: "body2",
11336
13421
  children: step.description
11337
13422
  }) : step.description;
11338
13423
  };
11339
13424
  const getHorizontalDescription = () => {
11340
- return isString$1(step.description) ? jsx(DotTypography, {
13425
+ return isString$2(step.description) ? jsx(DotTypography, {
11341
13426
  variant: "body2",
11342
13427
  className: "horizontal-step-description",
11343
13428
  children: step.description
@@ -11725,7 +13810,7 @@ const StyledTableBody = styled(TableBody)`
11725
13810
  const getFormattedTableCellValue = (
11726
13811
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11727
13812
  value, typographyVariant) => {
11728
- if (isString$1(value) || isNumber(value)) {
13813
+ if (isString$2(value) || isNumber(value)) {
11729
13814
  return jsx(DotTypography, {
11730
13815
  className: "dot-cell-typography",
11731
13816
  variant: typographyVariant,
@@ -12156,7 +14241,7 @@ const DotHeaderCell = ({
12156
14241
  value,
12157
14242
  width
12158
14243
  }) => {
12159
- const headerTitle = isString$1(value) ? value : null;
14244
+ const headerTitle = isString$2(value) ? value : null;
12160
14245
  const formattedValue = getFormattedTableCellValue(value, typography);
12161
14246
  const getCellValue = () => {
12162
14247
  if (sortable) {
@@ -13888,7 +15973,7 @@ const DotDatePicker = ({
13888
15973
  autoFocus = false,
13889
15974
  className,
13890
15975
  closeOnSelect = true,
13891
- 'data-pendoid': dataPendoId = rootClassName$x,
15976
+ 'data-pendoid': dataPendoId = rootClassName$v,
13892
15977
  'data-testid': dataTestId,
13893
15978
  defaultValue,
13894
15979
  disableOpenPicker,
@@ -13928,7 +16013,7 @@ const DotDatePicker = ({
13928
16013
  const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
13929
16014
  const isInputReadOnly = readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
13930
16015
  const inputRef = useRef(null);
13931
- const rootClasses = useStylesWithRootClass(rootClassName$x, className, isInputReadOnly ? 'read-only' : '');
16016
+ const rootClasses = useStylesWithRootClass(rootClassName$v, className, isInputReadOnly ? 'read-only' : '');
13932
16017
  const containerClasses = useStylesWithRootClass(containerClassName$2, fullWidth ? 'full-width' : '', className);
13933
16018
  const focusInput = ref => {
13934
16019
  setTimeout(() => {
@@ -14147,7 +16232,7 @@ const DotTimePicker = ({
14147
16232
  ariaLabel,
14148
16233
  autoFocus = false,
14149
16234
  className,
14150
- 'data-pendoid': dataPendoId = rootClassName$w,
16235
+ 'data-pendoid': dataPendoId = rootClassName$u,
14151
16236
  'data-testid': dataTestId,
14152
16237
  defaultValue,
14153
16238
  disableOpenPicker = false,
@@ -14179,7 +16264,7 @@ const DotTimePicker = ({
14179
16264
  const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
14180
16265
  const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
14181
16266
  const isComponentReadOnly = readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
14182
- const rootClasses = useStylesWithRootClass(rootClassName$w, className, isComponentReadOnly ? 'read-only' : '');
16267
+ const rootClasses = useStylesWithRootClass(rootClassName$u, className, isComponentReadOnly ? 'read-only' : '');
14183
16268
  const containerClasses = useStylesWithRootClass(containerClassName$1, fullWidth ? 'full-width' : '', className);
14184
16269
  const inputRef = useRef(null);
14185
16270
  const [isPickerOpened, setIsPickerOpened] = useState(false);
@@ -14783,4 +16868,4 @@ const DotStickyWithBorder = ({
14783
16868
  });
14784
16869
  };
14785
16870
 
14786
- 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 };
16871
+ 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 };