Skip to content

Commit

Permalink
Merge branch 'dx-478/png-mmd-svg' of https://github.com/shopware/docs
Browse files Browse the repository at this point in the history
…into dx-478/png-mmd-svg
  • Loading branch information
sushmangupta committed Jan 25, 2024
2 parents 97f8453 + f1d2918 commit 54087cd
Show file tree
Hide file tree
Showing 25 changed files with 338 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: reviewdog/action-languagetool@v1
with:
level: warning
language: en-US
reporter: github-pr-check
enabled_rules: 'PASSIVE_VOICE,SENTENCE_WHITESPACE,GOD_COMMA'
#disabled_rules: 'WHITESPACE_RULE,EN_QUOTES,DASH_RULE,WORD_CONTAINS_UNDERSCORE,UPPERCASE_SENTENCE_START,ARROWS,COMMA_PARENTHESIS_WHITESPACE,UNLIKELY_OPENING_PUNCTUATION,SENTENCE_WHITESPACE,CURRENCY,EN_UNPAIRED_BRACKETS,PHRASE_REPETITION,PUNCTUATION_PARAGRAPH_END,METRIC_UNITS_EN_US,ENGLISH_WORD_REPEAT_BEGINNING_RULE,ENGLISH_WORD_REPEAT_RULE'
5 changes: 0 additions & 5 deletions .vscode/extensions.json

This file was deleted.

7 changes: 0 additions & 7 deletions .vscode/ltex.dictionary.en-US.txt

This file was deleted.

9 changes: 7 additions & 2 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AddressBookWidget
AddressDetailPage
AddressListingPage
Adminer
AdminExtensionSDK
MeteorAdminSDK
AdministrationNewField
AdministrationNewModule
AdminQueueWorker
Expand Down Expand Up @@ -1217,6 +1217,8 @@ sandboxed
sarven
scalability
scalable
ScalarValuesAware
ScalarValuesStorer
ScheduledTask
schemas
ScriptEventRegistry
Expand Down Expand Up @@ -1607,4 +1609,7 @@ NewRelic
OTEL
otel
otlp
grpc
grpc
B2B Component
B2B Suite
B2B Components
152 changes: 146 additions & 6 deletions concepts/commerce/checkout-concept/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,154 @@ The order state changes in a defined, predictable and configurable way - other s

## State management

During the order placement, at least three distinct state machines are started as described in the below diagrams:

![The order state machine](../../../assets/checkout-orderState.svg)
![The order transaction state machine](../../../assets/checkout-orderTransactionState.svg)
![The order delivery state machine](../../../assets/checkout-orderDeliveryState.svg)

::: tip
The state machines displayed in the following sections can actually be modified through the API, this is just the default setup.
:::

During the order placement, at least three distinct state machines are started as described in the below diagrams.

These can be used to track the progress during the order process and notify the customer about the current state of the order.

**The order state machine**

```mermaid
flowchart TD
START_STATE[Start state] --> 018c4a0eeaec71b7a0415b572e1a07f5
018c4a0eeaec71b7a0415b572e1a07f5(Open)
018c4a0eeaec71b7a0415b572e8c7a86(Done)
018c4a0eeaec71b7a0415b572e8c7a86 --> FINAL_STATE[Final state]
018c4a0eeaec71b7a0415b572f6990c5(In Progress)
018c4a0eeaec71b7a0415b572fa73aa1(Cancelled)
018c4a0eeaec71b7a0415b572fa73aa1 --> FINAL_STATE[Final state]
018c4a0eeaec71b7a0415b572e1a07f5 -- process --> 018c4a0eeaec71b7a0415b572f6990c5
018c4a0eeaec71b7a0415b572e1a07f5 -- cancel --> 018c4a0eeaec71b7a0415b572fa73aa1
018c4a0eeaec71b7a0415b572f6990c5 -- cancel --> 018c4a0eeaec71b7a0415b572fa73aa1
018c4a0eeaec71b7a0415b572f6990c5 -- complete --> 018c4a0eeaec71b7a0415b572e8c7a86
018c4a0eeaec71b7a0415b572fa73aa1 -- reopen --> 018c4a0eeaec71b7a0415b572e1a07f5
018c4a0eeaec71b7a0415b572e8c7a86 -- reopen --> 018c4a0eeaec71b7a0415b572e1a07f5
```

