diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/manifests.ts index e8fb2ee19b..60f4a53b28 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/manifests.ts @@ -11,7 +11,6 @@ import { manifests as iconRegistryManifests } from './icon-registry/manifests.js import { manifests as localizationManifests } from './localization/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as modalManifests } from './modal/manifests.js'; -import { manifests as notificationManifests } from './notification/manifests.js'; import { manifests as pickerManifests } from './picker/manifests.js'; import { manifests as propertyActionManifests } from './property-action/manifests.js'; import { manifests as propertyEditorManifests } from './property-editor/manifests.js'; @@ -41,7 +40,6 @@ export const manifests: Array = ...localizationManifests, ...menuManifests, ...modalManifests, - ...notificationManifests, ...pickerManifests, ...propertyActionManifests, ...propertyEditorManifests, diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/error-viewer-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/error-viewer-modal.element.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/error-viewer-modal.element.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/error-viewer-modal.element.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/error-viewer-modal.token.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/error-viewer-modal.token.ts similarity index 86% rename from src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/error-viewer-modal.token.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/error-viewer-modal.token.ts index 1c09ed590c..311f1b1c67 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/error-viewer-modal.token.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/error-viewer-modal.token.ts @@ -1,5 +1,5 @@ +import type { UmbPeekErrorArgs } from '../../../notification/types.js'; import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; -import type { UmbPeekErrorArgs } from '../../types.js'; // eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface UmbErrorViewerModalData extends UmbPeekErrorArgs {} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/index.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/index.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/index.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/manifest.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/manifest.ts new file mode 100644 index 0000000000..7c7585dba0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/error-viewer/manifest.ts @@ -0,0 +1,10 @@ +import type { ManifestModal } from '@umbraco-cms/backoffice/modal'; + +export const manifests: Array = [ + { + type: 'modal', + alias: 'Umb.Modal.ErrorViewer', + name: 'Error Viewer Modal', + element: () => import('./error-viewer-modal.element.js'), + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/index.ts index 3781b76645..a673c9a5e9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/index.ts @@ -1,3 +1,4 @@ export * from './confirm/index.js'; export * from './discard-changes/index.js'; +export * from './error-viewer/index.js'; export * from './item-picker/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/manifests.ts index 6def05faa8..f8b7cd7531 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/modal/common/manifests.ts @@ -1,9 +1,11 @@ import { manifests as confirmManifests } from './confirm/manifests.js'; import { manifests as discardChangesManifests } from './discard-changes/manifests.js'; +import { manifests as errorViewerManifests } from './error-viewer/manifest.js'; import { manifests as itemPickerManifests } from './item-picker/manifests.js'; export const manifests: Array = [ ...confirmManifests, ...discardChangesManifests, + ...errorViewerManifests, ...itemPickerManifests, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/controllers/peek-error/peek-error-notification.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/notification/controllers/peek-error/peek-error-notification.element.ts index a8b070cdbf..30c920b6be 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/controllers/peek-error/peek-error-notification.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/notification/controllers/peek-error/peek-error-notification.element.ts @@ -1,9 +1,8 @@ +import type { UmbNotificationHandler } from '../../notification-handler.js'; +import type { UmbPeekErrorArgs } from '../../types.js'; import { customElement, html, ifDefined, nothing, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import type { UmbNotificationHandler } from '../../notification-handler.js'; -import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; -import type { UmbPeekErrorArgs } from '../../types.js'; -import { UMB_ERROR_VIEWER_MODAL } from '../../index.js'; +import { UMB_ERROR_VIEWER_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; @customElement('umb-peek-error-notification') export class UmbPeekErrorNotificationElement extends UmbLitElement { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/notification/index.ts index 8c3df6fa4c..1d57e22f7d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/notification/index.ts @@ -2,7 +2,6 @@ import './layouts/default/index.js'; export * from './controllers/peek-error/index.js'; export * from './extractUmbNotificationColor.function.js'; export * from './isUmbNotifications.function.js'; -export * from './modals/error-viewer/index.js'; export * from './notification-handler.js'; export * from './notification.context.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/notification/manifests.ts deleted file mode 100644 index a00e363447..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/manifests.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { manifest } from './modals/error-viewer/manifest.js'; - -export const manifests = [manifest]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/manifest.ts b/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/manifest.ts deleted file mode 100644 index 7aae9d47bf..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/modals/error-viewer/manifest.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { ManifestModal } from '@umbraco-cms/backoffice/modal'; - -export const manifest: ManifestModal = { - type: 'modal', - alias: 'Umb.Modal.ErrorViewer', - name: 'Error Viewer Modal', - element: () => import('./error-viewer-modal.element.js'), -}; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/notification/notification.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/notification/notification.context.ts index 73f26422a2..e0990ecfe0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/notification/notification.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/notification/notification.context.ts @@ -1,9 +1,9 @@ import { UmbNotificationHandler } from './notification-handler.js'; +import type { UmbNotificationColor, UmbNotificationOptions } from './types.js'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbContextBase } from '@umbraco-cms/backoffice/class-api'; import { UmbBasicState } from '@umbraco-cms/backoffice/observable-api'; -import type { UmbNotificationColor, UmbNotificationOptions } from './types.js'; export class UmbNotificationContext extends UmbContextBase { // Notice this cannot use UniqueBehaviorSubject as it holds a HTML Element. which cannot be Serialized to JSON (it has some circular references) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/resources/resource.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/core/resources/resource.controller.ts index 346902dfbe..d96a843293 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/resources/resource.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/resources/resource.controller.ts @@ -1,10 +1,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { UMB_AUTH_CONTEXT } from '../auth/index.js'; +import { UmbDeprecation } from '../utils/deprecation/deprecation.js'; import { isApiError, isCancelError, isCancelablePromise } from './apiTypeValidators.function.js'; import type { XhrRequestOptions } from './types.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; -import { umbPeekError, type UmbNotificationOptions } from '@umbraco-cms/backoffice/notification'; +import type { UmbNotificationOptions } from '@umbraco-cms/backoffice/notification'; import type { UmbDataSourceResponse } from '@umbraco-cms/backoffice/repository'; import { ApiError, @@ -12,7 +13,6 @@ import { CancelError, type ProblemDetails, } from '@umbraco-cms/backoffice/external/backend-api'; -import { UmbDeprecation } from '../utils/deprecation/deprecation.js'; export class UmbResourceController extends UmbControllerBase { #promise: Promise; @@ -128,7 +128,8 @@ export class UmbResourceController extends UmbControllerBase { 'The Umbraco object cache is corrupt, but your action may still have been executed. Please restart the server to reset the cache. This is a work in progress.'; } - umbPeekError(this, { + // This late importing is done to avoid circular reference [NL] + (await import('@umbraco-cms/backoffice/notification')).umbPeekError(this, { headline: headline, message: message, details: problemDetails?.errors ?? problemDetails?.detail, @@ -152,7 +153,8 @@ export class UmbResourceController extends UmbControllerBase { }); */ const headline = problemDetails?.title ?? error.name ?? 'Server Error'; - umbPeekError(this, { + // This late importing is done to avoid circular reference [NL] + (await import('@umbraco-cms/backoffice/notification')).umbPeekError(this, { message: headline, details: problemDetails?.errors ?? problemDetails?.detail, });