@devtron-labs/devtron-fe-common-lib 1.10.16-beta-2 → 1.10.17

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 (54) hide show
  1. package/dist/{@code-editor-BPAbtV3J.js → @code-editor-BvjrvTRt.js} +4937 -4999
  2. package/dist/{@common-rjsf-BpO7Uh9_.js → @common-rjsf-DM5WzH7I.js} +1 -1
  3. package/dist/Common/Constants.d.ts +1 -0
  4. package/dist/Common/SegmentedControl/types.d.ts +0 -4
  5. package/dist/Common/Toggle/Toggle.d.ts +1 -2
  6. package/dist/Common/Types.d.ts +0 -1
  7. package/dist/Shared/Components/ConfirmationModal/index.d.ts +1 -2
  8. package/dist/Shared/Components/DatePicker/constants.d.ts +0 -9
  9. package/dist/Shared/Components/Icon/Icon.d.ts +0 -14
  10. package/dist/Shared/Components/Icon/types.d.ts +1 -1
  11. package/dist/Shared/Components/ReactSelect/constants.d.ts +11 -0
  12. package/dist/Shared/Components/SelectPicker/common.d.ts +1 -0
  13. package/dist/Shared/Components/TabGroup/TabGroup.helpers.d.ts +2 -2
  14. package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +3 -5
  15. package/dist/Shared/Components/TabGroup/TabGroup.utils.d.ts +0 -2
  16. package/dist/Shared/Components/index.d.ts +0 -1
  17. package/dist/Shared/Hooks/index.d.ts +1 -1
  18. package/dist/Shared/Hooks/useForm/useForm.d.ts +0 -8
  19. package/dist/Shared/Hooks/useUserPreferences/index.d.ts +4 -0
  20. package/dist/Shared/Hooks/useUserPreferences/service.d.ts +8 -0
  21. package/dist/Shared/Hooks/useUserPreferences/types.d.ts +80 -0
  22. package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +10 -0
  23. package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +4 -0
  24. package/dist/Shared/Services/common.service.d.ts +1 -3
  25. package/dist/Shared/Services/types.d.ts +5 -30
  26. package/dist/Shared/constants.d.ts +12 -0
  27. package/dist/Shared/types.d.ts +4 -17
  28. package/dist/assets/@code-editor.css +1 -1
  29. package/dist/assets/ic-hibernate.988d2323.svg +28 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +500 -499
  32. package/package.json +1 -1
  33. package/dist/Shared/Components/FramerComponents/MotionDiv.d.ts +0 -2
  34. package/dist/Shared/Components/FramerComponents/index.d.ts +0 -3
  35. package/dist/Shared/Hooks/useOneTimePrompt/constants.d.ts +0 -1
  36. package/dist/Shared/Hooks/useOneTimePrompt/index.d.ts +0 -1
  37. package/dist/Shared/Hooks/useOneTimePrompt/types.d.ts +0 -3
  38. package/dist/Shared/Hooks/useOneTimePrompt/useOneTimePrompt.d.ts +0 -6
  39. package/dist/assets/ic-arrows-left-right.2d4dda45.svg +0 -3
  40. package/dist/assets/ic-check.a0f5ee85.svg +0 -3
  41. package/dist/assets/ic-close-large.fb6095e0.svg +0 -3
  42. package/dist/assets/ic-delete-lightning.2a7545bd.svg +0 -3
  43. package/dist/assets/ic-folder-user.ff0670e8.svg +0 -3
  44. package/dist/assets/ic-hibernate.f75c1e70.svg +0 -19
  45. package/dist/assets/ic-lightning-fill.25ce980f.svg +0 -3
  46. package/dist/assets/ic-lightning.02da5bf8.svg +0 -3
  47. package/dist/assets/ic-medium-delete.f33a9cd7.svg +0 -11
  48. package/dist/assets/ic-pencil.3ea1c075.svg +0 -3
  49. package/dist/assets/ic-sort-ascending.45f474ff.svg +0 -3
  50. package/dist/assets/ic-sort-descending.0ee6b8dd.svg +0 -3
  51. package/dist/assets/ic-sortable.1d3308e1.svg +0 -3
  52. package/dist/assets/ic-stamp.23836e37.svg +0 -3
  53. package/dist/assets/ic-users.102d4732.svg +0 -3
  54. /package/dist/Shared/{Services → Hooks/useUserPreferences}/constants.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { j as n, au as y, aw as k, av as W } from "./@vendor-DZHtXPTX.js";
