@devtron-labs/devtron-fe-common-lib 1.10.15-gatekeeper-1 → 1.10.16-beta-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 (52) hide show
  1. package/dist/{@common-rjsf-DpMVaiMa.js → @code-editor-_rShAsik.js} +15597 -14473
  2. package/dist/@common-rjsf-BOeRTuMh.js +617 -0
  3. package/dist/{@framer-motion-DI44jecR.js → @framer-motion-DMD7dX-G.js} +1 -1
  4. package/dist/@monaco-editor-CVagbUeH.js +138960 -0
  5. package/dist/{@react-dates-lUQ2WJOE.js → @react-dates-DxmDHBUI.js} +333 -333
  6. package/dist/{@react-select-DrPIgUsG.js → @react-select-BR4eLpVa.js} +1 -1
  7. package/dist/{@react-virtualized-sticky-tree-D-jip2dN.js → @react-virtualized-sticky-tree-Ca-pl6uN.js} +1 -1
  8. package/dist/@vendor-DZHtXPTX.js +68691 -0
  9. package/dist/Common/CodeEditor/CodeEditor.d.ts +4 -0
  10. package/dist/Common/CodeEditor/CodeEditor.reducer.d.ts +48 -0
  11. package/dist/Common/CodeEditor/index.d.ts +2 -0
  12. package/dist/Common/CodeEditor/types.d.ts +110 -0
  13. package/dist/Common/CodeEditor/utils.d.ts +3 -0
  14. package/dist/Common/Constants.d.ts +1 -0
  15. package/dist/Common/index.d.ts +1 -0
  16. package/dist/Shared/Components/ActionMenu/ActionMenu.component.d.ts +3 -0
  17. package/dist/Shared/Components/ActionMenu/ActionMenuOption.d.ts +3 -0
  18. package/dist/Shared/Components/ActionMenu/index.d.ts +2 -0
  19. package/dist/Shared/Components/ActionMenu/types.d.ts +19 -0
  20. package/dist/Shared/Components/CICDHistory/DeploymentHistoryConfigDiff/DeploymentHistoryDiffView.d.ts +1 -1
  21. package/dist/Shared/Components/CodeEditorWrapper/CodeEditorWrapper.d.ts +19 -0
  22. package/dist/Shared/Components/CodeEditorWrapper/index.d.ts +1 -0
  23. package/dist/Shared/Components/CodeEditorWrapper/types.d.ts +7 -0
  24. package/dist/Shared/Components/ConfirmationModal/index.d.ts +1 -1
  25. package/dist/Shared/Components/DatePicker/constants.d.ts +0 -9
  26. package/dist/Shared/Components/ReactSelect/constants.d.ts +11 -0
  27. package/dist/Shared/Components/SelectPicker/common.d.ts +2 -0
  28. package/dist/Shared/Components/index.d.ts +2 -0
  29. package/dist/Shared/Hooks/index.d.ts +1 -0
  30. package/dist/Shared/Hooks/useUserPreferences/index.d.ts +4 -0
  31. package/dist/Shared/Hooks/useUserPreferences/service.d.ts +8 -0
  32. package/dist/Shared/Hooks/useUserPreferences/types.d.ts +80 -0
  33. package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +10 -0
  34. package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +4 -0
  35. package/dist/Shared/Services/common.service.d.ts +1 -3
  36. package/dist/Shared/Services/types.d.ts +5 -30
  37. package/dist/Shared/constants.d.ts +12 -0
  38. package/dist/Shared/types.d.ts +0 -4
  39. package/dist/assets/@code-editor.css +1 -0
  40. package/dist/assets/@common-rjsf.css +1 -1
  41. package/dist/assets/@monaco-editor.css +1 -0
  42. package/dist/assets/codicon.ecfbfe4b.ttf +0 -0
  43. package/dist/assets/ic-compare.0ee3e4cf.svg +22 -0
  44. package/dist/assets/ic-match-case.13b7a2fa.svg +19 -0
  45. package/dist/assets/ic-match-word.d92addc3.svg +19 -0
  46. package/dist/assets/ic-replace-all-text.a87fd342.svg +19 -0
  47. package/dist/assets/ic-replace-text.cc5433be.svg +19 -0
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +836 -824
  50. package/package.json +7 -1
  51. package/dist/@vendor-DxSbZ5Xu.js +0 -29041
  52. /package/dist/Shared/{Services → Hooks/useUserPreferences}/constants.d.ts +0 -0
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { CodeEditorComposition, CodeEditorInterface } from './types';
3
+ declare const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition;
4
+ export default CodeEditor;
@@ -0,0 +1,48 @@
1
+ import { MODES } from '../Constants';
2
+ import { Action, CodeEditorInitialValueType, CodeEditorState } from './types';
3
+ export declare const CodeEditorReducer: (state: CodeEditorState, action: Action) => {
4
+ mode: any;
5
+ diffMode: boolean;
6
+ theme: import('./types').CodeEditorThemesKeys;
7
+ code: string;
8
+ defaultCode: string;
9
+ noParsing: boolean;
10
+ } | {
11
+ diffMode: any;
12
+ mode: MODES;
13
+ theme: import('./types').CodeEditorThemesKeys;
14
+ code: string;
15
+ defaultCode: string;
16
+ noParsing: boolean;
17
+ } | {
18
+ theme: any;
19
+ mode: MODES;
20
+ diffMode: boolean;
21
+ code: string;
22
+ defaultCode: string;
23
+ noParsing: boolean;
24
+ } | {
25
+ code: any;
26
+ mode: MODES;
27
+ diffMode: boolean;
28
+ theme: import('./types').CodeEditorThemesKeys;
29
+ defaultCode: string;
30
+ noParsing: boolean;
31
+ } | {
32
+ defaultCode: any;
33
+ mode: MODES;
34
+ diffMode: boolean;
35
+ theme: import('./types').CodeEditorThemesKeys;
36
+ code: string;
37
+ noParsing: boolean;
38
+ } | {
39
+ height: any;
40
+ mode: MODES;
41
+ diffMode: boolean;
42
+ theme: import('./types').CodeEditorThemesKeys;
43
+ code: string;
44
+ defaultCode: string;
45
+ noParsing: boolean;
46
+ };
47
+ export declare const parseValueToCode: (value: string, mode: string, tabSize: number) => string;
48
+ export declare const initialState: ({ mode, theme, value, defaultValue, diffView, noParsing, tabSize, appTheme, }: CodeEditorInitialValueType) => CodeEditorState;
@@ -0,0 +1,2 @@
1
+ export { default as CodeEditor } from './CodeEditor';
2
+ export * from './types';
@@ -0,0 +1,110 @@
1
+ import { AppThemeType } from '../../Shared/Providers';
2
+ import { MODES } from '../Constants';
3
+ export interface InformationBarProps {
4
+ text: string;
5
+ className?: string;
6
+ children?: React.ReactNode;
7
+ }
8
+ export declare enum CodeEditorThemesKeys {
9
+ vsDarkDT = "vs-dark--dt",
10
+ vs = "vs",
11
+ networkStatusInterface = "network-status-interface"
12
+ }
13
+ interface CodeEditorBaseInterface {
14
+ value?: string;
15
+ lineDecorationsWidth?: number;
16
+ responseType?: string;
17
+ onChange?: (value: string, defaultValue: string) => void;
18
+ onBlur?: () => void;
19
+ onFocus?: () => void;
20
+ children?: any;
21
+ defaultValue?: string;
22
+ mode?: MODES | string;
23
+ tabSize?: number;
24
+ readOnly?: boolean;
25
+ noParsing?: boolean;
26
+ inline?: boolean;
27
+ shebang?: string | JSX.Element;
28
+ diffView?: boolean;
29
+ loading?: boolean;
30
+ customLoader?: JSX.Element;
31
+ theme?: CodeEditorThemesKeys;
32
+ original?: string;
33
+ focus?: boolean;
34
+ validatorSchema?: any;
35
+ isKubernetes?: boolean;
36
+ cleanData?: boolean;
37
+ schemaURI?: string;
38
+ /**
39
+ * If true, disable the in-built search of monaco editor
40
+ * @default false
41
+ */
42
+ disableSearch?: boolean;
43
+ /**
44
+ * If true, Enable original value editing of monaco editor
45
+ * @default false
46
+ */
47
+ originalEditable?: boolean;
48
+ }
49
+ export type CodeEditorInterface = CodeEditorBaseInterface & ({
50
+ adjustEditorHeightToContent?: boolean;
51
+ height?: never;
52
+ } | {
53
+ adjustEditorHeightToContent?: never;
54
+ height?: number | string;
55
+ });
56
+ export interface CodeEditorHeaderInterface {
57
+ children?: any;
58
+ className?: string;
59
+ hideDefaultSplitHeader?: boolean;
60
+ }
61
+ export interface CodeEditorComposition {
62
+ Header?: React.FC<any>;
63
+ LanguageChanger?: React.FC<any>;
64
+ ThemeChanger?: React.FC<any>;
65
+ ValidationError?: React.FC<any>;
66
+ Clipboard?: React.FC<any>;
67
+ Warning?: React.FC<InformationBarProps>;
68
+ ErrorBar?: React.FC<InformationBarProps>;
69
+ Information?: React.FC<InformationBarProps>;
70
+ Container?: React.FC<{
71
+ children: React.ReactNode;
72
+ flexExpand?: boolean;
73
+ overflowHidden?: boolean;
74
+ }>;
75
+ }
76
+ export interface CodeEditorHeaderComposition {
77
+ LanguageChanger?: React.FC<any>;
78
+ ThemeChanger?: React.FC<any>;
79
+ ValidationError?: React.FC<any>;
80
+ Clipboard?: React.FC<any>;
81
+ }
82
+ type ActionTypes = 'changeLanguage' | 'setDiff' | 'setTheme' | 'setCode' | 'setDefaultCode' | 'setHeight';
83
+ export interface Action {
84
+ type: ActionTypes;
85
+ value: any;
86
+ }
87
+ export interface CodeEditorInitialValueType extends Pick<CodeEditorBaseInterface, 'theme'> {
88
+ mode: string;
89
+ diffView: boolean;
90
+ value: string;
91
+ defaultValue: string;
92
+ noParsing?: boolean;
93
+ tabSize: number;
94
+ appTheme: AppThemeType;
95
+ }
96
+ export interface CodeEditorState {
97
+ mode: MODES;
98
+ diffMode: boolean;
99
+ theme: CodeEditorThemesKeys;
100
+ code: string;
101
+ defaultCode: string;
102
+ noParsing: boolean;
103
+ }
104
+ export declare enum CodeEditorActionTypes {
105
+ reInit = "reInit",
106
+ submitLoading = "submitLoading",
107
+ overrideLoading = "overrideLoading",
108
+ success = "success"
109
+ }
110
+ export {};
@@ -0,0 +1,3 @@
1
+ import { AppThemeType } from '../../Shared/Providers';
2
+ import { CodeEditorInterface } from './types';
3
+ export declare const getCodeEditorThemeFromAppTheme: (editorTheme: CodeEditorInterface["theme"], appTheme: AppThemeType) => CodeEditorInterface["theme"];
@@ -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";
@@ -46,6 +46,7 @@ export * from './Pagination';
46
46
  export * from './Markdown';
