Does WRM.data.claim(DATA_KEY) work for a web-resource with scope=editor?

I have a Confluence Server/DC plugin that implements some macros and I want to pass data from the server to the UI for a macro editor.

I have added a simple data provider to a web-resource for my macro editor… BUT the data is undefined when I try to get it in the UI code with WRM.data.claim(DATA_KEY)

I am following the instructions in the docs: https://developer.atlassian.com/server/framework/atlassian-sdk/adding-data-providers-to-your-plugin/#consuming-a-data-provider

I already have working JavaScript to customize the macro editor, it has worked for years, now I want to add some logic that depends on an admin configuration setting for my macro.

I followed the instructions in the docs and the only significant difference I see between my use-case and the sample in the docs is that the sample is a web-resource in context=atl.general and mine is in context=editor.

I have double checked the key used in my WRM.data.claim(DATA_KEY) and it looks right to me. No matter what I use for the key I get undefined from the claim() call.

Has anyone ever used a data provider in their Confluence plugin, in a web-resource with context=editor (a macro editor)? The context is configured like this, in the <web-resource> element in your atlassian-plugin.xml: <context>editor</context>

I’m not convinced that data providers (com.atlassian.webresource.api.data.WebResourceDataProvider) work in any context in Confluence Server/DC.

I have added the demo data provider to my plugin and it retrieves nothing, undefined, from WRM.data.claim(key). The demo uses the atl.general context for its web-resource.

The demo is from the docs at https://developer.atlassian.com/server/framework/atlassian-sdk/adding-data-providers-to-your-plugin/#consuming-a-data-provider

I have tried adding a dependency on atlassian-plugins-webresource 3.0.0 because that demo doc says data providers are available in “Atlassian Plugins Webresources 3.0 and later.” … and that didn’t help:

    <dependency>
      <groupId>com.atlassian.plugins</groupId>
      <artifactId>atlassian-plugins-webresource</artifactId>
      <version>3.0.0</version>
      <scope>provided</scope>
    </dependency>

I’m testing on Confluence 7.9.0

I found the problem:

The key for the WRM.data.clain(DATA_KEY) call is NOT [groupId].[artifactId]:[web-resource-key].[data-key], as the demo docs say.

It is:
[pluginKey]:[web-resource-key].[data-key]

My plugin key is NOT groupId.artifactId from pom.xml. It is something else, as set by the key attribute of the atlassian-plugin element in atlassian-plugin.xml.

So, this is a doc bug at https://developer.atlassian.com/server/framework/atlassian-sdk/adding-data-providers-to-your-plugin/#consuming-a-data-provider

To find the problem I viewed the source of the HTML for my Confluence page.

there is a map of WRM._unparsedData that can be seen in a <script> element. The map uses the keys that you need to use in your WRM.data.claim(key) calls.

There I can see that it is keying my data using my plugin key from atlassian-plugin.xml, NOT groupId.artifactId from pom.xml. I suppose many/most plugin developers use groupId.artifactId as their plugin key but I don’t.