From 21bfa4944ee3c23bdcf75b72faa0a946d79765c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 11 Dec 2024 21:52:02 +0100 Subject: [PATCH 1/6] update code to follow new architecture plus updated conditions example --- .../extension-types/condition.md | 19 ++++++++++--------- .../extension-types/header-apps.md | 4 ++-- .../extension-types/kind.md | 7 +++---- .../extension-types/section.md | 2 +- .../ui-extensions/store-menu-items.md | 16 +++++++--------- .../extension-types/condition.md | 2 +- .../extension-types/header-apps.md | 4 ++-- .../extension-types/sections/section.md | 2 +- 8 files changed, 27 insertions(+), 29 deletions(-) diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 063e2ae1bdc..17ac5857784 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -37,7 +37,6 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { - ManifestCondition, UmbConditionConfigBase, UmbConditionControllerArguments, UmbExtensionCondition @@ -45,8 +44,8 @@ import { import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -export type MyExtensionConditionConfig = UmbConditionConfigBase & { - match: string; +export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { + match?: string; }; export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { @@ -64,15 +63,17 @@ export class MyExtensionCondition extends UmbConditionBase = { +const manifest: UmbExtensionManifest = { type: 'kind', alias: 'Umb.Kind.MyButtonKind', matchType: 'headerApp', diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/section.md b/14/umbraco-cms/customizing/extending-overview/extension-types/section.md index 49f769dcea4..710590cf46a 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/section.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/section.md @@ -61,7 +61,7 @@ This is not recommended as it limits the content of your section to this element If you like to have full control, you can define an element like this: ```typescript -const section : ManifestSection = { +const section : UmbExtensionManifest = { type: "section", alias: "Empty.Section", name : 'Empty Section', diff --git a/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md b/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md index f64348495d7..caa34c5102e 100644 --- a/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md +++ b/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md @@ -31,11 +31,11 @@ export const manifests : UcManifestStoreMenuItem[] = [ extensionRegistry.register(manifests); ``` -Each entry must have a type of `ucStoreMenuItem` along with a unique `alias` and `name`. +Each entry must have a type of `ucStoreMenuItem` along with a unique `alias` and `name`. A `meta` entry provides configuration options for the menu item -| Name | Description | +| Name | Description | | -- | -- | | `label` | A label for this menu item (supports the `#` prefix localization string syntax) | | `icon` | An icon to display in the menu item | @@ -53,9 +53,9 @@ section/{currentSection}/workspace/{rootEntityType}/{rootUnique}/{entityType} Here: -- `{currentSection}` is the current section you are in, -- `{rootEntityType}` is the entity type of the menu this item is a child of (should be one of `uc:store-management` or `uc:store-settings`), -- `{rootUnique}` is the ID of the Store this menu is for, and +- `{currentSection}` is the current section you are in, +- `{rootEntityType}` is the entity type of the menu this item is a child of (should be one of `uc:store-management` or `uc:store-settings`), +- `{rootUnique}` is the ID of the Store this menu is for, and - `{entityType}` is the entity type as defined in the menu items manifest meta data. ## Handling Store Menu Item Requests @@ -63,9 +63,7 @@ Here: To handle requests to this endpoint, you should define a workspace manifest for the given entity type. ```typescript -import { ManifestWorkspace } from '@umbraco-cms/backoffice/extension-registry'; - -const manifests: ManifestWorkspace[] = [ +const manifests: UmbExtensionManifest[] = [ { type: 'workspace', kind: 'routable', @@ -80,4 +78,4 @@ const manifests: ManifestWorkspace[] = [ extensionRegistry.register(manifests); -``` \ No newline at end of file +``` diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 491e2a25ad6..7ff08290365 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -55,7 +55,7 @@ declare global { This has to be registered in the extension registry, shown below: ```typescript -export const manifest: ManifestCondition = { +export const manifest: UmbExtensionManifest = { type: 'condition', name: 'My Condition', alias: 'My.Condition.CustomName', diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/header-apps.md b/15/umbraco-cms/customizing/extending-overview/extension-types/header-apps.md index 1faa14da7f3..cffe04a2632 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/header-apps.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/header-apps.md @@ -93,9 +93,9 @@ This is a continuation of the above steps from the **Button Header App with Mani {% code title="my-element.ts" lineNumbers="true" %} ```typescript -import { ManifestHeaderAppButtonKind, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; +import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; -const manifest: ManifestHeaderAppButtonKind = { +const manifest: UmbExtensionManifest = { type: "headerApp", alias: "My.HeaderApp.Documentation", name: "My Header App Documentation", diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/sections/section.md b/15/umbraco-cms/customizing/extending-overview/extension-types/sections/section.md index 6d799c4e10b..ea01a688e02 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/sections/section.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/sections/section.md @@ -61,7 +61,7 @@ This is not recommended as it limits the content of your section to this element If you like to have full control, you can define an element like this: ```typescript -const section : ManifestSection = { +const section : UmbExtensionManifest = { type: "section", alias: "Empty.Section", name : 'Empty Section', From 91f3cf91b8135277c309e139d019e27e8cbaf377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 11 Dec 2024 22:01:22 +0100 Subject: [PATCH 2/6] adding tsconfig re-configuration step --- .../development-flow/vite-package-setup.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/15/umbraco-cms/customizing/development-flow/vite-package-setup.md b/15/umbraco-cms/customizing/development-flow/vite-package-setup.md index 6d88193858a..747f55f08b1 100644 --- a/15/umbraco-cms/customizing/development-flow/vite-package-setup.md +++ b/15/umbraco-cms/customizing/development-flow/vite-package-setup.md @@ -70,7 +70,20 @@ Optionally you can use `--legacy-peer-deps` in the installation command to avoid If this is used the Intellisense to those external references will not be available. {% endhint %} -7. Create a new file called `vite.config.ts` in the folder and insert the following code: +7. re-configure tsconfig with global types from backoffice: + +Edit the file `tsconfig.json`. Then add the array `types` inside `compilerOptions`, with the entry of `@umbraco-cms/backoffice/extension-types`: + +{ + "compilerOptions": { + ... + "types": [ + "@umbraco-cms/backoffice/extension-types" + ] + } +} + +8. Create a new file called `vite.config.ts` in the folder and insert the following code: {% code title="vite.config.ts" lineNumbers="true" %} ```ts From f8286660e71ef9b445848ece1994a580b53a1c0b Mon Sep 17 00:00:00 2001 From: sofietoft Date: Thu, 12 Dec 2024 09:20:14 +0100 Subject: [PATCH 3/6] Simplified the extra steps a bit --- .../customizing/development-flow/vite-package-setup.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/15/umbraco-cms/customizing/development-flow/vite-package-setup.md b/15/umbraco-cms/customizing/development-flow/vite-package-setup.md index 747f55f08b1..fe067e8c629 100644 --- a/15/umbraco-cms/customizing/development-flow/vite-package-setup.md +++ b/15/umbraco-cms/customizing/development-flow/vite-package-setup.md @@ -70,10 +70,10 @@ Optionally you can use `--legacy-peer-deps` in the installation command to avoid If this is used the Intellisense to those external references will not be available. {% endhint %} -7. re-configure tsconfig with global types from backoffice: - -Edit the file `tsconfig.json`. Then add the array `types` inside `compilerOptions`, with the entry of `@umbraco-cms/backoffice/extension-types`: +7. Open the `tsconfig.json` file. +8. Add the array `types` inside `compilerOptions`, with the entry of `@umbraco-cms/backoffice/extension-types`: +```json { "compilerOptions": { ... @@ -82,8 +82,9 @@ Edit the file `tsconfig.json`. Then add the array `types` inside `compilerOption ] } } +``` -8. Create a new file called `vite.config.ts` in the folder and insert the following code: +9. Create a new file called `vite.config.ts` in the folder and insert the following code: {% code title="vite.config.ts" lineNumbers="true" %} ```ts From 4f0de472bce6c2bb2a5e76dcd04acfbc9ee13eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 12 Dec 2024 11:26:09 +0100 Subject: [PATCH 4/6] Update 14/umbraco-cms/customizing/extending-overview/extension-types/condition.md Co-authored-by: sofietoft --- .../customizing/extending-overview/extension-types/condition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 17ac5857784..23b59240b3a 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -101,7 +101,7 @@ export const manifest: UmbExtensionManifest = { } ``` -As can be seen in the code above, we did not make use of the configuration property `match` for our condition. We can do this by replacing the timeout with some other check: +As shown in the code above, the configuration property `match` isn't used for our condition. We can do this by replacing the timeout with some other check: ```typescript // ... From cf9bc5b2a99f0d0139339ffbe47e73b70c39c022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 12 Dec 2024 11:26:21 +0100 Subject: [PATCH 5/6] Update 14/umbraco-cms/customizing/extending-overview/extension-types/condition.md Co-authored-by: sofietoft --- .../customizing/extending-overview/extension-types/condition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 23b59240b3a..2d81b05436d 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -68,7 +68,7 @@ declare global { } ``` -The global declaration on the last five lines. Makes your Condition appear as a valid condition for manifests using the type `UmbExtensionManifest`. Also notice how the Condition Config Type alias has to match with the alias given when registrering the condition below. +The global declaration on the last five lines makes your Condition appear valid for manifests using the type `UmbExtensionManifest`. Also, the Condition Config Type alias should match the alias given when registering the condition below. The Condition then needs to be registered in the Extension Registry: From 2bff02c9529a29afc4e654521a70309657b213f6 Mon Sep 17 00:00:00 2001 From: sofietoft Date: Wed, 8 Jan 2025 10:27:00 +0100 Subject: [PATCH 6/6] Revert changes made to 14 docs --- .../extension-types/condition.md | 19 +++++++++---------- .../extension-types/header-apps.md | 4 ++-- .../extension-types/kind.md | 17 ++++++++--------- .../extension-types/section.md | 2 +- .../ui-extensions/store-menu-items.md | 4 +++- .../extension-types/condition.md | 17 +++++++++-------- .../extension-types/kind.md | 15 ++++++--------- .../ui-extensions/store-menu-items.md | 4 +--- 8 files changed, 39 insertions(+), 43 deletions(-) diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 2d81b05436d..063e2ae1bdc 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -37,6 +37,7 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { + ManifestCondition, UmbConditionConfigBase, UmbConditionControllerArguments, UmbExtensionCondition @@ -44,8 +45,8 @@ import { import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { - match?: string; +export type MyExtensionConditionConfig = UmbConditionConfigBase & { + match: string; }; export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { @@ -63,17 +64,15 @@ export class MyExtensionCondition extends UmbConditionBase = { type: 'kind', alias: 'Umb.Kind.MyButtonKind', matchType: 'headerApp', @@ -72,7 +71,7 @@ This enables other extensions to use this kind and inherit the manifest properti In this example a **Header App** is registered without defining an element, this is possible because the registration inherits the elementName from the kind. -```ts +```typescript import { extensionRegistry } from '@umbraco-cms/extension-registry'; const manifest = { diff --git a/14/umbraco-cms/customizing/extending-overview/extension-types/section.md b/14/umbraco-cms/customizing/extending-overview/extension-types/section.md index 710590cf46a..49f769dcea4 100644 --- a/14/umbraco-cms/customizing/extending-overview/extension-types/section.md +++ b/14/umbraco-cms/customizing/extending-overview/extension-types/section.md @@ -61,7 +61,7 @@ This is not recommended as it limits the content of your section to this element If you like to have full control, you can define an element like this: ```typescript -const section : UmbExtensionManifest = { +const section : ManifestSection = { type: "section", alias: "Empty.Section", name : 'Empty Section', diff --git a/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md b/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md index caa34c5102e..02d7bf55fe7 100644 --- a/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md +++ b/14/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md @@ -63,7 +63,9 @@ Here: To handle requests to this endpoint, you should define a workspace manifest for the given entity type. ```typescript -const manifests: UmbExtensionManifest[] = [ +import { ManifestWorkspace } from '@umbraco-cms/backoffice/extension-registry'; + +const manifests: ManifestWorkspace[] = [ { type: 'workspace', kind: 'routable', diff --git a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md index 7ff08290365..df6ca44feec 100644 --- a/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md +++ b/15/umbraco-cms/customizing/extending-overview/extension-types/condition.md @@ -20,7 +20,6 @@ You can make your own Conditions by creating a class that implements the `UmbExt ```typescript import { - ManifestCondition, UmbConditionConfigBase, UmbConditionControllerArguments, UmbExtensionCondition @@ -28,8 +27,8 @@ import { import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'; import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -export type MyExtensionConditionConfig = UmbConditionConfigBase & { - match: string; +export type MyExtensionConditionConfig = UmbConditionConfigBase<'My.Condition.CustomName'> & { + match?: string; }; export class MyExtensionCondition extends UmbConditionBase implements UmbExtensionCondition { @@ -47,12 +46,14 @@ export class MyExtensionCondition extends UmbConditionBase = { +const manifest: UmbExtensionManifest = { type: 'kind', alias: 'Umb.Kind.MyButtonKind', matchType: 'headerApp', @@ -73,7 +70,7 @@ This enables other extensions to use this kind and inherit the manifest properti In this example a **Header App** is registered without defining an element, this is possible because the registration inherits the elementName from the kind. -```ts +```typescript import { extensionRegistry } from '@umbraco-cms/extension-registry'; const manifest = { diff --git a/15/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md b/15/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md index f64348495d7..e3e8557a21b 100644 --- a/15/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md +++ b/15/umbraco-commerce/key-concepts/ui-extensions/store-menu-items.md @@ -63,9 +63,7 @@ Here: To handle requests to this endpoint, you should define a workspace manifest for the given entity type. ```typescript -import { ManifestWorkspace } from '@umbraco-cms/backoffice/extension-registry'; - -const manifests: ManifestWorkspace[] = [ +const manifests: UmbExtensionManifest[] = [ { type: 'workspace', kind: 'routable',