47
47
  export * from './GenericDescription';
48
48
  export * from './SegmentedBarChart';
49
+ export * from './CodeEditor/types';
49
50
  export * from './Tooltip';
50
51
  export * from './SegmentedControl';
51
52
  export * from './API';
@@ -0,0 +1,3 @@
1
+ import { ActionMenuProps } from './types';
2
+ declare const ActionMenu: ({ options, disableDescriptionEllipsis, children, onClick }: ActionMenuProps) => JSX.Element;
3
+ export default ActionMenu;
@@ -0,0 +1,3 @@
1
+ import { ActionMenuOptionProps } from './types';
2
+ declare const ActionMenuOption: ({ option, onClick, disableDescriptionEllipsis }: ActionMenuOptionProps) => JSX.Element;
3
+ export default ActionMenuOption;
@@ -0,0 +1,2 @@
1
+ export { default as ActionMenu } from './ActionMenu.component';
2
+ export type { ActionMenuProps } from './types';
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ import { GroupBase, OptionsOrGroups } from 'react-select';
3
+ import { SelectPickerOptionType, SelectPickerProps } from '../SelectPicker';
4
+ type ActionMenuOptionType = SelectPickerOptionType & {
5
+ isDisabled?: boolean;
6
+ /**
7
+ * @default 'neutral'
8
+ */
9
+ type?: 'neutral' | 'negative';
10
+ };
11
+ export interface ActionMenuProps extends Pick<SelectPickerProps, 'disableDescriptionEllipsis'> {
12
+ children: ReactElement;
13
+ options: OptionsOrGroups<ActionMenuOptionType, GroupBase<ActionMenuOptionType>>;
14
+ onClick: (option: SelectPickerOptionType) => void;
15
+ }
16
+ export interface ActionMenuOptionProps extends Pick<ActionMenuProps, 'onClick' | 'disableDescriptionEllipsis'> {
17
+ option: ActionMenuOptionType;
18
+ }
19
+ export {};
@@ -1,3 +1,3 @@
1
1
  import { DeploymentTemplateHistoryType } from '../types';
