How to detect when a user selects a material in the default Shapespark material picker palette?

Hi Shapespark team,

I’m customizing a Shapespark scene embedded in an iframe, and I have a requirement to synchronize the material selection the user makes in the default Shapespark palette with my external UI.

Specifically, I would like to:
:white_check_mark: Detect when a user clicks a material sphere in the default material picker (the palette that appears when an editable material is clicked).
:white_check_mark: Get information about which material was selected and to which mesh/node it was applied.
:white_check_mark: Send this information to the parent window (outside the iframe) to keep the dropdown and thumbnails in sync.

I have reviewed the Viewer API documentation, but I don’t see any documented event like viewer.onMaterialClicked() or similar.

Questions:

  1. Is there any official way to get a callback when the user selects a material in the default material picker?
  2. If not, is there any supported workaround to track or override this behavior?

Any guidance or examples would be greatly appreciated.

Thank you!

There is no official way to do it, but as a workaround you can use the method described in Material Picker on which extension? - #3 by Clinton_James

To send information from the iframe to the parent webpage, and back, you can use the postMessage API, as explained in Configurator Commands - #10 by jan.