npm package: @luckieverse/react-native-sdk
Description: React Native wrapper for Luckieverse SDK
Author: Luckieverse
Latest version: 1.0.2


# React Native Luckieverse SDK

React Native wrapper for the Luckieverse SDK.

## Installation

```sh
npm install react-native-luckieverse-sdk
```

## Development

### Prerequisites

- Node.js 18.x 이상
- npm 또는 yarn
- TypeScript 5.x

### Setup

```sh
# 의존성 설치
npm install

# 개발 모드 (파일 변경 감지)
npm run dev

# 빌드
npm run build

# 린트 체크
npm run lint

# 코드 포맷팅
npm run format

# 전체 체크 (린트 + 빌드)
npm run check
```

### Build Scripts

#### Shell Script 사용

```sh
# 기본 전체 빌드 (포맷팅 + 빌드 + 패킹)
./scripts/build.sh

# 모든 작업 실행 (포맷팅 + 린트 + 빌드 + 테스트 + 패킹)
./scripts/build.sh --all

# 개별 작업들
./scripts/build.sh --format      # 코드 포맷팅만
./scripts/build.sh --lint        # 린트 체크만
./scripts/build.sh --lint-fix    # 린트 수정만
./scripts/build.sh --build       # TypeScript 컴파일만
./scripts/build.sh --dev         # 개발 모드만
./scripts/build.sh --test        # 테스트만
./scripts/build.sh --pack        # 패키지 패킹만
./scripts/build.sh --check       # 전체 체크만

# 조합 사용
./scripts/build.sh --format --lint --build
./scripts/build.sh --lint-fix --build --test

# 배포 관련
./scripts/build.sh --publish          # 현재 버전으로 npm 배포
./scripts/build.sh --patch            # 패치 버전 업데이트 + 배포 (1.0.0 -> 1.0.1)
./scripts/build.sh --minor            # 마이너 버전 업데이트 + 배포 (1.0.0 -> 1.1.0)
./scripts/build.sh --major            # 메이저 버전 업데이트 + 배포 (1.0.0 -> 2.0.0)

# 도움말
./scripts/build.sh --help
```

#### npm Scripts

```sh
# TypeScript 컴파일
npm run build:ts

# 타입 정의 생성
npm run build:types

# 빌드 디렉토리 정리
npm run clean

# 패키지 패킹
npm run pack

# 린트 수정
npm run lint:fix

# 버전 업데이트 및 배포
npm run publish:patch  # 1.0.0 -> 1.0.1
npm run publish:minor  # 1.0.0 -> 1.1.0
npm run publish:major  # 1.0.0 -> 2.0.0
```

### Project Structure

```
react-native-luckieverse-sdk/
├── src/                    # TypeScript 소스 코드
│   └── index.ts           # 메인 엔트리 포인트
├── lib/                   # 빌드된 JavaScript 파일
├── android/               # Android 네이티브 코드
├── ios/                   # iOS 네이티브 코드
├── scripts/               # 빌드 스크립트
├── .github/workflows/     # CI/CD 워크플로우
└── package.json           # 프로젝트 설정
```

## Pre-installation Steps

You need to manually add the native SDK files to your project before installing the package.

### Android

1.  Download the `Luckieverse.aar` file.
2.  Create a `libs` directory in your `android/app` folder.
3.  Copy the `Luckieverse.aar` file into the `android/app/libs` directory.
4.  Open your `android/app/build.gradle` file and add the following line to the `dependencies` section:

    ```gradle
    implementation files('libs/Luckieverse.aar')
    ```

### iOS

1.  Download the `Luckieverse.xcframework` file.
2.  In Xcode, open your project's workspace.
3.  Drag and drop the `Luckieverse.xcframework` file into the "Frameworks, Libraries, and Embedded Content" section of your app's target settings.
4.  Ensure "Embed & Sign" is selected for the framework.

## Post-installation Steps

### iOS

After installing the npm package, you need to install the pods for iOS.

```sh
cd ios
pod install
```

## Usage

```javascript
import * as Luckieverse from 'react-native-luckieverse-sdk';

// Initialize the SDK
Luckieverse.updateAppKey("YOUR_APP_KEY");
Luckieverse.updateUserId("USER_ID");
Luckieverse.updateADID("ADID_OR_IDFA"); // Use ADID for Android, IDFA for iOS

// Set Ad Zone Ids
Luckieverse.setFullScreenAdZoneIdForSaju("YOUR_ZONE_ID");
Luckieverse.setBannerAdZoneIdForSaju("YOUR_ZONE_ID");
// ... and so on for other ad types

// Open the main Luckieverse view
Luckieverse.openLuckieverseMain();

// Handle settings callbacks (iOS only)
Luckieverse.setGoToSettingSwift().then(() => {
  console.log("Navigated to settings from Swift.");
});

Luckieverse.setGoToSettingObjc().then(() => {
  console.log("Navigated to settings from Objc.");
});
```

### API

- `updateUserId(userId: string)`
- `updateAppKey(appKey: string)`
- `updateADID(adid: string)` (For Android)
- `updateIDFA(idfa: string)` (For iOS - aliased as `updateADID` in the JS bridge)
- `setFullScreenAdZoneIdForSaju(zoneId: string)`
- `setFullScreenAdZoneIdForNotSaju(zoneId: string)`
- `setFullScreenAdZoneIdForFortuneCookie(zoneId: string)`
- `setBannerAdZoneIdForSaju(zoneId: string)`
- `setBannerAdZoneIdForNotSaju(zoneId: string)`
- `setBannerAdZoneIdForFortuneCookie(zoneId: string)`
- `openLuckieverseMain()`
- `setGoToSettingSwift(): Promise<void>` (iOS only)
- `setGoToSettingObjc(): Promise<void>` (iOS only)