2
- declare const DeploymentHistoryDiffView: ({ currentConfiguration, baseTemplateConfiguration, previousConfigAvailable, rootClassName, }: DeploymentTemplateHistoryType) => JSX.Element;
2
+ declare const DeploymentHistoryDiffView: ({ currentConfiguration, baseTemplateConfiguration, previousConfigAvailable, rootClassName, codeEditorKey, }: DeploymentTemplateHistoryType) => JSX.Element;
3
3
  export default DeploymentHistoryDiffView;
@@ -0,0 +1,19 @@
1
+ import { CodeEditorHeaderProps, CodeEditorStatusBarProps } from '../../../Common/CodeMirror';
2
+ import { CodeEditorWrapperProps } from './types';
3
+ export declare const isCodeMirrorEnabled: () => boolean;
4
+ export declare const CodeEditorWrapper: {
5
+ <DiffView extends boolean>({ codeEditorProps, codeMirrorProps, children, ...restProps }: CodeEditorWrapperProps<DiffView>): JSX.Element;
6
+ LanguageChanger: () => JSX.Element;
7
+ ThemeChanger: () => JSX.Element;
8
+ ValidationError: () => JSX.Element;
9
+ Clipboard: () => JSX.Element;
10
+ Header: (props: CodeEditorHeaderProps) => JSX.Element;
11
+ Warning: (props: CodeEditorStatusBarProps) => JSX.Element;
12
+ ErrorBar: (props: CodeEditorStatusBarProps) => JSX.Element;
13
+ Information: (props: CodeEditorStatusBarProps) => JSX.Element;
14
+ Container: ({ overflowHidden, ...props }: {
15
+ children: React.ReactNode;
16
+ flexExpand?: boolean;
17
+ overflowHidden?: boolean;
18
+ }) => JSX.Element;
19
+ };
@@ -0,0 +1 @@
1
+ export { CodeEditorWrapper as CodeEditor, isCodeMirrorEnabled } from './CodeEditorWrapper';
@@ -0,0 +1,7 @@
1
+ import { CodeEditorInterface } from '../../../Common/CodeEditor';
2
+ import { CodeEditorProps } from '../../../Common/CodeMirror';
3
+ export type CodeEditorWrapperProps<DiffView extends boolean> = Pick<CodeEditorProps<DiffView>, 'mode' | 'tabSize' | 'readOnly' | 'placeholder' | 'noParsing' | 'loading' | 'customLoader' | 'cleanData' | 'disableSearch' | 'children'> & {
4
+ diffView?: DiffView;
5
+ codeEditorProps: Omit<CodeEditorInterface, 'mode' | 'tabSize' | 'readOnly' | 'placeholder' | 'noParsing' | 'loading' | 'customLoader' | 'cleanData' | 'disableSearch' | 'children'>;
6
+ codeMirrorProps: Omit<CodeEditorProps<DiffView>, 'mode' | 'tabSize' | 'readOnly' | 'placeholder' | 'noParsing' | 'loading' | 'customLoader' | 'cleanData' | 'disableSearch' | 'children'>;
7
+ };
@@ -2,5 +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';
@@ -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
- };
@@ -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;
@@ -1,5 +1,7 @@
1
1
  import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps, MultiValueRemoveProps, MultiValueProps, InputProps } from 'react-select';