2
2
  import V, { forwardRef as J, useMemo as P } from "react";
3
3
  import K, { getDefaultRegistry as q } from "@rjsf/core";
4
- import { T as F, j as N, c as v, b as S, a as Y, i as z, d as w, e as E, S as G } from "./@code-editor-BPAbtV3J.js";
4
+ import { T as F, j as N, c as v, b as S, a as Y, i as z, d as w, e as E, S as G } from "./@code-editor-BvjrvTRt.js";
5
5
  import Q, { components as D } from "react-select";
6
6
  import { ReactComponent as X } from "./assets/ic-chevron-down.fc70d7a7.svg";
7
7
  import { getUiOptions as B, getTemplate as $, getSubmitButtonOptions as Z, ADDITIONAL_PROPERTY_FLAG as L, errorId as ee, englishStringTranslator as te, TranslatableString as ne, titleId as re, canExpand as se, deepEquals as ae } from "@rjsf/utils";
@@ -90,6 +90,7 @@ export declare const ROUTES: {
90
90
  readonly ATTRIBUTES_USER: "attributes/user";
91
91
  readonly GET: "get";
92
92
  readonly UPDATE: "update";
93
+ readonly PATCH: "patch";
93
94
  readonly ENVIRONMENT_LIST_MIN: "env/autocomplete";
94
95
  readonly CLUSTER: "cluster";
95
96
  readonly API_RESOURCE: "k8s/api-resources";
@@ -8,10 +8,6 @@ export type SegmentType = Pick<SelectPickerOptionType, 'value'> & {
8
8
  * If true, the segment will be in error state with error icon
9
9
  */
10
10
  isError?: boolean;
11
- /**
12
- * If true, the segment will be in disabled state
13
- */
14
- isDisabled?: boolean;
15
11
  } & (({
16
12
  /**
17
13
  * Label for the segment
@@ -1,4 +1,4 @@
1
- declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, Icon, iconClass, throttleOnChange, shouldToggleValueOnLabelClick, isLoading, ...props }: {
1
+ declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, Icon, iconClass, throttleOnChange, shouldToggleValueOnLabelClick, ...props }: {
2
2
  [x: string]: any;
3
3
  selected?: boolean;
4
4
  onSelect?: any;
@@ -10,6 +10,5 @@ declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dat
10
10
  iconClass?: string;
11
11
  throttleOnChange?: boolean;
12
12
  shouldToggleValueOnLabelClick?: boolean;
13
- isLoading?: boolean;
14
13
  }) => JSX.Element;
15
14
  export default Toggle;
@@ -349,7 +349,6 @@ export interface ApprovalConfigDataType extends Pick<UserApprovalInfo, 'currentC
349
349
  groupName: UserGroupDTO['name'];
350
350
  })[];
351
351
  };
352
- isExceptionUser: boolean;
353
352
  }
354
353
  export declare enum ApprovalRuntimeStateType {
355
354
  init = 0,
@@ -2,6 +2,5 @@ export { default as ConfirmationModal, BaseConfirmationModal } from './Confirmat
2
2
  export { DeleteConfirmationModal } from './DeleteConfirmationModal';
3
3
  export { ForceDeleteConfirmationModal } from './ForceDeleteConfirmationModal';
4
4
  export { CannotDeleteModal } from './CannotDeleteModal';
5
- export { ConfirmationModalVariantType, type ConfirmationModalProps } from './types';
5
+ export { ConfirmationModalVariantType, type ConfirmationModalProps, type DeleteConfirmationModalProps } from './types';
6
6
  export { ConfirmationModalProvider } from './ConfirmationModalContext';
7
- export { getConfirmationLabel } from './utils';
@@ -132,12 +132,3 @@ export declare const DATE_PICKER_IDS: {
132
132
  MONTH: string;
133
133
  TIME: string;
134
134
  };
135
- export declare const reactSelectStyles: {
136
- container: (base: any) => any;
137
- control: (base: any, state: any) => any;
138
- valueContainer: (base: any) => any;
139
- input: (base: any) => any;
140
- dropdownIndicator: (base: any, state: any) => any;
141
- option: (base: any) => any;
142
- menuList: (base: any) => any;
143
- };
@@ -6,7 +6,6 @@ export declare const iconMap: {
6
6
  'ic-apica': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
7
7
  'ic-app-group': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
8
8
  'ic-arrow-right': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
9
- 'ic-arrows-left-right': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
10
9
  'ic-ather': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
11
10
  'ic-azure': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
12
11
  'ic-bharatpe': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -20,12 +19,10 @@ export declare const iconMap: {
20
19
  'ic-caret-left': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
21
20
  'ic-cd': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
22
21
  'ic-chat-circle-dots': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
23
- 'ic-check': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
24
22
  'ic-ci-linked': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
25
23
  'ic-ci-webhook': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
26
24
  'ic-circle-loader': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
27
25
  'ic-clock': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
28
- 'ic-close-large': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
29
26
  'ic-close-small': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
30
27
  'ic-code': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
31
28
  'ic-container': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -33,7 +30,6 @@ export declare const iconMap: {
33
30
  'ic-copy': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
34
31
  'ic-crown': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
35
32
  'ic-cube': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
36
- 'ic-delete-lightning': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
37
33
  'ic-delete': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
38
34
  'ic-delhivery': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
39
35
  'ic-devtron-header-logo': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -43,7 +39,6 @@ export declare const iconMap: {
43
39
  'ic-env': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
44
40
  'ic-error': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
45
41
  'ic-failure': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
46
- 'ic-folder-user': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
47
42
  'ic-gear': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
48
43
  'ic-git': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
49
44
  'ic-github': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -64,12 +59,9 @@ export declare const iconMap: {
64
59
  'ic-job-color': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
65
60
  'ic-k8s-job': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
66
61
  'ic-ldap': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
67
- 'ic-lightning-fill': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
68
- 'ic-lightning': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
69
62
  'ic-livspace': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
70
63
  'ic-login-devtron-logo': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
71
64
  'ic-logout': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
72
- 'ic-medium-delete': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
73
65
  'ic-medium-paintbucket': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
74
66
  'ic-microsoft': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
75
67
  'ic-missing': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -82,16 +74,11 @@ export declare const iconMap: {
82
74
  'ic-openshift': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
83
75
  'ic-out-of-sync': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
84
76
  'ic-paper-plane-color': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
85
- 'ic-pencil': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
86
77
  'ic-quay': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
87
78
  'ic-quote': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
88
79
  'ic-shield-check': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
89
- 'ic-sort-ascending': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
90
- 'ic-sort-descending': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
91
- 'ic-sortable': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
92
80
  'ic-spinny': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
93
81
  'ic-stack': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
94
- 'ic-stamp': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
95
82
  'ic-success': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
96
83
  'ic-suspended': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
97
84
  'ic-tata1mg': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -100,7 +87,6 @@ export declare const iconMap: {
100
87
  'ic-travclan': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
101
88
  'ic-unknown': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
102
89
  'ic-user-key': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
103
- 'ic-users': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
104
90
  'ic-warning': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
105
91
  };
106
92
  export type IconName = keyof typeof iconMap;
@@ -18,6 +18,6 @@ export interface IconBaseProps {
18
18
  * If `null`, the default color present in icon is used.
19
19
  * @example `'B500'`, `'N200'`, `'G50'`, `'R700'`
20
20
  */
21
- color: `${'B' | 'N' | 'G' | 'Y' | 'R' | 'V' | 'O'}${`${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00` | '50' | '0'}` | 'white' | 'black' | null;
21
+ color: `${'B' | 'N' | 'G' | 'Y' | 'R' | 'V' | 'O'}${`${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00` | '50'}` | 'white' | 'black' | null;
22
22
  }
23
23
  export {};
@@ -2,6 +2,17 @@ import { DropdownIndicatorProps, StylesConfig } from 'react-select';
2
2
  export declare const CommonGroupedDropdownStyles: StylesConfig;
3
3
  export declare const APP_SELECTOR_STYLES: StylesConfig;
4
4
  export declare const AppSelectorDropdownIndicator: (props: DropdownIndicatorProps) => JSX.Element;
5
+ /**
6
+ *
7
+ * @returns {string}
8
+ * @description Returns the no matching result text for the select component.
9
+ */
10
+ export declare const getNoMatchingResultText: () => string;
11
+ /**
12
+ * @param inputObj
13
+ * @returns {string}
14
+ * @description Returns the no options message for the select component.
15
+ */
5
16
  export declare const AppSelectorNoOptionsMessage: (inputObj: {
6
17
  inputValue: string;
7
18
  }) => string;
@@ -12,3 +12,4 @@ export declare const SelectPickerMenuList: <OptionValue>(props: MenuListProps<Se
12
12
  export declare const SelectPickerMultiValueLabel: <OptionValue, IsMulti extends boolean>({ getIsOptionValid, ...props }: MultiValueProps<SelectPickerOptionType<OptionValue>, true> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid">) => JSX.Element;
13
13
  export declare const SelectPickerMultiValueRemove: (props: MultiValueRemoveProps) => JSX.Element;
14
14
  export declare const SelectPickerGroupHeading: <OptionValue>({ isGroupHeadingSelectable, ...props }: SelectPickerGroupHeadingProps<OptionValue>) => JSX.Element;
15
+ export declare const renderLoadingMessage: () => JSX.Element;
@@ -1,5 +1,5 @@
1
- import { TabGroupProps, TabProps } from './TabGroup.types';
2
- export declare const getTabIcon: ({ icon, showError, showWarning, className, size, active, }: Pick<TabProps, "showError" | "showWarning" | "icon" | "active"> & Pick<TabGroupProps, "size"> & {
1
+ import { TabProps } from './TabGroup.types';
2
+ export declare const getTabIcon: ({ icon: Icon, showError, showWarning, className, }: Pick<TabProps, "showError" | "showWarning" | "icon"> & {
3
3
  className: string;
4
4
  }) => JSX.Element;
5
5
  export declare const getTabBadge: (badge: TabProps["badge"], className: string) => JSX.Element;
@@ -2,7 +2,6 @@ import { LinkProps, NavLinkProps } from 'react-router-dom';
2
2
  import { ComponentSizeType } from '../../constants';
3
3
  import { DataAttributes } from '../../types';
4
4
  import { TooltipProps } from '@Common/Tooltip/types';
5
- import { IconName } from '../Icon';
6
5
  type TabComponentProps<TabTypeProps> = TabTypeProps & DataAttributes;
7
6
  type ConditionalTabType = {
8
7
  /**
@@ -80,11 +79,10 @@ export type TabProps = {
80
79
  */
81
80
  description?: string | string[];
82
81
  /**
83
- * Icon to be displayed in the tab.
84
- * This can either be a functional component that renders a SVG
85
- * or a string representing the name of the icon to be rendered by the Icon component.
82
+ * Icon component to be displayed in the tab.
83
+ * This should be a functional component that renders an SVG.
86
84
  */
87
- icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>> | IconName;
85
+ icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
88
86
  /**
89
87
  * Badge number to be displayed on the tab, typically for notifications.
90
88
  */
@@ -1,9 +1,7 @@
1
- import { IconsProps } from '../Icon';
2
1
  import { TabGroupProps } from './TabGroup.types';
3
2
  export declare const getClassNameBySizeMap: ({ hideTopPadding, alignActiveBorderWithContainer, }: Pick<TabGroupProps, "hideTopPadding" | "alignActiveBorderWithContainer">) => Record<TabGroupProps["size"], {
4
3
  tabClassName: string;
5
4
  iconClassName: string;
6
5
  badgeClassName: string;
7
6
  }>;
8
- export declare const TAB_ICON_SIZE_MAP: Record<TabGroupProps['size'], IconsProps['size']>;
9
7
  export declare const tabGroupClassMap: Record<TabGroupProps['size'], string>;
@@ -77,5 +77,4 @@ export * from './FlagImage';
77
77
  export * from './DevtronLicenseCard';
78
78
  export * from './LoginBanner';
79
79
  export * from './Confetti';
80
- export * from './FramerComponents';
81
80
  export * from './ActionMenu';
@@ -3,4 +3,4 @@ export * from './useGetResourceKindsOptions';
3
3
  export * from './UseDownload';
4
4
  export * from './useForm';
5
5
  export * from './useStickyEvent';
6
- export * from './useOneTimePrompt';
6
+ export * from './useUserPreferences';
@@ -57,8 +57,6 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
57
57
  shouldDirty?: boolean;
58
58
  /** A boolean indicating whether to mark the field as touched after setting the value. */
59
59
  shouldTouch?: boolean;
60
- /** A boolean indicating whether to trigger validation after setting the value. */
61
- triggerError?: boolean;
62
60
  }) => void;
63
61
  reset: (formData: T, resetOptions?: {
64
62
  /** A boolean indicating whether to retain the current dirty state of the form fields. */
@@ -69,14 +67,8 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
69
67
  keepErrors?: boolean;
70
68
  /** A boolean indicating whether the form should check for dirty state upon reset. */
71
69
  triggerDirty?: boolean;
72
- /** A boolean indicating whether the form should check for errors upon reset. */
73
- triggerError?: boolean;
74
70
  /** A boolean indicating whether the initial values of the form should be retained after reset. If false, provided formData will become initial data. */
75
71
  keepInitialValues?: boolean;
76
- /** Partial initial values to override the current initial values upon reset.
77
- * @note `keepInitialValues` will have no effect when this is provided.
78
- */
79
- formInitialValues?: Partial<T>;
80
72
  }) => void;
81
73
  /** An object representing additional form state. */
82
74
  formState: {
@@ -0,0 +1,4 @@
1
+ export { useUserPreferences } from './useUserPrefrences';
2
+ export * from './constants';
3
+ export * from './types';
4
+ export { updateUserPreferences, getUserPreferences } from './service';
@@ -0,0 +1,8 @@
1
+ import { UserPreferencesType, UserPreferenceResourceProps } from './types';
2
+ /**
3
+ * @returns UserPreferencesType
4
+ * @description This function fetches the user preferences from the server. It uses the `get` method to make a request to the server and retrieves the user preferences based on the `USER_PREFERENCES_ATTRIBUTE_KEY`. The result is parsed and returned as a `UserPreferencesType` object.
5
+ * @throws Will throw an error if the request fails or if the result is not in the expected format.
6
+ */
7
+ export declare const getUserPreferences: () => Promise<UserPreferencesType>;
8
+ export declare const updateUserPreferences: ({ path, value, shouldThrowError, }: UserPreferenceResourceProps) => Promise<boolean>;
@@ -0,0 +1,80 @@
1
+ import { AppThemeType, BaseAppMetaData, ResourceKindType } from '../../index';
2
+ import { ThemeConfigType, ThemePreferenceType } from '@Shared/Providers/ThemeProvider/types';
3
+ import { USER_PREFERENCES_ATTRIBUTE_KEY } from '@Shared/Hooks/useUserPreferences/constants';
4
+ export interface GetUserPreferencesQueryParamsType {
5
+ key: typeof USER_PREFERENCES_ATTRIBUTE_KEY;
6
+ }
7
+ export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
8
+ ALL_ENVIRONMENTS = "All environments",
9
+ ACCESS_ONLY = "Access only"
10
+ }
11
+ export declare enum UserPreferenceResourceActions {
12
+ RECENTLY_VISITED = "recently-visited"
13
+ }
14
+ export interface UserResourceKindActionType {
15
+ [UserPreferenceResourceActions.RECENTLY_VISITED]: BaseAppMetaData[];
16
+ }
17
+ export interface UserPreferenceResourceType {
18
+ [ResourceKindType.devtronApplication]: UserResourceKindActionType;
19
+ }
20
+ export interface GetUserPreferencesParsedDTO {
21
+ viewPermittedEnvOnly?: boolean;
22
+ /**
23
+ * Computed app theme for the user
24
+ *
25
+ * Could be 'light' | 'dark' | 'system-light' | 'system-dark'
26
+ */
27
+ computedAppTheme?: AppThemeType | `system-${AppThemeType}`;
28
+ /**
29
+ * @description resources object with key as resource kind and value as ResourceType
30
+ *
31
+ */
32
+ resources?: UserPreferenceResourceType;
33
+ }
34
+ export interface UserPreferencesPayloadValueType extends GetUserPreferencesParsedDTO {
35
+ }
36
+ export interface UpdateUserPreferencesPayloadType extends Pick<GetUserPreferencesQueryParamsType, 'key'> {
37
+ value: string;
38
+ }
39
+ export interface UserPreferencesType {
40
+ /**
41
+ * Preferred theme for the user
42
+ * If null, would forcibly show user theme switcher dialog for user to select
43
+ */
44
+ themePreference?: ThemePreferenceType | null;
45
+ /**
46
+ * @type {ViewIsPipelineRBACConfiguredRadioTabs}
47
+ * @description pipelineRBACViewSelectedTab is used to store the selected tab in the pipeline RBAC view
48
+ * @default ViewIsPipelineRBACConfiguredRadioTabs.VIEW_PERMITTED_ENV
49
+ */
50
+ pipelineRBACViewSelectedTab?: ViewIsPipelineRBACConfiguredRadioTabs;
51
+ /**
52
+ * @description resources object
53
+ */
54
+ resources?: GetUserPreferencesParsedDTO['resources'];
55
+ }
56
+ export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {
57
+ }
58
+ export interface UseUserPreferencesProps {
59
+ migrateUserPreferences?: (userPreferencesResponse: UserPreferencesType) => Promise<UserPreferencesType>;
60
+ }
61
+ export type UserPathValueMapType = {
62
+ path: 'themePreference';
63
+ value: Required<Pick<UpdatedUserPreferencesType, 'themePreference' | 'appTheme'>>;
64
+ } | {
65
+ path: 'pipelineRBACViewSelectedTab';
66
+ value: Required<Pick<UserPreferencesType, 'pipelineRBACViewSelectedTab'>>;
67
+ } | {
68
+ path: 'resources';
69
+ value: Required<BaseAppMetaData[]>;
70
+ };
71
+ export type UserPreferenceResourceProps = UserPathValueMapType & {
72
+ shouldThrowError?: boolean;
73
+ };
74
+ export interface UserPreferenceRecentlyVisitedAppsTypes {
75
+ appId: number;
76
+ appName: string;
77
+ }
78
+ export interface UserPreferenceFilteredListTypes extends UserPreferenceRecentlyVisitedAppsTypes {
79
+ userPreferencesResponse: UserPreferencesType;
80
+ }
@@ -0,0 +1,10 @@
1
+ import { ServerErrors } from '../../../Common/ServerError';
2
+ import { UserPreferenceRecentlyVisitedAppsTypes, UserPreferencesType, UseUserPreferencesProps, ViewIsPipelineRBACConfiguredRadioTabs } from './types';
3
+ export declare const useUserPreferences: ({ migrateUserPreferences }: UseUserPreferencesProps) => {
4
+ userPreferences: UserPreferencesType;
5
+ userPreferencesError: ServerErrors;
6
+ handleFetchUserPreferences: () => Promise<void>;
7
+ handleUpdatePipelineRBACViewSelectedTab: (selectedTab: ViewIsPipelineRBACConfiguredRadioTabs) => void;
8
+ handleUpdateUserThemePreference: (themePreference: UserPreferencesType["themePreference"]) => void;
9
+ fetchRecentlyVisitedParsedApps: ({ appId, appName }: UserPreferenceRecentlyVisitedAppsTypes) => Promise<void>;
10
+ };
@@ -0,0 +1,4 @@
1
+ import { BaseAppMetaData } from '../../index';
2
+ import { UserPreferenceFilteredListTypes, UserPreferenceResourceType } from './types';
3
+ export declare const getUserPreferenceResourcesMetadata: (recentlyVisited: BaseAppMetaData[]) => UserPreferenceResourceType;
4
+ export declare const getFilteredUniqueAppList: ({ userPreferencesResponse, appId, appName, }: UserPreferenceFilteredListTypes) => BaseAppMetaData[];
@@ -1,8 +1,6 @@
1
1
  import { AppConfigProps } from '../../Pages/index';
2
- import { EnvironmentDataValuesDTO, GetPolicyApiUrlProps, GetResourceApiUrlProps, UpdatedUserPreferencesType, UserPreferencesType } from './types';
2
+ import { EnvironmentDataValuesDTO, GetPolicyApiUrlProps, GetResourceApiUrlProps } from './types';
3
3
  export declare const getResourceApiUrl: <T>({ baseUrl, kind, version, suffix, queryParams }: GetResourceApiUrlProps<T>) => string;
4
4
  export declare const getPolicyApiUrl: <T>({ kind, version, queryParams, suffix }: GetPolicyApiUrlProps<T>) => string;
5
5
  export declare const saveCDPipeline: (request: any, { isTemplateView }: Required<Pick<AppConfigProps, "isTemplateView">>) => Promise<import('../../Common').ResponseType<any>>;
6
6
  export declare const getEnvironmentData: () => Promise<import('../../Common').ResponseType<EnvironmentDataValuesDTO>>;
7
- export declare const getUserPreferences: () => Promise<UserPreferencesType>;
8
- export declare const updateUserPreferences: (updatedUserPreferences: UpdatedUserPreferencesType, shouldThrowError?: boolean) => Promise<boolean>;
@@ -1,8 +1,10 @@
1
1
  import { MainContext } from '../Providers';
2
- import { AppThemeType, ThemeConfigType, ThemePreferenceType } from '@Shared/Providers/ThemeProvider/types';
3
2
  import { getUrlWithSearchParams } from '../../Common';
4
- import { PolicyKindType, ResourceKindType, ResourceVersionType, ViewIsPipelineRBACConfiguredRadioTabs } from '../types';
5
- import { USER_PREFERENCES_ATTRIBUTE_KEY } from './constants';
3
+ import { PolicyKindType, ResourceKindType, ResourceVersionType } from '../types';
4
+ export interface BaseAppMetaData {
5
+ appId: number;
6
+ appName: string;
7
+ }
6
8
  export interface ClusterType {
7
9
  id: number;
8
10
  name: string;
@@ -37,31 +39,4 @@ export interface EnvironmentDataValuesDTO extends Pick<MainContext, 'featureGitO
37
39
  canOnlyViewPermittedEnvOrgLevel: boolean;
38
40
  devtronManagedLicensingEnabled: boolean;
39
41
  }
40
- export interface GetUserPreferencesQueryParamsType {
41
- key: typeof USER_PREFERENCES_ATTRIBUTE_KEY;
42
- }
43
- export interface GetUserPreferencesParsedDTO {
44
- viewPermittedEnvOnly?: boolean;
45
- /**
46
- * Computed app theme for the user
47
- *
48
- * Could be 'light' | 'dark' | 'system-light' | 'system-dark'
49
- */
50
- computedAppTheme: AppThemeType | `system-${AppThemeType}`;
51
- }
52
- export interface UserPreferencesPayloadValueType extends GetUserPreferencesParsedDTO {
53
- }
54
- export interface UpdateUserPreferencesPayloadType extends Pick<GetUserPreferencesQueryParamsType, 'key'> {
55
- value: string;
56
- }
57
- export interface UserPreferencesType {
58
- /**
59
- * Preferred theme for the user
60
- * If null, would forcibly show user theme switcher dialog for user to select
61
- */
62
- themePreference: ThemePreferenceType | null;
63
- pipelineRBACViewSelectedTab: ViewIsPipelineRBACConfiguredRadioTabs;
64
- }
65
- export interface UpdatedUserPreferencesType extends UserPreferencesType, Pick<ThemeConfigType, 'appTheme'> {
66
- }
67
42
  export {};
@@ -72,6 +72,18 @@ export declare enum TIMELINE_STATUS {
72
72
  HELM_MANIFEST_PUSHED_TO_HELM_REPO = "HELM_MANIFEST_PUSHED_TO_HELM_REPO",
73
73
  HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED = "HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED"
74
74
  }
75
+ /**
76
+ * Constants for NO MATCHING result
77
+ */
78
+ export declare const NO_MATCHING_RESULT = "No matching results";
79
+ /**
80
+ * Constants for TYPE 3 CHARACTERS
81
+ */
82
+ export declare const TYPE_3_CHARACTERS_TO_SEE_MATCHING_RESULTS = "Type 3 chars to see matching results";
83
+ /**
84
+ * Constants for TYPE TO SEE MATCHING RESULTS
85
+ */
86
+ export declare const TYPE_TO_SEE_MATCHING_RESULTS = "Type to see matching results";
75
87
  export declare const EMPTY_STATE_STATUS: {
76
88
  DATA_NOT_AVAILABLE: string;
77
89
  API_TOKEN: {
@@ -340,7 +340,8 @@ export declare enum CDMaterialSidebarType {
340
340
  * }
341
341
  * ```
342
342
  *
343
- * @example Usage with `PatchOperationType.remove` without value
343
+ * @example Usage with `PatchOperationType.remove`
344
+ * Note: Value is not allowed for remove operation
344
345
  *
345
346
  * ```ts
346
347
  * const query: PatchQueryType<string> = {
@@ -348,18 +349,8 @@ export declare enum CDMaterialSidebarType {
348
349
  * path: 'name'
349
350
  * }
350
351
  * ```
351
- *
352
- * @example Usage with `PatchOperationType.remove` with value
353
- *
354
- * ```ts
355
- * const query: PatchQueryType<string, number, true> = {
356
- * op: PatchOperationType.remove,
357
- * path: 'name'
358
- * value: 1
359
- * }
360
- * ```
361
352
  */
362
- export type PatchQueryType<T extends string, K = unknown, IsRemoveValueEnabled extends boolean = false> = {
353
+ export type PatchQueryType<T extends string, K = unknown> = {
363
354
  /**
364
355
  * The path of the json to be patched
365
356
  */
@@ -378,7 +369,7 @@ export type PatchQueryType<T extends string, K = unknown, IsRemoveValueEnabled e
378
369
  * Operation type for patch
379
370
  */
380
371
  op: PatchOperationType.remove;
381
- value?: IsRemoveValueEnabled extends true ? K : never;
372
+ value?: never;
382
373
  } | {
383
374
  /**
384
375
  * Operation type for add
@@ -850,10 +841,6 @@ export declare const TriggerType: {
850
841
  readonly Auto: "AUTOMATIC";
851
842
  readonly Manual: "MANUAL";
852
843
  };
853
- export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
854
- ALL_ENVIRONMENTS = "All environments",
855
- ACCESS_ONLY = "Access only"
856
- }
857
844
  export type ComponentLayoutType = 'row' | 'column';
858
845
  export interface BorderConfigType {
859
846
  /**