react-native-sdk-pianoio 0.4.8 → 0.5.1

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.
package/README.md CHANGED
@@ -173,10 +173,17 @@ Add the following to your `AndroidManifest.xml` to enable Piano ID sign-in:
173
173
  ### 1. Initialize the SDK
174
174
 
175
175
  ```typescript
176
- import { PianoComposer } from 'react-native-sdk-pianoio';
176
+ import { PianoComposer, PianoEndpoint } from 'react-native-sdk-pianoio';
177
177
 
178
- // Initialize with your Piano Application ID
179
- const composer = await PianoComposer.create('YOUR_PIANO_AID', false); // false = production, true = sandbox
178
+ // Initialize with your Piano Application ID and endpoint
179
+ // Default: Production US
180
+ const composer = await PianoComposer.create('YOUR_PIANO_AID');
181
+
182
+ // Or specify a regional endpoint
183
+ const composer = await PianoComposer.create('YOUR_PIANO_AID', PianoEndpoint.PRODUCTION_EUROPE);
184
+
185
+ // Or use sandbox for testing
186
+ const composer = await PianoComposer.create('YOUR_PIANO_AID', PianoEndpoint.SANDBOX);
180
187
  ```
181
188
 
182
189
  ### 2. Configure Content & Context
@@ -317,11 +324,12 @@ console.log('SDK Status:', {
317
324
  **PianoUser Object:**
318
325
  ```typescript
319
326
  interface PianoUser {
320
- authenticated: boolean;
321
- uid?: string; // User ID
322
- email?: string; // User email address
323
- firstName?: string;
324
- lastName?: string;
327
+ success?: boolean; // Sign-in success status
328
+ authenticated?: boolean; // Authentication state
329
+ uid?: string; // User ID
330
+ email?: string; // User email address
331
+ accessToken?: string; // OAuth access token
332
+ [key: string]: any; // Additional fields from Piano SDK
325
333
  }
326
334
  ```
327
335
 
@@ -442,14 +450,30 @@ interface MultipleEventsResponse {
442
450
 
443
451
  ## 🔧 Advanced Usage
444
452
 
445
- ### Production vs Sandbox
453
+ ### Regional Endpoints
454
+
455
+ Piano supports multiple regional endpoints for data residency and performance optimization:
446
456
 
447
457
  ```typescript
448
- // Production environment (default)
449
- const composer = await PianoComposer.create('YOUR_PRODUCTION_AID', false);
458
+ import { PianoComposer, PianoEndpoint } from 'react-native-sdk-pianoio';
459
+
460
+ // US Production (default)
461
+ const composer = await PianoComposer.create('YOUR_AID', PianoEndpoint.PRODUCTION);
462
+
463
+ // Europe Production
464
+ const composer = await PianoComposer.create('YOUR_AID', PianoEndpoint.PRODUCTION_EUROPE);
465
+
466
+ // Australia Production
467
+ const composer = await PianoComposer.create('YOUR_AID', PianoEndpoint.PRODUCTION_AUSTRALIA);
468
+
469
+ // Asia-Pacific Production
470
+ const composer = await PianoComposer.create('YOUR_AID', PianoEndpoint.PRODUCTION_ASIA_PACIFIC);
471
+
472
+ // Sandbox (for testing)
473
+ const composer = await PianoComposer.create('YOUR_AID', PianoEndpoint.SANDBOX);
450
474
 
451
- // Sandbox environment for testing
452
- const composer = await PianoComposer.create('YOUR_SANDBOX_AID', true);
475
+ // You can also use string values directly
476
+ const composer = await PianoComposer.create('YOUR_AID', 'production-europe');
453
477
  ```
454
478
 
455
479
  ### Handling ShowLogin Events
@@ -182,7 +182,7 @@ import React
182
182
  NSLog("[MyComposerDelegate] Event params: \(params != nil ? String(describing: params!) : "nil")")
183
183
  var eventData = paramsToDictionary(params)
184
184
  eventData["eventType"] = "meter"
185
- eventData["meterState"] = "active" // Add state to differentiate from expired
185
+ eventData["state"] = "ACTIVE" // Add state to differentiate from expired
186
186
  NSLog("[MyComposerDelegate] Event data: \(eventData)")
187
187
  collectEvent(eventData: eventData)
188
188
  }
@@ -195,7 +195,7 @@ import React
195
195
  NSLog("[MyComposerDelegate] Event params: \(params != nil ? String(describing: params!) : "nil")")
196
196
  var eventData = paramsToDictionary(params)
197
197
  eventData["eventType"] = "meter"
198
- eventData["meterState"] = "expired" // Add state to differentiate from active
198
+ eventData["state"] = "EXPIRED" // Add state to differentiate from active
199
199
  NSLog("[MyComposerDelegate] Event data: \(eventData)")
200
200
  collectEvent(eventData: eventData)
201
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-sdk-pianoio",
3
- "version": "0.4.8",
3
+ "version": "0.5.1",
4
4
  "description": "Piano io sdk integration",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",