2
+ import { TooltipProps } from '@Common/Tooltip/types';
2
3
  import { SelectPickerGroupHeadingProps, SelectPickerOptionType, SelectPickerProps } from './type';
4
+ export declare const getTooltipProps: (tooltipProps?: SelectPickerOptionType["tooltipProps"]) => TooltipProps;
3
5
  export declare const SelectPickerDropdownIndicator: <OptionValue>(props: DropdownIndicatorProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
4
6
  export declare const SelectPickerClearIndicator: <OptionValue>(props: ClearIndicatorProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
5
7
  export declare const SelectPickerControl: <OptionValue>(props: ControlProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
@@ -67,6 +67,7 @@ export * from './RegistryIcon';
67
67
  export * from './GitProviderIcon';
68
68
  export * from './CustomInput';
69
69
  export * from './InfoBlock';
70
+ export * from './CodeEditorWrapper';
70
71
  export * from './SSOProviderIcon';
71
72
  export * from './Table';
72
73
  export * from './Backdrop';
@@ -76,3 +77,4 @@ export * from './FlagImage';
76
77
  export * from './DevtronLicenseCard';
77
78
  export * from './LoginBanner';
78
79
  export * from './Confetti';
80
+ export * from './ActionMenu';
@@ -3,3 +3,4 @@ export * from './useGetResourceKindsOptions';
3
3
  export * from './UseDownload';
4
4
  export * from './useForm';
5
5
  export * from './useStickyEvent';
6
+ export * from './useUserPreferences';
@@ -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: {
@@ -841,10 +841,6 @@ export declare const TriggerType: {
841
841
  readonly Auto: "AUTOMATIC";
842
842
  readonly Manual: "MANUAL";
843
843
  };
844
- export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
845
- ALL_ENVIRONMENTS = "All environments",
846
- ACCESS_ONLY = "Access only"
847
- }
848
844
  export type ComponentLayoutType = 'row' | 'column';
849
845
  export interface BorderConfigType {
850
846
  /**