**The order transaction state machine**

```mermaid
flowchart TD
START_STATE[Start state] --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b74f5895f(Open)
018c4a0eeba171db8f885b1b75b3a3e3(Paid)
018c4a0eeba171db8f885b1b760cc537(Paid partially)
018c4a0eeba171db8f885b1b76166310(Cancelled)
018c4a0eeba171db8f885b1b76cb7f9c(Reminded)
018c4a0eeba171db8f885b1b77a3112c(Refunded)
018c4a0eeba171db8f885b1b77a3112c --> FINAL_STATE[Final state]
018c4a0eeba171db8f885b1b7833adb3(Refunded partially)
018c4a0eff2670648f1f92d85efca4dd(In Progress)
018c4a0eff2670648f1f92d85f9cd806(Failed)
018c4a0f109d7034995df01ceddd9b6a(Authorized)
018c4a0f10bc7230939f1a53ffc3ad22(Chargeback)
018c4a0f2f00710bb4227243818b33ad(Unconfirmed)
018c4a0eeba171db8f885b1b74f5895f -- pay --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eeba171db8f885b1b74f5895f -- pay_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eeba171db8f885b1b74f5895f -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b74f5895f -- remind --> 018c4a0eeba171db8f885b1b76cb7f9c
018c4a0eeba171db8f885b1b76cb7f9c -- pay --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eeba171db8f885b1b76cb7f9c -- pay_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eeba171db8f885b1b76cb7f9c -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b760cc537 -- remind --> 018c4a0eeba171db8f885b1b76cb7f9c
018c4a0eeba171db8f885b1b760cc537 -- pay --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eeba171db8f885b1b760cc537 -- refund_partially --> 018c4a0eeba171db8f885b1b7833adb3
018c4a0eeba171db8f885b1b760cc537 -- refund --> 018c4a0eeba171db8f885b1b77a3112c
018c4a0eeba171db8f885b1b760cc537 -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b75b3a3e3 -- refund_partially --> 018c4a0eeba171db8f885b1b7833adb3
018c4a0eeba171db8f885b1b75b3a3e3 -- refund --> 018c4a0eeba171db8f885b1b77a3112c
018c4a0eeba171db8f885b1b75b3a3e3 -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b7833adb3 -- refund --> 018c4a0eeba171db8f885b1b77a3112c
018c4a0eeba171db8f885b1b7833adb3 -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b76166310 -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b76166310 -- refund --> 018c4a0eeba171db8f885b1b77a3112c
018c4a0eeba171db8f885b1b76166310 -- refund_partially --> 018c4a0eeba171db8f885b1b7833adb3
018c4a0eff2670648f1f92d85efca4dd -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eff2670648f1f92d85efca4dd -- fail --> 018c4a0eff2670648f1f92d85f9cd806
018c4a0eff2670648f1f92d85efca4dd -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eff2670648f1f92d85efca4dd -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eff2670648f1f92d85efca4dd -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eff2670648f1f92d85efca4dd -- pay_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eff2670648f1f92d85f9cd806 -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eff2670648f1f92d85f9cd806 -- do_pay --> 018c4a0eff2670648f1f92d85efca4dd
018c4a0eff2670648f1f92d85f9cd806 -- pay --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eff2670648f1f92d85f9cd806 -- fail --> 018c4a0eff2670648f1f92d85f9cd806
018c4a0eff2670648f1f92d85f9cd806 -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eff2670648f1f92d85f9cd806 -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eff2670648f1f92d85f9cd806 -- pay_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eeba171db8f885b1b74f5895f -- do_pay --> 018c4a0eff2670648f1f92d85efca4dd
018c4a0eeba171db8f885b1b74f5895f -- fail --> 018c4a0eff2670648f1f92d85f9cd806
018c4a0eeba171db8f885b1b76cb7f9c -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b76cb7f9c -- do_pay --> 018c4a0eff2670648f1f92d85efca4dd
018c4a0eeba171db8f885b1b760cc537 -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b760cc537 -- do_pay --> 018c4a0eff2670648f1f92d85efca4dd
018c4a0eeba171db8f885b1b75b3a3e3 -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b7833adb3 -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
018c4a0eeba171db8f885b1b74f5895f -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eeba171db8f885b1b74f5895f -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0eff2670648f1f92d85efca4dd -- authorize --> 018c4a0f109d7034995df01ceddd9b6a
018c4a0eeba171db8f885b1b74f5895f -- authorize --> 018c4a0f109d7034995df01ceddd9b6a
018c4a0eeba171db8f885b1b76cb7f9c -- authorize --> 018c4a0f109d7034995df01ceddd9b6a
018c4a0f109d7034995df01ceddd9b6a -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0f109d7034995df01ceddd9b6a -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0f109d7034995df01ceddd9b6a -- fail --> 018c4a0eff2670648f1f92d85f9cd806
018c4a0f109d7034995df01ceddd9b6a -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b75b3a3e3 -- chargeback --> 018c4a0f10bc7230939f1a53ffc3ad22
018c4a0eeba171db8f885b1b760cc537 -- chargeback --> 018c4a0f10bc7230939f1a53ffc3ad22
018c4a0f10bc7230939f1a53ffc3ad22 -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0f10bc7230939f1a53ffc3ad22 -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0f10bc7230939f1a53ffc3ad22 -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0eeba171db8f885b1b76166310 -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0eeba171db8f885b1b74f5895f -- process_unconfirmed --> 018c4a0f2f00710bb4227243818b33ad
018c4a0eeba171db8f885b1b76cb7f9c -- process_unconfirmed --> 018c4a0f2f00710bb4227243818b33ad
018c4a0eff2670648f1f92d85f9cd806 -- process_unconfirmed --> 018c4a0f2f00710bb4227243818b33ad
018c4a0eeba171db8f885b1b76166310 -- process_unconfirmed --> 018c4a0f2f00710bb4227243818b33ad
018c4a0eeba171db8f885b1b760cc537 -- process_unconfirmed --> 018c4a0f2f00710bb4227243818b33ad
018c4a0f2f00710bb4227243818b33ad -- paid --> 018c4a0eeba171db8f885b1b75b3a3e3
018c4a0f2f00710bb4227243818b33ad -- paid_partially --> 018c4a0eeba171db8f885b1b760cc537
018c4a0f2f00710bb4227243818b33ad -- fail --> 018c4a0eff2670648f1f92d85f9cd806
018c4a0f2f00710bb4227243818b33ad -- cancel --> 018c4a0eeba171db8f885b1b76166310
018c4a0f2f00710bb4227243818b33ad -- authorize --> 018c4a0f109d7034995df01ceddd9b6a
018c4a0f2f00710bb4227243818b33ad -- reopen --> 018c4a0eeba171db8f885b1b74f5895f
```

