Skip to content

Commit

Permalink
Merge pull request #232 from AdobeDocs/kh_banner-notification
Browse files Browse the repository at this point in the history
Banner notifications and customer mass actions
  • Loading branch information
keharper authored Jun 28, 2024
2 parents 381b6cf + 0043ee8 commit a69d920
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ const remarkConfig = {
]
],
};
export default remarkConfig;
export default remarkConfig;
8 changes: 8 additions & 0 deletions src/data/navigation/sections/admin-ui-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ module.exports = [
title: "Extension points",
path: "/admin-ui-sdk/extension-points/index.md",
pages: [
{
title: "banner notification",
path: "/admin-ui-sdk/extension-points/banner-notification.md"
},
{
title: "customer",
path: "/admin-ui-sdk/extension-points/customer/index.md",
pages: [
{
title: "grid columns",
path: "/admin-ui-sdk/extension-points/customer/grid-columns.md"
},
{
title: "mass action",
path: "admin-ui-sdk/extension-points/customer/mass-actions.md"
}
]
},
Expand Down
86 changes: 86 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/banner-notification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: bannerNotification
description: Create a banner notification mass action in the Adobe Commerce Admin.
keywords:
- App Builder
- Extensibility
---

# bannerNotification

The `bannerNotification` extension point defines the contents of banner notifications that display when customizing a mass action or order view button.

## Example mass action customizations

The following example defines success and error messages for multiple mass actions.

```javascript
bannerNotification: {
getMassActions() {
return {
order: [
{
actionId: `${extensionId}::mass-action`,
successMessage: 'Selected orders were updated successfully',
errorMessage: 'App could not proceed with mass action on selected orders'
}
],
product: [
{
actionId: `${extensionId}::mass-action`,
successMessage: 'Selected products were updated successfully',
errorMessage: 'App could not proceed with mass action on selected products'
}
],
customer: [
{
actionId: `${extensionId}::mass-action`,
successMessage: 'Selected customers were updated successfully',
errorMessage: 'App could not proceed with mass action on selected customers'
}
]
}
}
}
```

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
`customer.actionId` | Yes | The `actionId` of a customer mass action.
where banner notification will be customized. It should be the same one that is defined in the customer mass action extension point.
`customer.successMessage` | No | The success message to display when mass action is successful. A default message is displayed if this parameter is not defined.
`customer.errorMessage` | No | The error message to display when mass action fails. A default message is displayed if this parameter is not defined.
`order.actionId` | string | Yes | The `actionId` of an [order mass action](./order/mass-action.md).
`order.successMessage` | No | The success message to display when mass action is successful. A default message is displayed if this parameter is not defined.
`order.errorMessage` | No | The error message to display when mass action fails. A default message is displayed if this parameter is not defined.
`product.actionId` | Yes | The `actionId` of a [product mass action](./product/mass-action.md).
`product.successMessage` | No | The success message to display when mass action is successful. A default message is displayed if this parameter is not defined.
`product.errorMessage` | No | The error message to display when mass action fails. A default message is displayed if this parameter is not defined.

## Example order view button customization

The following example defines success and error messages for a custom order view button.

```javascript
bannerNotification: {
getOrderViewButtons() {
return [
{
buttonId: 'order-custom-view-button::create-return',
successMessage: 'Order View Button Success',
errorMessage: 'Order View Button Error'
}
]
}
}
```

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
`buttonId` | Yes | A `buttonId` defined in an order view button extension point.
`successMessage` | No | The success message to display when the view button notification is successful. A default message is displayed if this parameter is not defined.
`errorMessage` | No | The error message to display when the view button notification fails. A default message is displayed if this parameter is not defined.
62 changes: 62 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/customer/mass-action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: mass action
description: Customize the customer grid mass action in the Adobe Commerce Admin.
keywords:
- App Builder
- Extensibility
---

# customer mass action

The `customer mass action` extension point customizes customer grid mass actions in the Adobe Commerce Admin.

## Example customization​

The following example creates mass actions labeled `First App Mass Action` and `Another Mass Action`. The `extensionId` value matches the ID specified at [app registration](../../app-registration.md).

The `path` parameter specifies where to redirect an action. The Admin UI SDK provides the selected product IDs in a [`sharedContext`](../index.md#shared-contexts) when a merchant selects a mass action. Your implementation must read the selected items from the `sharedContext`.

```javascript
customer: {
getMassActions() {
return [
{
actionId: `${extensionId}::first-mass-action`,
label: 'First App Mass Action',
confirm: {
title: 'First App Mass Action',
message: 'Are you sure your want to proceed with First App Mass Action on selected customers?'
},
path: '#/first-mass-action',
customerSelectLimit: 1
},
{
actionId: `${extensionId}::another-first-mass-action`,
label: 'Another Mass Action',
title: 'Another Customers Mass Action',
path: '#/another-mass-action'
},
{
actionId: `${extensionId}::mass-action`,
label: 'Mass Action',
path: '#/mass-action',
displayIframe: false
}
]
}
}
```

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `actionId` | string | Yes | A unique ID assigned to the action. The recommended format is `<extensionId>::<actionName>`. |
| `confirm.message` | string | No | The message displayed on the confirmation dialog for a mass action. |
| `confirm.title` | string | No | The title of a dialog that confirms the mass action. |
| `label` | string | Yes | The name of the action to display. |
| `title` | string | No | An optional page title for the action. If not specified, the label is used.
| `path` | string | Yes | The relative path in the application to redirect to the action. You might need to prepend `#/` to the path to ensure access to the correct page. |
| `customerSelectLimit` | integer | No | Set the maximum number of customers that can be selected for a mass action. By default, the number is unlimited. |
| `displayIframe` | boolean | No | Indicates whether an iFrame will be displayed at the relative path. The default value is `true`. [Mass actions without iFrames](../index.md#mass-actions-without-iframes) provides additional details. |
| `timeout` | integer | No | Only relevant when `displayIframe` is set to `false`. Timeout by seconds to the request sent to application. Default value is 10 seconds. |
6 changes: 5 additions & 1 deletion src/pages/admin-ui-sdk/extension-points/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ keywords:

This section describes how to use existing extension points in any Adobe Developer App Builder application that customizes Adobe Commerce Admin.

The [Adobe Commerce Samples repository](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk) contains samples for different extension points of the Adobe Commerce Admin UI SDK. Use these samples to gain insight on how the Admin SDK injects menus and pages into the Admin.

## Shared contexts

The `sharedContext` constant contains a set of selected IDs, the Commerce base URL, and an IMS token, as shown below. It is available only when a mass action is selected in the Commerce Admin.
The `sharedContext` constant is available only when a mass action, menu, or order view button performs a redirection to an iFrame page. For mass actions, `sharedContext` contains a set of selected IDs, the Commerce base URL, the client ID, and an IMS token, as shown below. For menus and order view buttons, `sharedContext` contains only an IMS token.

```js
const sharedContext = {
Expand Down Expand Up @@ -45,6 +47,8 @@ When a mass action `displayIframe` parameter is set to `false`, you must account

### Mass action request headers

Use the following request headers when you perform a mass action without implementing an iFrame.

| Header | Description |
| --- | --- |
| `X-Request-ID` | A unique UUID v4 generated when the request is sent as a unique identifier. |
Expand Down
6 changes: 6 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ keywords:

The `menu` extension point creates a new menu that redirects to the App Builder app.

When you implement a menu that uses an iFrame, use a [`sharedContext`](../index.md#shared-contexts) to read the IMS token.

## Example customization

The following example creates the **Apps** > **First App on App Builder** menu option.
Expand Down Expand Up @@ -43,3 +45,7 @@ The following example creates the **Apps** > **First App on App Builder** menu o
| `parent` | string | No | The parent menu. |
| `sortOrder` | integer | No | The position of the menu, relative to other menus in the section. A value of `1` indicates the menu will be listed first. If this parameter is not specified, it will be placed randomly.
| `title` | string | No | The title to display. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize a [menu](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/menu/custom-menu).
4 changes: 4 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/order/grid-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ This sample `schema.json` file is referenced in the mesh configuration file. It
| `properties.columnId` | string | Yes | The identifier used in the external dataset to identify the column. |
| `properties.label` | string | Yes | The label of the column to display. |
| `properties.type` | string | Yes | The data type of the values in the column. Supported values: `boolean`, `date`, `float`, `integer`, `string`. Date values must be ISO 8601-compliant. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize [order grid columns](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/order/custom-grid-columns).
4 changes: 4 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/order/mass-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ order: {
| `orderSelectLimit` | integer | No | Set the maximum number of orders that can be selected for a mass action. By default, the number is unlimited. |
| `displayIframe` | boolean | No | Indicates whether an iFrame will be displayed at the relative path. The default value is `true`. [Mass actions without iFrames](../index.md#mass-actions-without-iframes) provides additional details. |
| `timeout` | integer | No | Only relevant when `displayIframe` is set to `false`. Timeout by seconds to the request sent to application. Default value is 10 seconds. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize the [order mass action](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/order/custom-mass-action).
4 changes: 4 additions & 0 deletions src/pages/admin-ui-sdk/extension-points/order/view-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ order: {
| `path` | string | Yes | The relative path to the button page in the App. The order ID will be sent as part of the query. |
| `level` | integer | No | The position in which a set of buttons are placed in the toolbar. The possible values are `-1` (left), `0` (center), and `1` (right). |
| `sortOrder` | integer | No | The order in which the button is placed inside the level. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize the [order view button](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/order/custom-view-button).
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ This sample `schema.json` file is referenced in the mesh configuration file. It
| `properties.columnId` | string | Yes | The identifier used in the external dataset to identify the column. |
| `properties.label` | string | Yes | The label of the column to display. |
| `properties.type` | string | Yes | The data type of the values in the column. Supported values: `boolean`, `date`, `float`, `integer`, `string`. Date values must be ISO 8601-compliant. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize [product grid columns](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/product/custom-grid-columns).
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ product: {
| `productSelectLimit` | integer | No | Set the maximum number products that can be selected for a mass action. By default, the number is unlimited. |
| `displayIframe` | boolean | No | Indicates whether an iFrame will be displayed at the relative path. The default value is `true`. [Mass actions without iFrames](../index.md#mass-actions-without-iframes) provides additional details. |
| `timeout` | integer | No | Only relevant when `displayIframe` is set to `false`. The number of seconds to wait for a response to a request sent to the application. Default value is 10 seconds. |

## Sample code

The Adobe Commerce Extensibility Code Samples repository demonstrates how to customize the [product mass action](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk/product/custom-mass-action).
4 changes: 4 additions & 0 deletions src/pages/admin-ui-sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ The SDK contains two main components that are necessary for development:
The following sequence diagram illustrates the authentication process.

![Sequence diagram](../_images/admin-ui-sequence-diagram.png)

## Code samples

The [Adobe Commerce Samples repository](https://github.com/adobe/adobe-commerce-samples/tree/main/admin-ui-sdk) contains samples for different extension points of the Adobe Commerce Admin UI SDK. Use these samples to gain insight on how the Admin SDK injects menus and pages into the Admin.
11 changes: 7 additions & 4 deletions src/pages/admin-ui-sdk/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ keywords:

### Release date

March 21, 2024
June 28, 2024

### Enhancements

* Added the [`customer grid columns` extension point](./extension-points/customer/grid-columns.md). <!--- CEXT-2867 -->
* Added the following extension points:

* Added the [`order get custom fees` extension point](./extension-points/order/custom-fees.md). <!--- CEXT-2733 -->
* [`banner notification`](./extension-points/banner-notification.md)
* [`customer grid columns`](./extension-points/customer/grid-columns.md) <!--- CEXT-2867 -->
* [`customer mass action`](./extension-points/customer/mass-action.md)
* [`order get custom fees`](./extension-points/order/custom-fees.md) <!--- CEXT-2733 -->

* Mass actions can now be implemented [without an iFrame](./extension-points/index.md#mass-actions-without-iframes). <!--- CEXT-2590, CEXT-2825, CEXT-2932, CEXT-2903 -->

* Added the `GET V1/adminuisdk/massaction/<requestId>` REST API to debug mass action failures.
* Added the `GET V1/adminuisdk/massaction/<requestId>` [REST API](./extension-points/index.md#connection-interruption-failures) to debug mass action failures.

* Added the **Refresh registrations** button to the configuration page. This button allows the administrator to refresh the `admin_ui_sdk` cache and reload all extensions. <!--- CEXT-2642 -->

Expand Down

0 comments on commit a69d920

Please sign in to comment.