-
Notifications
You must be signed in to change notification settings - Fork 21
chore: revises docs #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
chore: revises docs #1075
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
b3c0e88
chore: revises docs
lasomethingsomething 30b83ef
Update get.md
lasomethingsomething 0488e2f
Update index.md
lasomethingsomething 0fa4100
Update index.md
lasomethingsomething dfe4def
Update index.md
lasomethingsomething 9a2abdc
Update index.md
lasomethingsomething f7b5704
Update settingsItem.md
lasomethingsomething f0e9e2f
Update sidebars.md
lasomethingsomething 82e1611
Update index.md
lasomethingsomething 44dd652
Update index.md
lasomethingsomething ded179b
Update index.md
lasomethingsomething 2b6c948
Update registerCmsBlock.md
lasomethingsomething 3bd481e
Update index.md
lasomethingsomething ab2cc5f
Update registerCmsBlock.md
lasomethingsomething bf68f2a
Update registerCmsElement.md
lasomethingsomething 650cc4d
Update registerCmsBlock.md
lasomethingsomething 61b679a
Update context.md
lasomethingsomething 54282bb
Update index.md
lasomethingsomething 13243c3
Update index.md
lasomethingsomething a3538a3
Update index.md
lasomethingsomething 14dd9b2
Update location.md
lasomethingsomething b939706
Merge branch 'main' into docs-changes-mar12
lasomethingsomething 5b4885b
Update migrating-admin-plugins.md
lasomethingsomething 16557d0
Update migrating-admin-plugins.md
lasomethingsomething 33b87cf
Update index.md
lasomethingsomething bb771a8
Update index.md
lasomethingsomething be116ed
Update index.md
lasomethingsomething 2e21e15
fixes api ref
lasomethingsomething 78a819e
docs: apply code suggestions for api-reference and concepts
gweiermann 103e6d5
docs: revise installation guides and index page
gweiermann 6e4fe12
docs: demote Usage/Parameters/Return/Example headings to h4
gweiermann 43ac5c3
docs: add context descriptions, fix develop index, improve toast/noti…
gweiermann 321a294
docs: fix broken link in translations.md
gweiermann b1ee186
docs: address review feedback on previous changes
gweiermann 259a932
docs: add getRepository docs, fix window import, add location availab…
gweiermann 01928f3
docs: resolve discussions and open questions from PR review
gweiermann 5ca87a1
docs: use info blocks for Shopware below 6.7 notes in plugin guide
gweiermann 1ee53bd
docs: flatten context.md hierarchy, fix develop nav, update resolved.md
gweiermann aca8098
docs: refine base-options intro example and use warning block
gweiermann 4e9d1a3
docs: add npm/cdn import tabs to all API reference pages, improve app…
gweiermann 72af6f8
docs: restructure landing pages, improve app installation guide
gweiermann 183e3da
docs: include app name in manifest sync warning
gweiermann 9356698
docs: show configureAppServer config, explicit manifest path, restore…
gweiermann 49a7a2f
docs: update toast documentation and fix header casing in mainModule …
gweiermann 741c5de
docs: move Notification and Toast pages into ui
gweiermann 82fc7e3
docs: remove section on using UI components from the Administration U…
gweiermann 9fff1cf
docs: enhance API documentation for base options, useRepository, useS…
gweiermann a519dab
docs: remove cdn alternative and only mention it in "without npm"
gweiermann 8d36b1a
docs: remove getRepository documentation and update references to use…
gweiermann 4027a96
docs: fix inconsistencies
gweiermann e4be5dc
docs: remove CDN usage section and streamline SDK usage instructions
gweiermann aab6a0a
docs: update installation guide for Meteor Admin SDK, add Vite setup …
gweiermann 225ab08
docs: update installation instructions for Meteor Admin SDK, add Vue …
gweiermann 933cf98
Merge remote-tracking branch 'origin/main' into pr-1075
gweiermann 1b20a85
docs: update code examples
davidtraum 9bc7c9b
chore: doc updates
davidtraum fd09877
chore: remove instruction
davidtraum b2b0587
chore: update installation-apps
davidtraum 31fd66b
chore: add description for clone behavior, remove semicolons, change …
davidtraum b31316f
chore: add SaaS mention to app advantages
davidtraum 928651d
chore: Add title prop to notification
davidtraum 42f9d59
Merge pull request #1109 from shopware/docs-changes-apr10
davidtraum f337219
Merge branch 'main' into docs-changes-mar12
davidtraum 501d16d
Merge branch 'main' into docs-changes-mar12
gweiermann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Agent Guidelines | ||
|
|
||
| When renaming or moving documentation files under `docs/admin-sdk/`, add redirect entries to `docs/admin-sdk/docs.yml` mapping old `.html` paths to new ones so the developer portal preserves external links. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # admin-sdk-docs | ||
| # Changelog | ||
|
|
||
| ## 1.0.0 | ||
|
|
||
|
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,89 @@ | ||
| # Base options | ||
| There are options that exist for every message type in the SDK. You'll find a list with all of them below. | ||
| # Base Options | ||
|
|
||
| | Name | Required | Default | Availability | Description | | ||
| | :----------- | :------- | :------------- | :------------------ | :---------------------------------------------------------------------------------------------- | | ||
| | `privileges` | false | | >= Shopware 6.6.3.0 | The privileges that will be checked before executing the message in the Shopware Administration | | ||
| Base options are shared configuration options that can be passed to SDK methods which accept a single payload object. They are provided as additional properties alongside the method's own parameters. | ||
|
|
||
| ## Example privileges | ||
| ```typescript | ||
| import * as sw from '@shopware-ag/meteor-admin-sdk'; | ||
| This applies to APIs such as `notification.dispatch()`, `toast.dispatch()`, many `ui.*` methods, `context.*`, `data.get()`, and `data.update()`. | ||
|
|
||
| // This notification will only be displayed if the user has `product:read` permissions. | ||
| sw.notification.dispatch({ | ||
| Higher-level data helpers such as `data.repository.*` and `data.subscribe()` currently use narrower method signatures and do not expose base options on their public API. | ||
|
|
||
| More options may be added in the future. Currently, the following option is available: | ||
|
|
||
| | Name | Required | Default | Availability | Description | | ||
| | :----------- | :------- | :------ | :------------------ | :----------------------------------------------------------------------------------------- | | ||
| | `privileges` | false | | >= Shopware 6.6.3.0 | Check the current user's privileges before executing the action. See [Privileges](#privileges). | | ||
|
|
||
| #### Usage | ||
|
|
||
| In this example, the base options are passed on the same object as the method-specific fields: | ||
|
|
||
| ```ts | ||
| import { notification } from '@shopware-ag/meteor-admin-sdk'; | ||
|
|
||
| notification.dispatch({ | ||
| title: 'Product report ready', | ||
| message: 'Your product report is ready', | ||
| /* ... base options ... */ | ||
| }); | ||
| ``` | ||
|
|
||
| ## Privileges | ||
|
|
||
| The `privileges` option accepts an array of privilege strings. When provided, the SDK checks whether the current Administration user holds all listed privileges before executing the action. If any privilege is missing, the action is silently skipped. | ||
|
|
||
| :::warning Not a security feature | ||
| Privilege checks happen client-side in the browser. They prevent UI elements from appearing for users who lack the required permissions, but they do not enforce access control on the server. Server-side authorization is still required for any sensitive operation. | ||
| ::: | ||
|
|
||
| #### Privilege string format | ||
|
|
||
| Each privilege string follows the pattern `action:entity`: | ||
|
|
||
| ``` | ||
| 'product:read' | ||
| 'order:update' | ||
| 'category:create' | ||
| 'customer:delete' | ||
| ``` | ||
|
|
||
| Available actions: | ||
|
|
||
| | Action | Description | | ||
| | :----------- | :----------------------------------- | | ||
| | `read` | Read access to the entity | | ||
| | `create` | Permission to create new entities | | ||
| | `update` | Permission to modify existing entities | | ||
| | `delete` | Permission to remove entities | | ||
| | `additional` | Custom additional privileges | | ||
|
|
||
| #### Usage | ||
|
|
||
| Pass the `privileges` array to any SDK method that supports base options: | ||
|
|
||
| ```ts | ||
| import { notification, ui } from '@shopware-ag/meteor-admin-sdk'; | ||
|
|
||
| notification.dispatch({ | ||
| title: 'Product report ready', | ||
| message: 'Your product report is ready', | ||
|
davidtraum marked this conversation as resolved.
|
||
| privileges: [ | ||
| 'product:read', | ||
| ], | ||
| }); | ||
|
|
||
| ui.actionButton.add({ | ||
| name: 'generate-report', | ||
| entity: 'product', | ||
| view: 'detail', | ||
| label: 'Generate Report', | ||
| privileges: [ | ||
| 'product:read', | ||
| 'order:read', | ||
| ], | ||
| }); | ||
| ``` | ||
|
|
||
| #### Parameters | ||
|
|
||
| | Name | Type | Required | Description | | ||
| | :----------- | :--------- | :------- | :-------------------------------------------------------------------------- | | ||
| | `privileges` | `string[]` | false | Array of `action:entity` strings. All must match for the action to execute. | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,15 @@ | ||
| --- | ||
| title: "CMS" | ||
| title: "Extending the CMS" | ||
| nav: | ||
| position: 300 | ||
| --- | ||
|
|
||
|
|
||
| # Extending the CMS | ||
|
|
||
| These CMS extension features allow extensions to register new CMS blocks and CMS elements for use in the Shopware Shopping Experiences editor. | ||
|
|
||
| Features in this section include: | ||
|
|
||
| - [Register CMS Block](./registerCmsBlock.md): Add custom CMS blocks that define layout structures in the Shopping Experiences editor. | ||
| - [Register CMS Element](./registerCmsElement.md): Create custom CMS elements that render content or functionality inside CMS blocks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
|
gweiermann marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 23 additions & 49 deletions
72
docs/admin-sdk/api-reference/composables/useRepository.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,45 @@ | ||
| --- | ||
| title: "useRepository" | ||
| nav: | ||
| position: 20 | ||
| --- | ||
|
|
||
| # useRepository | ||
|
|
||
| The `composables.useRepository` function is a reactive wrapper around the `getRepository` function. It creates a repository instance that automatically updates when its dependencies change. This is particularly useful when you need a repository that responds to reactive data changes in your Vue components. | ||
| The `composables.useRepository` function creates a reactive repository instance that automatically updates when its dependencies change. This is particularly useful when you need a repository that responds to reactive data changes in your Vue components. | ||
|
|
||
| `useRepository` accepts reactive references (refs) or values as parameters and returns a computed repository that updates when those parameters change. | ||
|
|
||
| Unlike `getRepository`, which returns a static repository instance, `useRepository` accepts reactive references (refs) or values as parameters and returns a computed repository that updates when those parameters change. | ||
| ## Usage | ||
|
|
||
| #### Usage: | ||
| ```ts | ||
| // Inside a Vue component setup | ||
| import { ref } from 'vue'; | ||
| import { composables } from '@shopware-ag/meteor-admin-sdk'; | ||
| import { ref } from "vue"; | ||
| import { composables } from "@shopware-ag/meteor-admin-sdk"; | ||
| const { useRepository } = composables; | ||
|
|
||
| // With a reactive entity name | ||
| const entityName = ref('product'); | ||
| const entityName = ref("product"); | ||
| const productRepository = useRepository(entityName); | ||
|
|
||
| // The repository updates automatically if entityName changes | ||
| entityName.value = 'category'; | ||
| entityName.value = "category"; | ||
| // Now productRepository.value references a category repository | ||
|
|
||
| // With a reactive repository factory | ||
| const myFactory = ref(customRepositoryFactory); | ||
| const repository = useRepository('product', myFactory); | ||
| // With a custom repository factory | ||
| const repository = useRepository("product", myRepositoryFactory); | ||
|
|
||
| // Search for products | ||
| const products = await repository.value.search(criteria); | ||
| ``` | ||
|
|
||
| ## Dynamic Repository Creation | ||
|
|
||
| The main advantage of `useRepository` is that it automatically recreates the repository when its inputs change: | ||
|
|
||
| 1. If the entity name changes, a new repository for the different entity type is created | ||
| 2. If the repository factory changes, a new repository using the different factory is created | ||
|
|
||
| This reactivity is implemented using Vue's computed properties, ensuring that the repository is only recreated when necessary. | ||
|
|
||
| #### Parameters | ||
| | Name | Required | Description | | ||
| |:--------------------|:---------|:----------------------------------------------------------------| | ||
| | `entityNameRef` | true | The name of the entity type as a ref or static value | | ||
| | `repositoryFactory` | false | Optional repository factory as a ref or static value | | ||
| ## Parameters | ||
|
|
||
| #### Return Value | ||
| A computed ref containing a repository that updates when its dependencies change. The repository provides the same methods as described in the `getRepository` documentation, but you need to access them through the `.value` property of the computed ref. | ||
| | Name | Required | Description | | ||
| | :------------------ | :------- | :--------------------------------------------------- | | ||
| | `entityNameRef` | true | The name of the entity type as a ref or static value | | ||
| | `repositoryFactory` | false | Optional repository factory as a ref or static value | | ||
|
|
||
| ## Relationship with getRepository | ||
|
|
||
| Under the hood, `useRepository` calls `getRepository` whenever its dependencies change. This means: | ||
|
|
||
| - It uses the same repository factory resolution logic as `getRepository` | ||
| - It provides the same repository interface and functionality | ||
| - It adds reactivity, automatically updating when inputs change | ||
|
|
||
| ```ts | ||
| // Example implementation (simplified) | ||
| import { computed } from 'vue'; | ||
| import { getRepository } from './getRepository'; | ||
|
|
||
| export function useRepository(entityNameRef, factoryRef) { | ||
| return computed(() => { | ||
| const entityName = unref(entityNameRef); | ||
| const factory = unref(factoryRef); | ||
|
|
||
| return getRepository(entityName, factory); | ||
| }); | ||
| } | ||
| ``` | ||
| ## Return value | ||
|
|
||
| This pattern follows Vue's composition API conventions, where composables prefixed with "use" typically provide reactive wrappers around non-reactive functionality. | ||
| A computed ref containing a repository that updates when its dependencies change. Access the repository methods through the `.value` property of the computed ref. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.