open-index/open-npm huggingface dataset:
npm package: @moroccangateway/morpaysdk
Description: Official Node.js SDK for MorPay
Author: MorPay
Latest version: 0.0.3

# MorPay Node.js SDK

The official Node.js library for the MorPay API.

## Installation

```bash
npm install @moroccangateway/morpaysdk
# or
yarn add @moroccangateway/morpaysdk
# or
pnpm add @moroccangateway/morpaysdk
```

## Usage

### Initialization

```typescript
import { MorPay } from '@moroccangateway/morpaysdk';

const morpay = new MorPay('pk_test_...');
```

### Create a Payment

```typescript
const payment = await morpay.payments.create({
  amount: 100.00,
  currency: 'MAD',
  provider: 'cmi',
  redirect_url: 'https://your-app.com/callback',
  customer: {
    email: 'customer@example.com',
    name: 'John Doe'
  }
});

console.log(payment.action.url); // Redirect user here
```

### List Transactions

```typescript
const transactions = await morpay.payments.list({
  limit: 10,
  status: 'succeeded'
});
```

### Manage Customers

```typescript
const customer = await morpay.customers.create({
  email: 'new@example.com',
  name: 'New Customer'
});
```

### Webhook Verification

```typescript
import { Webhooks } from '@moroccangateway/morpaysdk';

const wh = new Webhooks();
const payload = request.body;
const headers = request.headers;
const secret = 'whsec_...';

try {
  const event = wh.verify(payload, headers, secret);
  console.log(event.type);
} catch (err) {
  console.error('Webhook verification failed');
}
```

## Configuration

You can configure the SDK with options:

```typescript
const morpay = new MorPay('pk_test_...', {
  timeout: 10000, // 10 seconds
  retries: 3,     // Auto-retry network errors
  debug: true     // Enable debug logging
});
```

## TypeScript Support

The SDK is written in TypeScript and includes full type definitions.

```typescript
import { PaymentResponse, CreatePaymentRequest } from '@moroccangateway/morpaysdk';
```
npm package: @morosystems/react-debug
Description: Debug utils for react components.
Author: Morosystems
Latest version: 0.1.0

# @morosystems/react-debug
Debug utils for react components. Intended for development only, not for production

## debug HOC

Lets you see in console when component mounts, unmounts, updates and why it updated:

```
import {debug} from "@morosystems/react-debug";

export default debug()(MyComponent);
```

This logs roughly the following information:
```
MyComponent mounts
MyComponent updates name,input
MyComponent updates error
MyComponent unmounts
```

Displayed information can be changed using the configuration object, e.g.:
```
export default debug({name: 'Test'})(MyComponent);
```

### Alternative import
In order to not importing component all the time, you can import `@morosystems/react-debug/lib/patch` just once, in your main file,
then use `debug()` directly from global namespace. You can also safely forget about removing this import for production,
since it will inject `debug()` only when NODE_ENV is `development`

```
import "@morosystems/react-debug/lib/patch";
...
export default debug()(MyComponent);
```

### Component name
You can specify name that is logged using the `name` property. You can specify:
1. String.
2. Function of props. This is useful when debugging one specific instance of generic component, e.g. `Field`.

```
export default debug({name: (props) => props.input.name})(Field);
```
### Custom logging
You can also use custom messages for each lifecycle event.
1. `mount` as a function from props to string.
2. `update` as a function from props and next props to string.
3. `unmount` as a function from props to string.

You can also supress loging by returning `null`, `undefined` or `false`:
```
const update = (props, nextProps) => (props.name !== nextProps.name) && `${props.name} updates to ${nextProps.name}`;

export default debug({update})(MyComponent);
```