**The order delivery state machine**

```mermaid
flowchart TD
START_STATE[Start state] --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1d89ef09(Open)
018c4a0eeb3872679d76fd8c1df019d8(Cancelled)
018c4a0eeb3872679d76fd8c1df019d8 --> FINAL_STATE[Final state]
018c4a0eeb3872679d76fd8c1eceaecb(Shipped)
018c4a0eeb3872679d76fd8c1ef13dd7(Shipped partially)
018c4a0eeb3872679d76fd8c1f8af9a3(Returned)
018c4a0eeb3872679d76fd8c1f8af9a3 --> FINAL_STATE[Final state]
018c4a0eeb3872679d76fd8c1fd26398(Returned partially)
018c4a0eeb3872679d76fd8c1d89ef09 -- ship --> 018c4a0eeb3872679d76fd8c1eceaecb
018c4a0eeb3872679d76fd8c1d89ef09 -- ship_partially --> 018c4a0eeb3872679d76fd8c1ef13dd7
018c4a0eeb3872679d76fd8c1d89ef09 -- cancel --> 018c4a0eeb3872679d76fd8c1df019d8
018c4a0eeb3872679d76fd8c1eceaecb -- retour --> 018c4a0eeb3872679d76fd8c1f8af9a3
018c4a0eeb3872679d76fd8c1eceaecb -- retour_partially --> 018c4a0eeb3872679d76fd8c1fd26398
018c4a0eeb3872679d76fd8c1eceaecb -- cancel --> 018c4a0eeb3872679d76fd8c1df019d8
018c4a0eeb3872679d76fd8c1ef13dd7 -- retour --> 018c4a0eeb3872679d76fd8c1f8af9a3
018c4a0eeb3872679d76fd8c1ef13dd7 -- retour_partially --> 018c4a0eeb3872679d76fd8c1fd26398
018c4a0eeb3872679d76fd8c1ef13dd7 -- ship --> 018c4a0eeb3872679d76fd8c1eceaecb
018c4a0eeb3872679d76fd8c1ef13dd7 -- cancel --> 018c4a0eeb3872679d76fd8c1df019d8
018c4a0eeb3872679d76fd8c1df019d8 -- reopen --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1eceaecb -- reopen --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1ef13dd7 -- reopen --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1f8af9a3 -- reopen --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1fd26398 -- reopen --> 018c4a0eeb3872679d76fd8c1d89ef09
018c4a0eeb3872679d76fd8c1fd26398 -- retour --> 018c4a0eeb3872679d76fd8c1f8af9a3
```
126 changes: 126 additions & 0 deletions guides/integrations-api/general-concepts/partial-data-loading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
nav:
title: Partial Data Loading
position: 50

