@pnlight/sdk-react-native 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'PNLightSDK-ReactNative'
3
- s.version = '0.3.7'
3
+ s.version = '0.3.8'
4
4
  s.summary = 'React Native wrapper for PNLight iOS SDK'
5
5
  s.description = 'Provides RN bridge to PNLight.xcframework'
6
6
  s.homepage = 'https://pnlight.app'
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # PNLight SDK - React Native
2
+
3
+ A React Native wrapper for the PNLight SDK.
4
+
5
+ ## Installation
6
+
7
+ Install the package using npm or yarn:
8
+
9
+ ```bash
10
+ npm install @pnlight/sdk-react-native
11
+ ```
12
+
13
+ or
14
+
15
+ ```bash
16
+ yarn add @pnlight/sdk-react-native
17
+ ```
18
+
19
+ For iOS, don't forget to install CocoaPods dependencies:
20
+
21
+ ```bash
22
+ cd ios && pod install
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```javascript
28
+ import PNLightSDK from '@pnlight/sdk-react-native';
29
+
30
+ // 1. Initialize the SDK (do this first)
31
+ await PNLightSDK.initialize('your-api-key');
32
+
33
+ // 2. Validate a purchase (call before purchase - if false, don't proceed)
34
+ const isValidPurchase = await PNLightSDK.validatePurchase();
35
+ console.log('Purchase validation result:', isValidPurchase);
36
+
37
+ // 3. Log an event (example: user completed a tutorial)
38
+ await PNLightSDK.logEvent('tutorial_completed', {
39
+ level: '1',
40
+ duration: '300',
41
+ success: 'true'
42
+ });
43
+ ```
44
+
45
+ ### Important Notes
46
+
47
+ - **Initialization**: Always initialize the SDK first before using any other methods
48
+ - **Purchase Validation**: Call `validatePurchase()` before allowing a purchase. If it returns `false`, it's better not to proceed with the purchase
49
+ - **Event Logging**: Use `logEvent()` to log events to the PNLight platform for analytics and tracking
50
+
51
+ ## API Reference
52
+
53
+ ### `PNLightSDK`
54
+
55
+ The main SDK module.
56
+
57
+ #### Methods
58
+
59
+ - `initialize(apiKey: string): Promise<void>` - Initialize the SDK with your API key
60
+ - `validatePurchase(captcha: boolean = true): Promise<boolean>` - Validate a purchase with anti-bot protection. Set captcha to false to skip captcha challenge.
61
+ - `logEvent(eventName: string, eventArgs?: object): Promise<void>` - Log a custom event
62
+
63
+ ## Platform Setup
64
+
65
+ ### iOS
66
+
67
+ The SDK requires the following frameworks to be linked (usually handled automatically):
68
+ - **AppTrackingTransparency.framework**
69
+ - **AdSupport.framework**
70
+ - **StoreKit.framework**
71
+ - **CoreMotion.framework**
72
+
73
+ Add the following to your `Info.plist`:
74
+
75
+ ```xml
76
+ <key>NSUserTrackingUsageDescription</key>
77
+ <string>This identifier will be used to deliver personalized ads to you.</string>
78
+ ```
79
+
80
+ ### Android
81
+
82
+ Make sure your `minSdkVersion` is set to at least 21 in `android/build.gradle`.
83
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnlight/sdk-react-native",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "React Native wrapper for PNLight iOS binary SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",