## ourpayelements

JS/React library for MFE Demo widgets

### Development

-   Clone repository
-   Install dependencies

```
cd mfe-demo-widget
npm install
```

-   Start development bundler

```
npm run dev
```

-   Start example web app

```
cd example/react OR cd example/js
npm i
npm run dev
```

### Usage

Install as an NPM package (`npm i ourpayelements`) or import from CDN: https://www.unpkg.com/ourpayelements

#### React

```js
import { DonationForm, DonationTable, DonationProvider } from "ourpayelements";

export default function App() {
    return (
        <DonationProvider appId={123}>
            <DonationForm />
            <DonationTable />
        </DonationProvider>
    );
}
```

#### JS

**Example:**

```js
// Initialize JS factory
const elements = Ourpay.Elements(123);
elements.DonationForm.mount("#form-id", {
    defaultAmount: 100,
});
elements.DonationTable.mount("#table-id");
```
