@devtron-labs/devtron-fe-common-lib 1.10.16 → 1.10.18

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 (55) hide show
  1. package/dist/{@code-editor-vkgcMBll.js → @code-editor-rOxqP3qu.js} +6295 -6130
  2. package/dist/{@common-rjsf-CgbsOSx-.js → @common-rjsf-HdXVC2be.js} +1 -1
  3. package/dist/Common/CodeMirror/utils.d.ts +1 -0
  4. package/dist/Common/Constants.d.ts +1 -0
  5. package/dist/Common/SegmentedControl/types.d.ts +4 -0
  6. package/dist/Common/Toggle/Toggle.d.ts +2 -1
  7. package/dist/Common/Types.d.ts +1 -0
  8. package/dist/Shared/Components/ConfirmationModal/index.d.ts +2 -1
  9. package/dist/Shared/Components/DatePicker/constants.d.ts +0 -9
  10. package/dist/Shared/Components/FramerComponents/MotionDiv.d.ts +2 -0
  11. package/dist/Shared/Components/FramerComponents/index.d.ts +3 -0
  12. package/dist/Shared/Components/Icon/Icon.d.ts +14 -0
  13. package/dist/Shared/Components/Icon/types.d.ts +1 -1
  14. package/dist/Shared/Components/ReactSelect/constants.d.ts +11 -0
  15. package/dist/Shared/Components/SelectPicker/common.d.ts +1 -0
  16. package/dist/Shared/Components/TabGroup/TabGroup.helpers.d.ts +2 -2
  17. package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +5 -3
  18. package/dist/Shared/Components/TabGroup/TabGroup.utils.d.ts +2 -0
  19. package/dist/Shared/Components/index.d.ts +1 -0
  20. package/dist/Shared/Hooks/index.d.ts +2 -0
  21. package/dist/Shared/Hooks/useForm/useForm.d.ts +8 -0
  22. package/dist/Shared/Hooks/useOneTimePrompt/constants.d.ts +1 -0
  23. package/dist/Shared/Hooks/useOneTimePrompt/index.d.ts +1 -0
  24. package/dist/Shared/Hooks/useOneTimePrompt/types.d.ts +3 -0
  25. package/dist/Shared/Hooks/useOneTimePrompt/useOneTimePrompt.d.ts +6 -0
  26. package/dist/Shared/Hooks/useUserPreferences/index.d.ts +4 -0
  27. package/dist/Shared/Hooks/useUserPreferences/service.d.ts +8 -0
  28. package/dist/Shared/Hooks/useUserPreferences/types.d.ts +80 -0
  29. package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +10 -0
  30. package/dist/Shared/Hooks/useUserPreferences/utils.d.ts +4 -0
  31. package/dist/Shared/Services/common.service.d.ts +1 -3
  32. package/dist/Shared/Services/types.d.ts +5 -30
  33. package/dist/Shared/constants.d.ts +12 -0
  34. package/dist/Shared/types.d.ts +13 -8
  35. package/dist/assets/@code-editor.css +1 -1
  36. package/dist/assets/ic-arrows-left-right.2d4dda45.svg +3 -0
  37. package/dist/assets/ic-check.a0f5ee85.svg +3 -0
  38. package/dist/assets/ic-close-large.fb6095e0.svg +3 -0
  39. package/dist/assets/ic-delete-lightning.2a7545bd.svg +3 -0
  40. package/dist/assets/ic-folder-user.ff0670e8.svg +3 -0
  41. package/dist/assets/ic-hibernate.f75c1e70.svg +19 -0
  42. package/dist/assets/ic-lightning-fill.25ce980f.svg +3 -0
  43. package/dist/assets/ic-lightning.02da5bf8.svg +3 -0
  44. package/dist/assets/ic-medium-delete.f33a9cd7.svg +11 -0
  45. package/dist/assets/ic-pencil.3ea1c075.svg +3 -0
  46. package/dist/assets/ic-sort-ascending.45f474ff.svg +3 -0
  47. package/dist/assets/ic-sort-descending.0ee6b8dd.svg +3 -0
  48. package/dist/assets/ic-sortable.1d3308e1.svg +3 -0
  49. package/dist/assets/ic-stamp.23836e37.svg +3 -0
  50. package/dist/assets/ic-users.102d4732.svg +3 -0
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.js +604 -593
  53. package/package.json +1 -1
  54. package/dist/assets/ic-hibernate.988d2323.svg +0 -28
  55. /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-vkgcMBll.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-rOxqP3qu.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";
@@ -10,6 +10,7 @@ export declare const getUpdatedSearchMatchesCount: (newQuery: SearchQuery, view:
10
10
  current: number;
11
11
  };
12
12
  export declare const updateDiffMinimapValues: (view: MergeView, transactions: readonly Transaction[], side: "a" | "b") => void;
13
+ export declare const getScanLimit: (lhsValue: string, value: string) => 500 | 10000 | 5000 | 15000 | 20000;
13
14
  export declare const getFoldGutterElement: (open: boolean) => HTMLSpanElement;
14
15
  export declare const getReadOnlyElement: () => HTMLDivElement;
