npm package: @max_enovlab/react-native-sdk
Description: React Native SDK for Yoop Mobile
Author: Yoop
Latest version: 0.0.2

# @max_enovlab/react-native-sdk

React Native SDK for Yoop Mobile - providing authentication flows for React Native applications.

## Installation

```sh
npm install @max_enovlab/react-native-sdk
```

### iOS Setup

1. Run pod install in your iOS directory:
```sh
cd ios && pod install
```

2. Add the YoopMobileSDK SPM package to your Xcode project (the SDK is distributed via Swift Package Manager).

### Android Setup

The SDK is automatically linked. No additional setup required.

## Usage

### Initialize the SDK

```typescript
import { YoopSdk } from '@max_enovlab/react-native-sdk';

// Initialize SDK (typically in your App.tsx or initialization logic)
await YoopSdk.initialize({
  apiBaseUrl: 'https://api.yoop.app',
  environment: 'production', // 'development' | 'staging' | 'production'
  logLevel: 'error',         // 'verbose' | 'debug' | 'info' | 'warn' | 'error'
});
```

### Authentication

```typescript
import { YoopSdk } from '@max_enovlab/react-native-sdk';

// Login
const loginResult = await YoopSdk.login();
if (loginResult.status === 'success') {
  console.log('Login successful!');
} else if (loginResult.status === 'cancelled') {
  console.log('User cancelled login');
}

// Login with pre-filled email
const loginResult = await YoopSdk.login({
  prefilledEmail: 'user@example.com',
});

// Logout
const logoutResult = await YoopSdk.logout();
if (logoutResult.status === 'success') {
  console.log('Logout successful!');
}
```

### Check SDK State

```typescript
// Check if SDK is initialized
const isReady = await YoopSdk.isInitialized();

// Reset SDK (clears all state)
await YoopSdk.reset();
```

## API Reference

### `YoopSdk.initialize(config)`

Initialize the SDK. Must be called before any other methods.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `apiBaseUrl` | `string` | Yes | Base URL for API requests |
| `environment` | `'development' \| 'staging' \| 'production'` | No | Target environment (default: `'production'`) |
| `logLevel` | `'verbose' \| 'debug' \| 'info' \| 'warn' \| 'error'` | No | Minimum log level (default: `'error'`) |
| `enableNetworkLogging` | `boolean` | No | Enable network logging (default: `false`) |

### `YoopSdk.login(params?)`

Start the login flow. Returns a promise with the result.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `redirectUrl` | `string` | No | Custom redirect URL after auth |
| `prefilledEmail` | `string` | No | Pre-fill email in login form |
| `verificationToken` | `string` | No | Token for email verification |
| `logoutExisting` | `boolean` | No | Logout existing session first |

### `YoopSdk.logout(params?)`

Start the logout flow. Returns a promise with the result.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `redirectUrl` | `string` | No | Redirect URL after logout |

### `YoopSdk.isInitialized()`

Check if the SDK is initialized. Returns `Promise<boolean>`.

### `YoopSdk.reset()`

Reset the SDK to uninitialized state. Returns `Promise<boolean>`.

## Requirements

- React Native >= 0.74.0
- iOS >= 15.0
- Android minSdk 24

## License

Apache-2.0