diff --git a/src/Umbraco.Web.UI.Client/libs/notification/notification.context.test.ts b/src/Umbraco.Web.UI.Client/libs/notification/notification.context.test.ts index ddd0490067..9dd850f5f1 100644 --- a/src/Umbraco.Web.UI.Client/libs/notification/notification.context.test.ts +++ b/src/Umbraco.Web.UI.Client/libs/notification/notification.context.test.ts @@ -1,12 +1,12 @@ import { expect } from '@open-wc/testing'; -import { UmbNotificationHandler, UmbNotificationService } from '.'; +import { UmbNotificationHandler, UmbNotificationContext } from '.'; describe('UCPNotificationService', () => { - let notificationService: UmbNotificationService; + let notificationService: UmbNotificationContext; beforeEach(async () => { - notificationService = new UmbNotificationService(); + notificationService = new UmbNotificationContext(); }); describe('Public API', () => { diff --git a/src/Umbraco.Web.UI.Client/libs/notification/notification.context.ts b/src/Umbraco.Web.UI.Client/libs/notification/notification.context.ts index f240b1ec3b..95b3822bdb 100644 --- a/src/Umbraco.Web.UI.Client/libs/notification/notification.context.ts +++ b/src/Umbraco.Web.UI.Client/libs/notification/notification.context.ts @@ -18,7 +18,7 @@ export interface UmbNotificationOptions { export type UmbNotificationColor = '' | 'default' | 'positive' | 'warning' | 'danger'; -export class UmbNotificationService { +export class UmbNotificationContext { // Notice this cannot use UniqueBehaviorSubject as it holds a HTML Element. which cannot be Serialized to JSON (it has some circular references) private _notifications = new BehaviorSubject(>[]); public readonly notifications = this._notifications.asObservable(); @@ -27,7 +27,7 @@ export class UmbNotificationService { * @private * @param {UmbNotificationOptions} options * @return {*} {UmbNotificationHandler} - * @memberof UmbNotificationService + * @memberof UmbNotificationContext */ private _open(options: UmbNotificationOptions): UmbNotificationHandler { const notificationHandler = new UmbNotificationHandler(options); @@ -41,7 +41,7 @@ export class UmbNotificationService { /** * @private * @param {string} key - * @memberof UmbNotificationService + * @memberof UmbNotificationContext */ private _close(key: string) { this._notifications.next(this._notifications.getValue().filter((notification) => notification.key !== key)); @@ -50,7 +50,7 @@ export class UmbNotificationService { /** * @private * @param {string} key - * @memberof UmbNotificationService + * @memberof UmbNotificationContext */ private _handleClosed(notificationHandler: UmbNotificationHandler) { notificationHandler.element.removeEventListener('closed', () => this._handleClosed(notificationHandler)); @@ -62,7 +62,7 @@ export class UmbNotificationService { * @param {UmbNotificationColor} color * @param {UmbNotificationOptions} options * @return {*} - * @memberof UmbNotificationService + * @memberof UmbNotificationContext */ public peek( color: UmbNotificationColor, @@ -76,7 +76,7 @@ export class UmbNotificationService { * @param {UmbNotificationColor} color * @param {UmbNotificationOptions} options * @return {*} - * @memberof UmbNotificationService + * @memberof UmbNotificationContext */ public stay( color: UmbNotificationColor, @@ -86,6 +86,6 @@ export class UmbNotificationService { } } -export const UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN = new UmbContextToken( - UmbNotificationService.name +export const UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN = new UmbContextToken( + UmbNotificationContext.name ); diff --git a/src/Umbraco.Web.UI.Client/libs/notification/stories/notification.stories.ts b/src/Umbraco.Web.UI.Client/libs/notification/stories/notification.stories.ts index ce0460727a..87556cde8d 100644 --- a/src/Umbraco.Web.UI.Client/libs/notification/stories/notification.stories.ts +++ b/src/Umbraco.Web.UI.Client/libs/notification/stories/notification.stories.ts @@ -3,14 +3,14 @@ import '../layouts/default'; import { Meta, Story } from '@storybook/web-components'; import { html } from 'lit'; -import { UmbNotificationService } from '..'; +import { UmbNotificationContext } from '..'; export default { title: 'API/Notifications/Overview', component: 'ucp-notification-layout-default', decorators: [ (story) => - html` + html` ${story()} `, ], diff --git a/src/Umbraco.Web.UI.Client/libs/notification/stories/story-notification-default-example.element.ts b/src/Umbraco.Web.UI.Client/libs/notification/stories/story-notification-default-example.element.ts index b470aa71f7..b208fcc921 100644 --- a/src/Umbraco.Web.UI.Client/libs/notification/stories/story-notification-default-example.element.ts +++ b/src/Umbraco.Web.UI.Client/libs/notification/stories/story-notification-default-example.element.ts @@ -4,15 +4,14 @@ import { UmbNotificationDefaultData } from '../layouts/default'; import { UmbNotificationColor, UmbNotificationOptions, - UmbNotificationService, - UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN + UmbNotificationContext, + UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, } from '..'; import { UmbLitElement } from '@umbraco-cms/element'; - @customElement('story-notification-default-example') export class StoryNotificationDefaultExampleElement extends UmbLitElement { - private _notificationService?: UmbNotificationService; + private _notificationService?: UmbNotificationContext; connectedCallback(): void { super.connectedCallback(); diff --git a/src/Umbraco.Web.UI.Client/libs/resources/resource.controller.ts b/src/Umbraco.Web.UI.Client/libs/resources/resource.controller.ts index cae1a437aa..f1f8d138ba 100644 --- a/src/Umbraco.Web.UI.Client/libs/resources/resource.controller.ts +++ b/src/Umbraco.Web.UI.Client/libs/resources/resource.controller.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { UmbNotificationOptions, - UmbNotificationService, + UmbNotificationContext, UmbNotificationDefaultData, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, } from '@umbraco-cms/notification'; @@ -13,7 +13,7 @@ import type { DataSourceResponse } from '@umbraco-cms/models'; export class UmbResourceController extends UmbController { #promise: Promise; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface, promise: Promise, alias?: string) { super(host, alias); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts index f3c2efadfe..b23a7bf3af 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts @@ -45,7 +45,7 @@ import { } from './settings/languages/app-language-select/app-language.context'; import { UmbPackageStore } from './packages/repository/package.store'; import { UmbServerExtensionController } from './packages/repository/server-extension.controller'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { UmbLitElement } from '@umbraco-cms/element'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-api'; @@ -84,7 +84,7 @@ export class UmbBackofficeElement extends UmbLitElement { super(); this.provideContext(UMB_MODAL_SERVICE_CONTEXT_TOKEN, new UmbModalService()); - this.provideContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, new UmbNotificationService()); + this.provideContext(UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, new UmbNotificationContext()); // TODO: find a way this is possible outside this element. It needs to be possible to register stores in extensions this.provideContext(UMB_CURRENT_USER_STORE_CONTEXT_TOKEN, new UmbCurrentUserStore()); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/repository/document-type.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/repository/document-type.repository.ts index 085cd78f5e..bb0cf6517f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/repository/document-type.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/repository/document-type.repository.ts @@ -8,7 +8,7 @@ import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { ProblemDetailsModel, DocumentTypeModel } from '@umbraco-cms/backend-api'; import type { UmbTreeRepository } from 'libs/repository/tree-repository.interface'; import { UmbDetailRepository } from '@umbraco-cms/repository'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; type ItemType = DocumentTypeModel; @@ -27,7 +27,7 @@ export class UmbDocumentTypeRepository implements UmbTreeRepository, UmbDetailRe #detailDataSource: UmbDocumentTypeServerDataSource; #detailStore?: UmbDocumentTypeStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts index 7e0188a602..d20caf2f14 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts @@ -8,7 +8,7 @@ import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { ProblemDetailsModel, DocumentModel } from '@umbraco-cms/backend-api'; import type { UmbTreeRepository } from 'libs/repository/tree-repository.interface'; import { UmbDetailRepository } from '@umbraco-cms/repository'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; type ItemType = DocumentModel; @@ -27,7 +27,7 @@ export class UmbDocumentRepository implements UmbTreeRepository, UmbDetailReposi #detailDataSource: UmbDocumentServerDataSource; #detailStore?: UmbDocumentStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/repository/media-type.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/repository/media-type.repository.ts index bb3e3ff038..3dc3adde0b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/repository/media-type.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media-types/repository/media-type.repository.ts @@ -6,7 +6,7 @@ import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import type { MediaTypeDetails } from '@umbraco-cms/models'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { UmbTreeRepository, RepositoryTreeDataSource } from '@umbraco-cms/repository'; export class UmbMediaTypeRepository implements UmbTreeRepository { @@ -20,7 +20,7 @@ export class UmbMediaTypeRepository implements UmbTreeRepository { #detailSource: UmbMediaTypeDetailServerDataSource; #detailStore?: UmbMediaTypeDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/repository/media.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/repository/media.repository.ts index 831af8b644..e31c97110a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/media/media/repository/media.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/media/media/repository/media.repository.ts @@ -9,7 +9,7 @@ import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; import type { UmbTreeRepository } from 'libs/repository/tree-repository.interface'; import { UmbDetailRepository } from '@umbraco-cms/repository'; import type { MediaDetails } from '@umbraco-cms/models'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; type ItemDetailType = MediaDetails; @@ -28,7 +28,7 @@ export class UmbMediaRepository implements UmbTreeRepository, UmbDetailRepositor #detailDataSource: UmbMediaDetailServerDataSource; #detailStore?: UmbMediaDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/repository/member-group.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/repository/member-group.repository.ts index 7f273071e5..805b9f2b06 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/repository/member-group.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-groups/repository/member-group.repository.ts @@ -3,7 +3,7 @@ import { UmbMemberGroupDetailServerDataSource } from './sources/member-group.det import { UmbMemberGroupDetailStore, UMB_MEMBER_GROUP_DETAIL_STORE_CONTEXT_TOKEN } from './member-group.detail.store'; import { MemberGroupTreeServerDataSource } from './sources/member-group.tree.server.data'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import type { MemberGroupDetails } from '@umbraco-cms/models'; import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; @@ -21,7 +21,7 @@ export class UmbMemberGroupRepository implements UmbTreeRepository, UmbDetailRep #detailSource: UmbMemberGroupDetailServerDataSource; #detailStore?: UmbMemberGroupDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/repository/member-type.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/repository/member-type.repository.ts index c03d4eeb44..0fb69656e0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/repository/member-type.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/member-types/repository/member-type.repository.ts @@ -6,7 +6,7 @@ import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { RepositoryTreeDataSource, UmbDetailRepository, UmbTreeRepository } from '@umbraco-cms/repository'; import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import type { MemberTypeDetails } from '@umbraco-cms/models'; // TODO => use correct type when available @@ -23,7 +23,7 @@ export class UmbMemberTypeRepository implements UmbTreeRepository, UmbDetailRepo #detailSource: UmbMemberTypeDetailServerDataSource; #detailStore?: UmbMemberTypeDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/members/members/repository/member.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/members/members/repository/member.repository.ts index 685c54ee25..1518857860 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/members/members/repository/member.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/members/members/repository/member.repository.ts @@ -1,7 +1,7 @@ import { UmbMemberTreeStore, UMB_MEMBER_TREE_STORE_CONTEXT_TOKEN } from './member.tree.store'; import { MemberTreeServerDataSource } from './sources/member.tree.server.data'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UmbTreeRepository } from '@umbraco-cms/repository'; import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; @@ -10,7 +10,7 @@ export class UmbMemberRepository implements UmbTreeRepository { #host: UmbControllerHostInterface; #dataSource: MemberTreeServerDataSource; #treeStore?: UmbMemberTreeStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; #initResolver?: () => void; #initialized = false; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/cultures/repository/culture.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/cultures/repository/culture.repository.ts index abdd4e6e72..b0ce3dec34 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/cultures/repository/culture.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/cultures/repository/culture.repository.ts @@ -1,7 +1,7 @@ import { UmbCultureServerDataSource } from './sources/culture.server.data'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; export class UmbCultureRepository { #init!: Promise; @@ -9,7 +9,7 @@ export class UmbCultureRepository { #dataSource: UmbCultureServerDataSource; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/repository/data-type.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/repository/data-type.repository.ts index 0c52ff35ad..cf3593ef05 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/repository/data-type.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/repository/data-type.repository.ts @@ -8,7 +8,7 @@ import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { ProblemDetailsModel, DataTypeModel } from '@umbraco-cms/backend-api'; import type { UmbTreeRepository } from 'libs/repository/tree-repository.interface'; import { UmbDetailRepository } from '@umbraco-cms/repository'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; type ItemType = DataTypeModel; @@ -27,7 +27,7 @@ export class UmbDataTypeRepository implements UmbTreeRepository, UmbDetailReposi #detailDataSource: UmbDataTypeServerDataSource; #detailStore?: UmbDataTypeStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/repository/language.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/repository/language.repository.ts index 9fa8683457..44673f1781 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/repository/language.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/languages/repository/language.repository.ts @@ -2,7 +2,7 @@ import { UmbLanguageServerDataSource } from './sources/language.server.data'; import { UmbLanguageStore, UMB_LANGUAGE_STORE_CONTEXT_TOKEN } from './language.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { LanguageModel, ProblemDetailsModel } from '@umbraco-cms/backend-api'; export class UmbLanguageRepository { @@ -13,7 +13,7 @@ export class UmbLanguageRepository { #dataSource: UmbLanguageServerDataSource; #languageStore?: UmbLanguageStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts index c222b88208..7a3d44f0a0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/backoffice-frame/backoffice-notification-container.element.ts @@ -4,7 +4,7 @@ import { customElement, state } from 'lit/decorators.js'; import { repeat } from 'lit/directives/repeat.js'; import { UmbNotificationHandler, - UmbNotificationService, + UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, } from '@umbraco-cms/notification'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -29,7 +29,7 @@ export class UmbBackofficeNotificationContainer extends UmbLitElement { @state() private _notifications?: UmbNotificationHandler[]; - private _notificationService?: UmbNotificationService; + private _notificationService?: UmbNotificationContext; constructor() { super(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-context/entity-manager-controller.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-context/entity-manager-controller.ts index 5303a4c32e..d37bb44918 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-context/entity-manager-controller.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-context/entity-manager-controller.ts @@ -1,41 +1,37 @@ import { v4 as uuidv4 } from 'uuid'; -import { UmbContextConsumerController, UmbContextToken } from "@umbraco-cms/context-api"; -import { UmbControllerHostInterface } from "@umbraco-cms/controller"; -import { UmbNotificationDefaultData, UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from "@umbraco-cms/notification"; -import { ObjectState, UmbObserverController } from "@umbraco-cms/observable-api"; +import { UmbContextConsumerController, UmbContextToken } from '@umbraco-cms/context-api'; +import { UmbControllerHostInterface } from '@umbraco-cms/controller'; +import { + UmbNotificationDefaultData, + UmbNotificationContext, + UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, +} from '@umbraco-cms/notification'; +import { ObjectState, UmbObserverController } from '@umbraco-cms/observable-api'; import type { EntityTreeItemModel } from '@umbraco-cms/backend-api'; import { UmbEntityDetailStore } from '@umbraco-cms/store'; - // Extend entityType base type?, so we are sure to have parentKey? // TODO: switch to use EntityDetailItem ? if we can have such type? -export class UmbEntityWorkspaceManager, EntityDetailsType extends EntityTreeItemModel = ReturnType> { - - +export class UmbEntityWorkspaceManager< + StoreType extends UmbEntityDetailStore, + EntityDetailsType extends EntityTreeItemModel = ReturnType +> { private _host; state = new ObjectState(undefined); - - protected _storeSubscription?: UmbObserverController; - private _notificationService?: UmbNotificationService; + private _notificationService?: UmbNotificationContext; private _store?: StoreType; - #isNew = false; private _entityType; private _entityKey!: string; private _createAtParentKey?: string | null; - - constructor( - host: UmbControllerHostInterface, - entityType:string, - storeToken: UmbContextToken - ) { + constructor(host: UmbControllerHostInterface, entityType: string, storeToken: UmbContextToken) { this._host = host; this._entityType = entityType; @@ -73,33 +69,32 @@ export class UmbEntityWorkspaceManager { return this._entityType; - } + }; getEntityKey = (): string => { return this._entityKey; - } + }; getStore = () => { return this._store; - } + }; getData = () => { return this.state.getValue(); - } + }; load = (entityKey: string) => { this.#isNew = false; this._entityKey = entityKey; this._observeStore(); - } + }; create = (parentKey: string | null) => { this.#isNew = true; this._entityKey = uuidv4(); this._createAtParentKey = parentKey; - } + }; save = (): Promise => { - if (!this._store) { // TODO: add a more beautiful error: console.error('Could not save cause workspace context has no store.'); @@ -107,7 +102,7 @@ export class UmbEntityWorkspaceManager { this.state.unsubscribe(); - } - - + }; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts index 6e9a1db8c1..6f328015c9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-actions/copy/property-action-copy.element.ts @@ -3,7 +3,7 @@ import { customElement, property } from 'lit/decorators.js'; import type { UmbPropertyAction } from '../shared/property-action/property-action.model'; import { UmbNotificationDefaultData, - UmbNotificationService, + UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, } from '@umbraco-cms/notification'; import { UmbLitElement } from '@umbraco-cms/element'; @@ -13,7 +13,7 @@ export class UmbPropertyActionCopyElement extends UmbLitElement implements UmbPr @property() value = ''; - private _notificationService?: UmbNotificationService; + private _notificationService?: UmbNotificationContext; constructor() { super(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/repository/template.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/repository/template.repository.ts index 582f6cf992..75d596ea3c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/repository/template.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/repository/template.repository.ts @@ -6,7 +6,7 @@ import { } from '../workspace/data/template.detail.store'; import { UmbTemplateTreeStore, UMB_TEMPLATE_TREE_STORE_CONTEXT_TOKEN } from '../tree/data/template.tree.store'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { ProblemDetailsModel, TemplateModel } from '@umbraco-cms/backend-api'; import { UmbDetailRepository } from 'libs/repository/detail-repository.interface'; @@ -26,7 +26,7 @@ export class UmbTemplateRepository implements UmbTreeRepository, UmbDetailReposi #treeStore?: UmbTemplateTreeStore; #detailStore?: UmbTemplateDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/data/template.detail.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/data/template.detail.repository.ts index e4b728c86d..17cd602fd6 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/data/template.detail.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/data/template.detail.repository.ts @@ -4,7 +4,7 @@ import { UmbTemplateDetailServerDataSource } from './sources/template.detail.ser import type { ProblemDetailsModel, TemplateModel } from '@umbraco-cms/backend-api'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import type { UmbControllerHostInterface } from '@umbraco-cms/controller'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; // Move to documentation / JSdoc /* We need to create a new instance of the repository from within the element context. We want the notifications to be displayed in the right context. */ @@ -15,7 +15,7 @@ export class UmbTemplateDetailRepository { #dataSource: UmbTemplateDetailServerDataSource; #detailStore?: UmbTemplateDetailStore; #treeStore?: UmbTemplateTreeStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; #initResolver?: () => void; #initialized = false; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/repository/dictionary.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/repository/dictionary.repository.ts index 0ed7a54092..0f28a507e4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/repository/dictionary.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/repository/dictionary.repository.ts @@ -6,7 +6,7 @@ import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { RepositoryTreeDataSource, UmbDetailRepository, UmbTreeRepository } from '@umbraco-cms/repository'; import { ProblemDetailsModel } from '@umbraco-cms/backend-api'; -import { UmbNotificationService, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; +import { UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/notification'; import type { DictionaryDetails } from '@umbraco-cms/models'; export class UmbDictionaryRepository implements UmbTreeRepository, UmbDetailRepository { @@ -20,7 +20,7 @@ export class UmbDictionaryRepository implements UmbTreeRepository, UmbDetailRepo #detailSource: UmbDictionaryDetailServerDataSource; #detailStore?: UmbDictionaryDetailStore; - #notificationService?: UmbNotificationService; + #notificationService?: UmbNotificationContext; constructor(host: UmbControllerHostInterface) { this.#host = host; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts index f7bf81b98b..c02cd567dd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-section/views/users/workspace-view-users-create.element.ts @@ -8,7 +8,7 @@ import { UmbUserStore, UMB_USER_STORE_CONTEXT_TOKEN } from '../../../users/user. import type { UserDetails } from '@umbraco-cms/models'; import { UmbNotificationDefaultData, - UmbNotificationService, + UmbNotificationContext, UMB_NOTIFICATION_SERVICE_CONTEXT_TOKEN, } from '@umbraco-cms/notification'; @@ -61,7 +61,7 @@ export class UmbWorkspaceViewUsersCreateElement extends UmbModalLayoutElement { private _createdUser?: UserDetails; protected _userStore?: UmbUserStore; - private _notificationService?: UmbNotificationService; + private _notificationService?: UmbNotificationContext; connectedCallback(): void { super.connectedCallback();