15
16
  export declare const getRevertControlButton: () => HTMLButtonElement;
@@ -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,6 +8,10 @@ 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;
11
15
  } & (({
12
16
  /**
13
17
  * Label for the segment
@@ -1,4 +1,4 @@
1
- declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, Icon, iconClass, throttleOnChange, shouldToggleValueOnLabelClick, ...props }: {
1
+ declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dataTestId, Icon, iconClass, throttleOnChange, shouldToggleValueOnLabelClick, isLoading, ...props }: {
2
2
  [x: string]: any;
3
3
  selected?: boolean;
4
4
  onSelect?: any;
@@ -10,5 +10,6 @@ declare const Toggle: ({ selected, onSelect, color, rootClassName, disabled, dat
10
10
  iconClass?: string;
11
11
  throttleOnChange?: boolean;
12
12
  shouldToggleValueOnLabelClick?: boolean;
13
+ isLoading?: boolean;
13
14
  }) => JSX.Element;
14
15
  export default Toggle;
@@ -349,6 +349,7 @@ export interface ApprovalConfigDataType extends Pick<UserApprovalInfo, 'currentC
349
349
  groupName: UserGroupDTO['name'];
350
350
  })[];
351
351
  };
352
+ isExceptionUser: boolean;
352
353
  }
353
354
  export declare enum ApprovalRuntimeStateType {
354
355
  init = 0,
@@ -2,5 +2,6 @@ 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
- };
@@ -0,0 +1,2 @@
1
+ import { HTMLMotionProps } from 'framer-motion';
2
+ export declare const MotionDiv: (props: HTMLMotionProps<"div">) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { AnimatePresence } from 'framer-motion';
2
+ export * from './MotionDiv';
3
+ export { AnimatePresence };
@@ -6,6 +6,7 @@ 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>>;
9
10
  'ic-ather': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
10
11
  'ic-azure': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
11
12
  'ic-bharatpe': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -19,10 +20,12 @@ export declare const iconMap: {
19
20
  'ic-caret-left': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
20
21
  'ic-cd': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
21
22
  'ic-chat-circle-dots': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
23
+ 'ic-check': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
22
24
  'ic-ci-linked': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
23
25
  'ic-ci-webhook': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
24
26
  'ic-circle-loader': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
25
27
  'ic-clock': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
28
+ 'ic-close-large': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
26
29
  'ic-close-small': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
27
30
  'ic-code': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
28
31
  'ic-container': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -30,6 +33,7 @@ export declare const iconMap: {
30
33
  'ic-copy': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
31
34
  'ic-crown': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
32
35
  'ic-cube': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
36
+ 'ic-delete-lightning': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
33
37
  'ic-delete': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
34
38
  'ic-delhivery': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
35
39
  'ic-devtron-header-logo': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -39,6 +43,7 @@ export declare const iconMap: {
39
43
  'ic-env': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
40
44
  'ic-error': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
41
45
  'ic-failure': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
46
+ 'ic-folder-user': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
42
47
  'ic-gear': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
43
48
  'ic-git': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
44
49
  'ic-github': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -59,9 +64,12 @@ export declare const iconMap: {
59
64
  'ic-job-color': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
60
65
  'ic-k8s-job': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
61
66
  '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>>;
62
69
  'ic-livspace': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
63
70
  'ic-login-devtron-logo': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
64
71
  'ic-logout': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
72
+ 'ic-medium-delete': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
65
73
  'ic-medium-paintbucket': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
66
74
  'ic-microsoft': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
67
75
  'ic-missing': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -74,11 +82,16 @@ export declare const iconMap: {
74
82
  'ic-openshift': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
75
83
  'ic-out-of-sync': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
76
84
  'ic-paper-plane-color': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
85
+ 'ic-pencil': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
77
86
  'ic-quay': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
78
87
  'ic-quote': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
79
88
  '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>>;
80
92
  'ic-spinny': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
81
93
  'ic-stack': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
94
+ 'ic-stamp': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
82
95
  'ic-success': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
83
96
  'ic-suspended': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
84
97
  'ic-tata1mg': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -87,6 +100,7 @@ export declare const iconMap: {
87
100
  'ic-travclan': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
88
101
  'ic-unknown': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
89
102
  'ic-user-key': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
103
+ 'ic-users': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
90
104
  'ic-warning': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
91
105
  };
92
106
  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'}` | 'white' | 'black' | null;
21
+ color: `${'B' | 'N' | 'G' | 'Y' | 'R' | 'V' | 'O'}${`${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00` | '50' | '0'}` | '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 { TabProps } from './TabGroup.types';
2
- export declare const getTabIcon: ({ icon: Icon, showError, showWarning, className, }: Pick<TabProps, "showError" | "showWarning" | "icon"> & {
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"> & {
3
3
  className: string;
4
4
  }) => JSX.Element;
5
5
  export declare const getTabBadge: (badge: TabProps["badge"], className: string) => JSX.Element;
@@ -2,6 +2,7 @@ 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';
5
6
  type TabComponentProps<TabTypeProps> = TabTypeProps & DataAttributes;
6
7
  type ConditionalTabType = {
7
8
  /**
@@ -79,10 +80,11 @@ export type TabProps = {
79
80
  */
80
81
  description?: string | string[];
81
82
  /**
82
- * Icon component to be displayed in the tab.
83
- * This should be a functional component that renders an SVG.
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.
84
86
  */
85
- icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
87
+ icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>> | IconName;
86
88
  /**
87
89
  * Badge number to be displayed on the tab, typically for notifications.
88
90
  */
@@ -1,7 +1,9 @@
1
+ import { IconsProps } from '../Icon';
1
2
  import { TabGroupProps } from './TabGroup.types';
2
3
  export declare const getClassNameBySizeMap: ({ hideTopPadding, alignActiveBorderWithContainer, }: Pick<TabGroupProps, "hideTopPadding" | "alignActiveBorderWithContainer">) => Record<TabGroupProps["size"], {
3
4
  tabClassName: string;
4
5
  iconClassName: string;
5
6
  badgeClassName: string;
6
7
  }>;
8
+ export declare const TAB_ICON_SIZE_MAP: Record<TabGroupProps['size'], IconsProps['size']>;
7
9
  export declare const tabGroupClassMap: Record<TabGroupProps['size'], string>;
@@ -77,4 +77,5 @@ export * from './FlagImage';
77
77
  export * from './DevtronLicenseCard';
78
78
  export * from './LoginBanner';
79
79
  export * from './Confetti';
80
+ export * from './FramerComponents';
80
81
  export * from './ActionMenu';
@@ -3,3 +3,5 @@ export * from './useGetResourceKindsOptions';
3
3
  export * from './UseDownload';
4
4
  export * from './useForm';
5
5
  export * from './useStickyEvent';
6
+ export * from './useOneTimePrompt';
7
+ export * from './useUserPreferences';
@@ -57,6 +57,8 @@ 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;
60
62
  }) => void;
61
63
  reset: (formData: T, resetOptions?: {
62
64
  /** A boolean indicating whether to retain the current dirty state of the form fields. */
@@ -67,8 +69,14 @@ export declare const useForm: <T extends Record<keyof T, any> = {}>(options?: {
67
69
  keepErrors?: boolean;
68
70
  /** A boolean indicating whether the form should check for dirty state upon reset. */
69
71
  triggerDirty?: boolean;
72
+ /** A boolean indicating whether the form should check for errors upon reset. */
73
+ triggerError?: boolean;
70
74
  /** A boolean indicating whether the initial values of the form should be retained after reset. If false, provided formData will become initial data. */
71
75
  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>;
72
80
  }) => void;
73
81
  /** An object representing additional form state. */
74
82
  formState: {
@@ -0,0 +1 @@
1
+ export declare const ONE_TIME_PROMPT_LOCAL_STORAGE_KEY = "one-time-prompt-do-not-show-again";
@@ -0,0 +1 @@
1
+ export * from './useOneTimePrompt';
@@ -0,0 +1,3 @@
1
+ export interface UseOneTimePromptProps {
2
+ localStorageKey: string;
3
+ }
@@ -0,0 +1,6 @@
1
+ import { UseOneTimePromptProps } from './types';
2
+ export declare const useOneTimePrompt: ({ localStorageKey }: UseOneTimePromptProps) => {
3
+ showPrompt: boolean;
4
+ handleClose: () => void;
5
+ handleDoNotShowAgainClose: () => void;
6
+ };
@@ -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,8 +340,7 @@ export declare enum CDMaterialSidebarType {
340
340
  * }
341
341
  * ```
342
342
  *
343
- * @example Usage with `PatchOperationType.remove`
344
- * Note: Value is not allowed for remove operation
343
+ * @example Usage with `PatchOperationType.remove` without value
345
344
  *
346
345
  * ```ts
347
346
  * const query: PatchQueryType<string> = {
@@ -349,8 +348,18 @@ export declare enum CDMaterialSidebarType {
349
348
  * path: 'name'
350
349
  * }
351
350
  * ```
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
+ * ```
352
361
  */
353
- export type PatchQueryType<T extends string, K = unknown> = {
362
+ export type PatchQueryType<T extends string, K = unknown, IsRemoveValueEnabled extends boolean = false> = {
354
363
  /**
355
364
  * The path of the json to be patched
356
365
  */
@@ -369,7 +378,7 @@ export type PatchQueryType<T extends string, K = unknown> = {
369
378
  * Operation type for patch
370
379
  */
371
380
  op: PatchOperationType.remove;
372
- value?: never;
381
+ value?: IsRemoveValueEnabled extends true ? K : never;
373
382
  } | {
374
383
  /**
375
384
  * Operation type for add
@@ -841,10 +850,6 @@ export declare const TriggerType: {
841
850
  readonly Auto: "AUTOMATIC";
842
851
  readonly Manual: "MANUAL";
843
852
  };
844
- export declare enum ViewIsPipelineRBACConfiguredRadioTabs {
845
- ALL_ENVIRONMENTS = "All environments",
846
- ACCESS_ONLY = "Access only"
847
- }
848
853
  export type ComponentLayoutType = 'row' | 'column';
849
854
  export interface BorderConfigType {
850
855
  /**