Skip to content

Commit def30c1

Browse files
Merge pull request #1046 from akeneo/DXIM-18
DXIM-18 - add doc about context change
2 parents a103ef7 + e8235cd commit def30c1

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

content/extensions/ui-extensions.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,6 @@ For `pim.category.tab` position, this parameter is sent:
247247

248248
#### Get PIM data from the iframe
249249

250-
**PostMessage**
251-
252250
To be able to communicate the products or product models selection (from position `pim.product-grid.action-bar`) to the iframe, we use the [PostMessage](https://developer.mozilla.org/docs/Web/API/Window/postMessage) protocol.
253251

254252
After the iframe is loaded, the PIM send an *event* which is a normalized message [MessageEvent](https://developer.mozilla.org/docs/Web/API/MessageEvent) with a field `data` containing our information.
@@ -309,6 +307,31 @@ Example :
309307
```
310308
After receiving this *event*, the PIM will send a PostMessage *event*, similar to the one sent after the iframe loading.
311309

310+
#### Product and product model context change
311+
312+
The **PIM context** is propagated within the iframe when it changes using **postmessage**. This only applies to the product and product model positions: **pim.product-model.header**, **pim.sub-product-model.header** and **pim.product.header**.
313+
314+
The message contains :
315+
- A `context` object containing the selected `locale` and `channel`.
316+
- A `user` object containing the `username` and `groups` of the connected user.
317+
318+
Example :
319+
```json
320+
{
321+
"context": {
322+
"locale": "en_US",
323+
"channel": "ecommerce"
324+
},
325+
"user": {
326+
"username": "admin",
327+
"groups": [
328+
"IT support",
329+
"All"
330+
]
331+
}
332+
}
333+
```
334+
312335
#### Ensuring security of embedded iframes
313336

314337
To help ensuring the security of iframes we recommand using these two solutions:

0 commit comments

Comments
 (0)