diff --git a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/app-webhook.context.ts b/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/app-webhook.context.ts deleted file mode 100644 index 971d1edc8f..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/app-webhook.context.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { UmbWebhookCollectionRepository } from '../collection/index.js'; -import type { UmbWebhookDetailModel } from '../types.js'; -import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -import { UmbBaseController } from '@umbraco-cms/backoffice/class-api'; -import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; -import type { UmbApi } from '@umbraco-cms/backoffice/extension-api'; - -export class UmbAppWebhookContext extends UmbBaseController implements UmbApi { - #webhookCollectionRepository: UmbWebhookCollectionRepository; - #webhooks: Array = []; - #appWebhook = new UmbObjectState(undefined); - appWebhook = this.#appWebhook.asObservable(); - - constructor(host: UmbControllerHost) { - super(host); - this.provideContext(UMB_APP_WEBHOOK_CONTEXT, this); - this.#webhookCollectionRepository = new UmbWebhookCollectionRepository(this); - this.#observeWebhooks(); - } - - setLanguage(unique: string) { - const webhook = this.#webhooks.find((x) => x.unique === unique); - this.#appWebhook.update(webhook); - } - - async #observeWebhooks() { - const { data } = await this.#webhookCollectionRepository.requestCollection({ skip: 0, take: 100 }); - - // TODO: make this observable / update when webhooks are added/removed/updated - if (data) { - this.#webhooks = data.items; - } - } -} - -// Default export to enable this as a globalContext extension js: -export default UmbAppWebhookContext; - -export const UMB_APP_WEBHOOK_CONTEXT = new UmbContextToken('UmbAppWebhookContext'); diff --git a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/index.ts b/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/index.ts deleted file mode 100644 index 868bf754a7..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-webhook.context.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/manifests.ts deleted file mode 100644 index a38ca4af40..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/webhooks/global-contexts/manifests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { ManifestGlobalContext } from '@umbraco-cms/backoffice/extension-registry'; - -export const manifests: Array = [ - { - type: 'globalContext', - alias: 'Umb.GlobalContext.AppWebhook', - name: 'App Webhook Context', - js: () => import('./app-webhook.context.js'), - }, -]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/webhooks/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/webhooks/manifests.ts index ccfa411c5d..3b431ec455 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/webhooks/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/webhooks/manifests.ts @@ -3,7 +3,6 @@ import { manifests as treeManifests } from './menu-item/manifests.js'; //import { manifests as entityActions } from './entity-actions/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; import { manifests as collectionManifests } from './collection/manifests.js'; -import { manifests as globalContextManifests } from './global-contexts/manifests.js'; export const manifests = [ ...repositoryManifests, @@ -11,5 +10,4 @@ export const manifests = [ ...treeManifests, ...workspaceManifests, ...collectionManifests, - ...globalContextManifests, ];