---

# Partial Data Loading

`Partial data loading` allows you to select specific fields of an entity to be returned by the API. This can be useful if you only need a few fields of an entity and don't want to load the whole entity. This can reduce the response size and improve the performance of your application.

### Partial data loading vs Includes

`Partial data loading` is different from the [includes](./search-criteria.md#includes-apialias) feature. The `includes` works as post-output processing, so the complete entity or data is loaded in the backend side and then filtered, while `partial data loading` works already on database level. This means that the database only loads the requested fields and not the whole entity.

## Usage

```http
POST /api/search/currency
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Accept: application/json
{
"fields": [
"name"
]
}
```

```json
// response
{
"total": 1,
"data": [
{
"extensions": [],
"_uniqueIdentifier": "018cda3ac909712496bccc065acf0ff4",
"translated": {
"name": "US-Dollar"
},
"id": "018cda3ac909712496bccc065acf0ff4",
"name": "US-Dollar",
"isSystemDefault": false,
"apiAlias": "currency"
}
],
"aggregations": []
}
```

Fields can also reference fields of associations like in this example the assigned salesChannel names of the currency. The API adds the necessary associations automatically.

```http
POST /api/search/currency
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Accept: application/json
{
"fields": [
"name",
"salesChannels.name"
]
}
```

```json
// response
{
"total": 1,
"data": [
{
"extensions": [],
"_uniqueIdentifier": "018cda3ac909712496bccc065acf0ff4",
"translated": {
"name": "US-Dollar"
},
"id": "018cda3ac909712496bccc065acf0ff4",
"name": "US-Dollar",
"salesChannels": [
{
"extensions": [],
"_uniqueIdentifier": "018cda3af56670d6a3fa515a85967bd2",
"translated": {
"name": "Storefront"
},
"id": "018cda3af56670d6a3fa515a85967bd2",
"name": "Storefront",
"apiAlias": "sales_channel"
}
],
"isSystemDefault": false,
"apiAlias": "currency"
}
],
"aggregations": []
}
```

## Default fields

Some fields are always loaded like the `id` or join relevant fields like foreign keys, these are necessary for the API to work correctly and can't be removed.

## Runtime fields

Some fields in the API are generated at runtime like `isSystemDefault` of the currency. These fields are loaded by default when the referenced data is available, otherwise they can be requested in the `fields` parameter to force the API to load them.

For custom entity definitions with runtime flag, the referenced fields need to be specified inside the constructor. See an example from the core:

```php
protected function defineFields(): FieldCollection
{
return new FieldCollection([
(new IdField('id', 'id'))->addFlags(new ApiAware(), new PrimaryKey(), new Required()),
(new StringField('path', 'path'))->addFlags(new ApiAware()),

// When this field is requested, we need the data of path field to generate the url
(new StringField('url', 'url'))->addFlags(new ApiAware(), new Runtime(['path'])),
]);
}
```

## Limitations

The current limitation of the `partial data loading` is that it only works on the Entity level. Any custom responses like a product detail page or CMS in the Store API can't be used with this feature, as the Store API needs the whole entity to generate the response. If you need a small response, we recommend using the [includes](./search-criteria.md#includes-apialias) feature of the Search API.
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ POST /api/search/product

## sw-app-integration-id

The `sw-app-integration-id` enables seamless connection and data exchange between different software components. This header is required for correct permission checks performed by the backend when fetching or manipulating data. It overrides the default behavior and uses the privileges provided by the app. This is used in the Admin Extension SDK for the [Repository Data Handling](https://shopware.github.io/admin-extension-sdk/docs/guide/api-reference/data/repository). But the developer itself doesn’t need to care about it because it is handled automatically by the admin.
The `sw-app-integration-id` enables seamless connection and data exchange between different software components. This header is required for correct permission checks performed by the backend when fetching or manipulating data. It overrides the default behavior and uses the privileges provided by the app. This is used in the Meteor Admin SDK for the [Repository Data Handling](https://shopware.github.io/meteor-admin-sdk/docs/guide/api-reference/data/repository). But the developer itself doesn’t need to care about it because it is handled automatically by the admin.
8 changes: 4 additions & 4 deletions guides/plugins/apps/starter/starter-admin-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SimpleNotification/
<!doctype html>
<html>
<head>
<script src="https://unpkg.com/@shopware-ag/admin-extension-sdk/cdn"></script>
<script src="https://unpkg.com/@shopware-ag/meteor-admin-sdk/cdn"></script>
</head>
<script>
sw.notification.dispatch({
Expand All @@ -96,7 +96,7 @@ SimpleNotification/
This file contains the basic setup for our app to display the notification:

* The HTML is rendered in a hidden iFrame when the Administration panel is loaded.
* The Admin Extension SDK script is loaded through a CDN and exposed as the `sw` object.
* The Meteor Admin SDK script is loaded through a CDN and exposed as the `sw` object.
* We use the `notification.dispatch` SDK method to display a simple notification with a title and a message.

### Start the local development server
Expand Down Expand Up @@ -157,6 +157,6 @@ When the app is successfully installed, you will see the notification pop up onc

This example showed end-to-end how to create a local dev environment and connect it with your Shopware Store. There is a lot more to learn and try out, so why not move on with one of those topics:

* Did you know, you can add [new sections](https://shopware.github.io/admin-extension-sdk/docs/guide/api-reference/ui/component-section) to the UI or even [entire modules](https://shopware.github.io/admin-extension-sdk/docs/guide/api-reference/ui/mainModule)?
* The Admin Extension SDK also offers [TypeScript support](https://shopware.github.io/admin-extension-sdk/docs/guide/getting-started/installation#using-npm-require-bundling) (including autocompletion)
* Did you know, you can add [new sections](https://shopware.github.io/meteor-admin-sdk/docs/guide/api-reference/ui/component-section) to the UI or even [entire modules](https://shopware.github.io/meteor-admin-sdk/docs/guide/api-reference/ui/mainModule)?
* The Meteor Admin SDK also offers [TypeScript support](https://shopware.github.io/meteor-admin-sdk/docs/guide/getting-started/installation#using-npm-require-bundling) (including autocompletion)
* Don't want to extend the admin panel? Have a look at [App Scripts](/docs/guides/plugins/apps/app-scripts/index.md)
Loading

0 comments on commit 54087cd

Please sign in to comment.