MacroConfig and UI kit 2

Hello :slight_smile:

I did read the documentation from https://developer.atlassian.com/platform/forge/ui-kit-2/compare/#macroconfig and I cannot get the macro configuration to load using UI kit 2.

It’s unclear to me where the rendered config should be defined

export const config = render(<Config />);

I was able to deploy using forge deploy without errors using the manifest

modules:
  macro:
    - key: test-confluence-macro-2-hello-world-macro
      resource: main
      render: native
      resolver:
        function: resolver
      title: test-confluence-macro-2
      config:
        function: macroconfig
  function:
    - key: resolver
      handler: index.handler
    - key: macroconfig
      handler: index.config
resources:
  - key: main
    path: src/frontend/index.jsx

The macro config is defined in the src/index.js. It would make more sense to me if it would be rendered client side. Maybe that’s an issue with UI kit client side ?

Can anyone help me with this ?
Thanks !!

3 Likes

Hey @FabienLydoire just wanted to clarify, are you asking where the Config() component will be defined?

For reference, we provide a full guide in the UI Kit 1 docs that might help for now https://developer.atlassian.com/platform/forge/add-configuration-to-a-macro/

Thanks @BeauWilliams.
Yes, I want to know where to define the Config component in UI kit 2, both in term of in which file to put the config and how to define the manifest.

Specifically, when defining in the manifest what the function is for the config, I have to put it in the index.js file, the one that runs backend code.
It seems incorrect to define dependencies to @forge/ui in the backend part of UI kit 2.

I don’t know how to reference the config in the manifest file to be part of the frontend code of UI kit 2.

In the current configuration (see initial post), I end up with an error in the UI and the javascript console.

POST https://***.atlassian.net/gateway/api/engage-targeting/api/v2/user/messages/public-links-share-pulse/start 409 (Conflict)
POST https://***.atlassian.net/gateway/api/engage-targeting/api/v2/user/messages/public-links-share-pulse/start 409 (Conflict)

Any example on how to define correctly a macro configuration using UI kit 2 ?

Thanks :slight_smile:

You can define the macro config in any file you want. I have the macro in a macro.js file and then my functions are this:

  function:
    - key: macro
      handler: macro.macro
    - key: macro-config
      handler: macro.macroConfig

Not sure if the error is related. Doesn’t seem to be a UI Kit 2-specific issue.

Are you using ui kit 2 @AaronCollier ?
In ui kit 2, ui runs on the client side and I think that’s causing the issue there :frowning:

I believe I am facing the same issue as @FabienLydoire . Even trying to add MacroConfig to the most basic app, I run into the same “Failed to Load” error", following the same documentation, and trying various combinations of construction. If anyone has a working example of a UI Kit 2 app using Macro Configuration, itt would be greatly appreciated!

@AdamMoore would you happen to have any experience with this? or able to point us in the right direction? In my case, I did notice that when I dump view.getContext() it does not even include productContext.extension.config, only returning:

"extension": {
		"type": "macro",
		"content": {
			"id": "<ID>"
		},
		"space": {
			"key": "<KEY>"
		},
		"isEditing": false,
		"references": []
	}

Hey @FabienLydoire just wanted to clarify, are you asking where the Config() component will be defined?frtv5bghy67

Let me check in with the team on this

Yes @BeauWilliams . I’d like to get proper documentation on “How to use macro config in UI Kit 2”.
Specifically, on which file should we define the macro config, client side or server side, and how to declare this in the manifest.

1 Like

Hi @FabienLydoire apologies for any confusion here. UI Kit 2 MacroConfig has not yet shipped but is planned for this quarter.

At this time you must use UI Kit 1 to interact with MacroConfig extension point

Thanks for the update @BeauWilliams !

So is this a case of the documentation for UI Kit 2 being released ahead of schedule then?

Does there happen to be an Early Access Program which we could join to start working with it ahead of time?

1 Like

Thanks @BeauWilliams.

1 Like

As per the docs, you should have been able to use it until the last CLI release.

But unfortunately we’ve encountered an unexpected bug in that release which broke UI Kit 1 MacroConfig support workaround in interim in UI kit 2 before we release the new native component as we made some changes in prep to release it very soon.

The team is aware and fix is currently underway. Should expect it to be available to be used natively in UI Kit 2 in less than a fortnight

1 Like

Amazing news! Thanks again for the update @BeauWilliams !

1 Like