add `accountType` in userProductContext hook for UI Kit

XMLWordPrintable

      UI Kit 1 had `accountType` in `userProductContext` hook and we were able to use it in UI Kit 1 like this.

      import ForgeUI, { useProductContext, Text, Macro, render } from '@forge/ui';
          
      const App = () => {
        const context = useProductContext();
        return <Text>Account type: {context.accountType}</Text>;
      };
       
      export const run = render(<Macro app={<App />} />);
      
      

      However, UI Kit does not have `accountType` in `userProductContext` hook. This doesn't work.

      import { useProductContext } from '@forge/bridge';
      const App = () => {
        const context = useProductContext();
        return <Text>Account type: {context.accountType}</Text>;
      };
      

      Please add support for it. And, update the documentation

       

      Workaround

      For the time being, we can use backend to validate user accountType.

      resolver.define('backendFunc', (req) => {
        console.log(req); // req.accountType exists
        return 'Hello, world!';
      });
      

            Assignee:
            Unassigned
            Reporter:
            Nashid Farhad
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: