From dda6d22c98b05735c4afb5021abd4a4eda9b11b3 Mon Sep 17 00:00:00 2001 From: Cataldo Mazzilli Date: Tue, 28 Jan 2025 15:22:49 +0100 Subject: [PATCH] refactor!: remove deprecated const -deprecate RESULT_LABEL_TYPE BREAKING CHANGE: remove ACCOUNTS_APP_ID Refs: SHELL-269 --- api-extractor/carbonio-shell-ui.api.md | 17 ++++++--------- src/constants/index.ts | 7 +++--- src/lib.ts | 2 -- src/store/app/hooks.ts | 11 +++++----- src/types/misc/index.ts | 29 ------------------------- src/types/network/index.ts | 30 -------------------------- 6 files changed, 15 insertions(+), 81 deletions(-) diff --git a/api-extractor/carbonio-shell-ui.api.md b/api-extractor/carbonio-shell-ui.api.md index 34d37ccbc..181d33b38 100644 --- a/api-extractor/carbonio-shell-ui.api.md +++ b/api-extractor/carbonio-shell-ui.api.md @@ -86,9 +86,6 @@ type AccountRightTargetEmail = { addr: string; }; -// @public @deprecated (undocumented) -export const ACCOUNTS_APP_ID = "accounts"; - // @public (undocumented) export type AccountSettings = { attrs: AccountSettingsAttrs; @@ -1035,7 +1032,7 @@ export const report: ReturnType; // @public (undocumented) const report_2: (appId: string) => (error: Event_2, hint?: EventHint) => string; -// @public (undocumented) +// @public @deprecated (undocumented) export const RESULT_LABEL_TYPE: { readonly normal: "normal"; readonly warning: "warning"; @@ -1510,12 +1507,12 @@ interface ZimletProp { // lib/types/account/index.d.ts:145:9 - (ae-forgotten-export) The symbol "AccountRightName" needs to be exported by the entry point lib.d.ts // lib/types/account/index.d.ts:146:9 - (ae-forgotten-export) The symbol "AccountRightTarget" needs to be exported by the entry point lib.d.ts // lib/types/apps/index.d.ts:60:5 - (ae-forgotten-export) The symbol "PanelMode" needs to be exported by the entry point lib.d.ts -// lib/types/misc/index.d.ts:73:9 - (ae-forgotten-export) The symbol "SoapPolicy" needs to be exported by the entry point lib.d.ts -// lib/types/misc/index.d.ts:92:5 - (ae-forgotten-export) The symbol "FolderView" needs to be exported by the entry point lib.d.ts -// lib/types/misc/index.d.ts:108:5 - (ae-forgotten-export) The symbol "Meta" needs to be exported by the entry point lib.d.ts -// lib/types/misc/index.d.ts:112:5 - (ae-forgotten-export) The symbol "SoapRetentionPolicy" needs to be exported by the entry point lib.d.ts -// lib/types/misc/index.d.ts:126:5 - (ae-forgotten-export) The symbol "SortBy" needs to be exported by the entry point lib.d.ts -// lib/types/network/index.d.ts:107:5 - (ae-forgotten-export) The symbol "AccountACEInfo" needs to be exported by the entry point lib.d.ts +// lib/types/misc/index.d.ts:45:9 - (ae-forgotten-export) The symbol "SoapPolicy" needs to be exported by the entry point lib.d.ts +// lib/types/misc/index.d.ts:64:5 - (ae-forgotten-export) The symbol "FolderView" needs to be exported by the entry point lib.d.ts +// lib/types/misc/index.d.ts:80:5 - (ae-forgotten-export) The symbol "Meta" needs to be exported by the entry point lib.d.ts +// lib/types/misc/index.d.ts:84:5 - (ae-forgotten-export) The symbol "SoapRetentionPolicy" needs to be exported by the entry point lib.d.ts +// lib/types/misc/index.d.ts:98:5 - (ae-forgotten-export) The symbol "SortBy" needs to be exported by the entry point lib.d.ts +// lib/types/network/index.d.ts:79:5 - (ae-forgotten-export) The symbol "AccountACEInfo" needs to be exported by the entry point lib.d.ts // lib/types/network/soap.d.ts:11:5 - (ae-forgotten-export) The symbol "NameSpace" needs to be exported by the entry point lib.d.ts // lib/types/network/soap.d.ts:69:5 - (ae-forgotten-export) The symbol "SoapSearchFolder" needs to be exported by the entry point lib.d.ts // lib/types/network/soap.d.ts:91:9 - (ae-forgotten-export) The symbol "Tag" needs to be exported by the entry point lib.d.ts diff --git a/src/constants/index.ts b/src/constants/index.ts index fab160284..e67ede09a 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -7,10 +7,6 @@ import type { DynamicThemeFix } from 'darkreader'; export const SHELL_APP_ID = 'carbonio-shell-ui'; export const SETTINGS_APP_ID = 'settings'; -/** - * @deprecated This constant is not used and will be deleted in next releases - */ -export const ACCOUNTS_APP_ID = 'accounts'; export const ACTION_TYPES = { /** @deprecated this action does not belong to shell, and therefore it will be removed in next releases */ @@ -91,6 +87,9 @@ export const LOGIN_V3_CONFIG_PATH = '/zx/login/v3/config'; export const DARK_READER_PROP_KEY = 'zappDarkreaderMode'; export const SENTRY_SHELL_DSN = 'https://0ce2448c05b94f0182c47ae52c7ff52c@feedback.zextras.tools/6'; +/** + * @deprecated this const does not belong to shell + */ export const RESULT_LABEL_TYPE = { normal: 'normal', warning: 'warning', diff --git a/src/lib.ts b/src/lib.ts index 97770f6c2..547041776 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -56,8 +56,6 @@ export declare const addBoard: AppDependantExports['addBoard']; */ export declare const getBridgedFunctions: AppDependantExports['getBridgedFunctions']; -export * from './boot/app/app-direct-exports'; - export type { PrimaryBarComponentProps, SecondaryBarComponentProps, diff --git a/src/store/app/hooks.ts b/src/store/app/hooks.ts index 7c2d6096e..c27a457bb 100644 --- a/src/store/app/hooks.ts +++ b/src/store/app/hooks.ts @@ -13,26 +13,25 @@ import type { AppRoute, CarbonioModule } from '../../types/apps'; export const getAppHook = (appId: string) => (): CarbonioModule => useAppStore((s) => s.apps[appId]); + export const useApps = (): Record => useAppStore((s) => s.apps); + export const useAppList = (): Array => { const apps = useApps(); return useMemo(() => sortBy(apps, (a) => a.priority), [apps]); }; -export const getAppList = (): Array => - sortBy(useAppStore.getState().apps, (a) => a.priority); export const getApp = (appId: string) => (): CarbonioModule | undefined => useAppStore.getState().apps[appId]; -export const getApps = (): Record => useAppStore.getState().apps; export const getAppContextHook = (appId: string) => (): T => useAppStore((s) => s.appContexts[appId] as T); + export const getAppContext = (appId: string) => (): unknown => useAppStore.getState().appContexts[appId]; -export const getShell = (): CarbonioModule => useAppStore.getState().shell; + export const getRoutes = (): Record => useAppStore.getState().routes; + export const useRoutes = (): Record => useAppStore((s) => s.routes); -export const getRoute = (id: string): AppRoute => useAppStore.getState().routes[id]; -export const useRoute = (id: string): AppRoute => useAppStore((s) => s.routes[id]); diff --git a/src/types/misc/index.ts b/src/types/misc/index.ts index 2b304594f..8871e7ac7 100644 --- a/src/types/misc/index.ts +++ b/src/types/misc/index.ts @@ -39,35 +39,6 @@ export type AccountProps = { identityId?: string; }; -/** @deprecated */ -export type IdentityProps = { - id: string; - /** - * Type of the identity - */ - flgType: 'primary' | 'persona' | 'IMAP' | 'POP'; - /** - * Localized description of the type of identity - */ - type: string; - /** - * is a number while you are creating a new one - */ - identityId: string | number; - fromAddress?: string; - identityName?: string; - fromDisplay?: string; - recoveryAccount?: string; - replyToDisplay?: string; - replyToAddress?: string; - replyToEnabled?: string; - saveToSent?: string; - sentMailFolder?: string; - whenInFoldersEnabled?: string; - whenSentToEnabled?: string; - whenSentToAddresses?: string; -}; - // Custom metadata type Meta> = { // Section. Normally present. If absent this indicates that CustomMetadata info is present but there are no sections to report on. diff --git a/src/types/network/index.ts b/src/types/network/index.ts index 592a8be70..99b5c7507 100644 --- a/src/types/network/index.ts +++ b/src/types/network/index.ts @@ -80,36 +80,6 @@ export type PermissionsMods = { new: AccountACEInfo; }; }; -// TODO remove -/** - * @deprecated - */ -export type CreateIdentityProps = { - requestId: number; - /** name of the identity */ - zimbraPrefIdentityName: string | undefined; - /** personal part of email address put in from header */ - zimbraPrefFromDisplay: string | undefined; - /** email address to put in from header. Deprecated on data source as of bug 67068. */ - zimbraPrefFromAddress: string | undefined; - /** Type of the email address from header. (sendAs or sendOnBehalfOf) */ - zimbraPrefFromAddressType: 'sendAs' | 'sendOnBehalfOf'; - /** TRUE if we should set a reply-to header */ - // TODO: update to boolean? - zimbraPrefReplyToEnabled: 'TRUE' | 'FALSE' | undefined; - /** personal part of email address put in reply-to header */ - zimbraPrefReplyToDisplay: string | undefined; - /** address to put in reply-to header */ - zimbraPrefReplyToAddress: string | undefined; - /** default mail signature for account/identity/dataSource */ - zimbraPrefDefaultSignatureId: string | undefined; - /** forward/reply signature id for account/identity/dataSource */ - zimbraPrefForwardReplySignatureId: string | undefined; - /** TRUE if we should look at zimbraPrefWhenSentToAddresses (deprecatedSince 5.0 in account) */ - zimbraPrefWhenSentToEnabled: string | undefined; - /** TRUE if we should look at zimbraPrefWhenInFolderIds (deprecatedSince 5.0 in account) */ - zimbraPrefWhenInFoldersEnabled: string | undefined; -}; export type CreateIdentityResponse = { identity: [Identity];