You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/extensions/ui-extensions.md
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,8 +247,6 @@ For `pim.category.tab` position, this parameter is sent:
247
247
248
248
#### Get PIM data from the iframe
249
249
250
-
**PostMessage**
251
-
252
250
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.
253
251
254
252
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 :
309
307
```
310
308
After receiving this *event*, the PIM will send a PostMessage *event*, similar to the one sent after the iframe loading.
311
309
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
+
312
335
#### Ensuring security of embedded iframes
313
336
314
337
To help ensuring the security of iframes we recommand using these two solutions:
0 commit comments