@devtron-labs/devtron-fe-common-lib 1.10.9-beta-1 → 1.10.10
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.
- package/dist/{@code-editor-CpmCW1QX.js → @code-editor-CZMd9qEI.js} +5628 -5647
- package/dist/{@common-rjsf-D28-wZG-.js → @common-rjsf-DxZVTjHD.js} +1 -1
- package/dist/Common/Constants.d.ts +0 -1
- package/dist/Shared/Components/ConfirmationModal/index.d.ts +1 -1
- package/dist/Shared/Components/DatePicker/constants.d.ts +9 -0
- package/dist/Shared/Components/ReactSelect/constants.d.ts +0 -11
- package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -1
- package/dist/Shared/Components/SelectPicker/type.d.ts +1 -7
- package/dist/Shared/Hooks/index.d.ts +0 -1
- package/dist/Shared/Services/common.service.d.ts +3 -1
- package/dist/Shared/Services/types.d.ts +30 -5
- package/dist/Shared/constants.d.ts +0 -12
- package/dist/Shared/types.d.ts +4 -0
- package/dist/assets/@code-editor.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +563 -570
- package/package.json +1 -1
- package/dist/Shared/Hooks/useUserPreferences/index.d.ts +0 -4
- package/dist/Shared/Hooks/useUserPreferences/service.d.ts +0 -30
- package/dist/Shared/Hooks/useUserPreferences/types.d.ts +0 -60
- package/dist/Shared/Hooks/useUserPreferences/useUserPrefrences.d.ts +0 -10
- /package/dist/Shared/{Hooks/useUserPreferences → Services}/constants.d.ts +0 -0
package/package.json
CHANGED
@@ -1,30 +0,0 @@
|
|
1
|
-
import { ResourceKindType, BaseAppMetaData } from '../../index';
|
2
|
-
import { ThemeConfigType, ThemePreferenceType } from '@Shared/Providers/ThemeProvider/types';
|
3
|
-
import { UserPreferencesType, ViewIsPipelineRBACConfiguredRadioTabs, UpdatedUserPreferencesType } from './types';
|
4
|
-
/**
|
5
|
-
* @returns UserPreferencesType
|
6
|
-
* @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.
|
7
|
-
* @throws Will throw an error if the request fails or if the result is not in the expected format.
|
8
|
-
*/
|
9
|
-
export declare const getUserPreferences: () => Promise<UserPreferencesType>;
|
10
|
-
export declare const resourceTypes: ResourceKindType[];
|
11
|
-
/**
|
12
|
-
* @description This function updates the user preferences in the server. It constructs a payload with the updated user preferences and sends a PATCH request to the server. If the request is successful, it returns true. If an error occurs, it shows an error message and returns false.
|
13
|
-
* @param updatedUserPreferences - The updated user preferences to be sent to the server.
|
14
|
-
* @param recentlyVisitedDevtronApps - The recently visited Devtron apps to be sent to the server.
|
15
|
-
* @param shouldThrowError - A boolean indicating whether to throw an error if the request fails. Default is false.
|
16
|
-
* @returns A promise that resolves to true if the request is successful, or false if an error occurs.
|
17
|
-
* @throws Will throw an error if `shouldThrowError` is true and the request fails.
|
18
|
-
*/
|
19
|
-
export type UpdateUserPreferencesProps = {
|
20
|
-
type: 'updateTheme';
|
21
|
-
value: ThemePreferenceType | null;
|
22
|
-
appTheme: ThemeConfigType['appTheme'];
|
23
|
-
} | {
|
24
|
-
type: 'updatePipelineRBACView';
|
25
|
-
value: ViewIsPipelineRBACConfiguredRadioTabs;
|
26
|
-
} | {
|
27
|
-
type: 'updateRecentlyVisitedApps';
|
28
|
-
value: BaseAppMetaData[];
|
29
|
-
};
|
30
|
-
export declare const updateUserPreferences: (updatedUserPreferences?: UpdatedUserPreferencesType, recentlyVisitedDevtronApps?: BaseAppMetaData[], shouldThrowError?: boolean) => Promise<boolean>;
|
@@ -1,60 +0,0 @@
|
|
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
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { ServerErrors } from '../../../Common/ServerError';
|
2
|
-
import { 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: number, appName: string, isInvalidAppId?: boolean) => Promise<void>;
|
10
|
-
};
|
File without changes
|