I can select a layer/node inside a widget by expanding the widget layers in the sidebar, I can get the nodeId by typing figma.currentPage.selection[0].id in console but I cannot find the same layer using figma.getNodeById().
I have a frame in my widget where a user can paste other nodes inside it and I want to save this data on WidgetNode using setSharedPluginData. Can anyone explain how can I do it?
If you insert a widget into a design file, you can view widget sublayers in the layers panel. This allows you to select individual layers and adjust their properties.
You can only view layers and adjust properties for widgets that are still in development. You can’t do this with published versions of the widget. Prototyping Widget UI | Widget API
Use setSharedPluginData directly on the WidgetNode.