2.9.1 • Published 4 months ago

@team-monite/ui-widgets-react v2.9.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Monite UI Widgets

npm version

A library of ready-to-use React components connected to the Monite API. These components display the data served from the Monite API and also provide data editing functionality.

Note: This package is part of a monorepo. See the main README for more information.

Requirements

  • Node.js 16 or later.
  • At least 8 GB RAM on each development workstation.
  • A partner account registered with Monite. For details, see Get started with Monite API.

Supported browsers

Monite UI Widgets support the five latest versions of major browsers: Chrome, Firefox, Safari, Edge, Opera.

Installation

npm install @team-monite/ui-widgets-react --save --force

or

yarn add @team-monite/ui-widgets-react

Usage

Before using Monite UI Widgets, complete the Getting started guide to set up your partner account and get API the credentials.

We also assume you have already mapped out your customers and their users as entities and entity users in Monite, and that you have the ability to:

  • look up the Monite entity user ID for the user who is logged in to your application;
  • look up the Monite entity ID to which the user belongs.

When an entity user logs in to your application, look up the entity ID and user ID for that user, and call Monite's POST /auth/token endpoint to generate a Monite access token for that user.

Once you have a user access token and an entity ID, you can initialize the Monite client and widgets, as shown below.

This example displays a list of an entity's counterparts:

import { MoniteSDK } from '@team-monite/sdk-api';
import {
  MoniteProvider,
  CounterpartsTable,
} from '@team-monite/ui-widgets-react';

const monite = new MoniteSDK({
  apiUrl: 'https://api.sandbox.monite.com/v1', // Or 'https://api.monite.com/v1' to use Production
  entityId: 'ENTITY_ID', // Monite entity to which the user belongs

  /** Entity whose data you want to access */
  fetchToken: async () => {
    const response = await fetch('https://api.sandbox.monite.com/v1/auth/token', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-monite-version': '2023-03-14' //Monite API version
      },
      body: JSON.stringify({
        grant_type: 'entity_user',
        client_id: 'SECRET_CLIENT_ID',
        client_secret: 'SECRET_CLIENT_SECRET',
        entity_user_id: 'SECRET_ENTITY_USER_ID'
      })
    });

    return response.json();
  },
});

<MoniteProvider monite={monite}>
  <CounterpartsTable />
</MoniteProvider>;

The MoniteProvider element serves as a wrapper for other Monite-connected components. Any other components imported from @team-monite/ui-widgets-react must be placed inside this element.

Documentation

License

MIT

2.9.1

4 months ago

2.9.0

4 months ago

2.8.0-beta.0

8 months ago

3.0.0-alpha.6

8 months ago

3.0.0-alpha.1

8 months ago

2.4.1

10 months ago

3.0.0-alpha.0

8 months ago

2.4.0

10 months ago

3.0.0-alpha.3

8 months ago

2.6.1

8 months ago

3.0.0-alpha.2

8 months ago

2.6.0

8 months ago

2.8.1

7 months ago

3.0.0-alpha.5

8 months ago

2.8.0

8 months ago

3.0.0-alpha.4

8 months ago

2.5.0-beta.3

9 months ago

2.5.0-beta.4

9 months ago

2.5.0-beta.5

9 months ago

2.5.0-beta.6

9 months ago

2.5.0-beta.7

9 months ago

2.5.0

9 months ago

2.7.0

8 months ago

2.6.0-beta.0

9 months ago

2.4.0-beta.4

10 months ago

2.4.0-beta.3

10 months ago

2.4.0-beta.6

10 months ago

2.4.0-beta.5

10 months ago

2.8.3

7 months ago

2.4.2-beta.0

10 months ago

2.8.2

7 months ago

2.4.0-beta.2

10 months ago

2.4.2-beta.2

9 months ago

2.4.2-beta.1

10 months ago

2.7.0-beta.0

8 months ago

2.4.0-beta.0

11 months ago

2.3.0

11 months ago

2.2.0

11 months ago

2.1.0

12 months ago

2.0.0

12 months ago

1.5.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.4.0

1 year ago

1.2.2

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago