feedback-react-native-sdk
v0.2.14
Published
test
Downloads
709
Readme
feedback-react-native-sdk
Pisano Feedback SDK for React Native — supports both New Architecture (TurboModule) and Legacy Bridge.
Installation
npm install feedback-react-native-sdk
# or
yarn add feedback-react-native-sdkiOS: run pod install in your ios/ directory after installing.
Quick start
import {
feedbackSDKDebugMode,
feedbackSDKBoot,
feedbackSDKShow,
feedbackSDKClear,
feedbackSDKViewMode,
} from 'feedback-react-native-sdk';1. Boot (call once on app start)
feedbackSDKBoot(
'YOUR_APP_ID',
'YOUR_ACCESS_KEY',
'PSN-xxxxx', // code (required)
'https://api.pisano.co',
'https://web.pisano.co/web_feedback',
undefined, // eventUrl (optional)
(status) => console.log('Boot:', status)
);2. Show the survey widget
feedbackSDKShow(
feedbackSDKViewMode.BottomSheet,
'We Value Your Feedback', // title
16, // titleFontSize
null, // code override (null = use boot code)
'en', // language
new Map([ // customer
['name', 'John Doe'],
['email', '[email protected]'],
['phoneNumber', '+905551112233'],
['externalId', 'USR-42'],
]),
new Map([ // payload
['screenName', 'Checkout'],
['orderId', 'ORD-987'],
]),
(result) => console.log('Show:', result)
);3. Clear session (optional)
feedbackSDKClear();Key concepts
- Boot stores credentials and initializes the native SDK. Call it once. It does not open any UI.
- Show opens the survey widget using the stored config from boot. You can override the
codeper call to show a different channel. - Customer keys must be camelCase —
name,email,phoneNumber,externalId. Both camelCase and snake_case are accepted but camelCase is recommended.
API reference
feedbackSDKDebugMode(debugMode: boolean)
Enables verbose native logging. Call before boot.
feedbackSDKDebugMode(true);
// Android: adb logcat -s PISANO_SDK ReactNativeJS
// iOS: Xcode console → filter "Pisano"feedbackSDKBoot(appId, accessKey, code, apiUrl, feedbackUrl, eventUrl?, callback?)
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| appId | string | yes | Application ID from Pisano |
| accessKey | string | yes | Access key from Pisano |
| code | string | yes | Channel identifier (e.g. "PSN-xxxxx") |
| apiUrl | string | yes | API endpoint |
| feedbackUrl | string | yes | Feedback endpoint |
| eventUrl | string | no | Event tracking endpoint |
| callback | (status: string) => void | no | Boot result callback |
feedbackSDKShow(viewMode, title, titleFontSize, code, language, customer, payload, callback)
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| viewMode | feedbackSDKViewMode | yes | .Default or .BottomSheet |
| title | string | null | no | Widget title |
| titleFontSize | number | null | no | Title font size |
| code | string | null | no | Override boot code for this call |
| language | string | null | no | e.g. "en", "tr" |
| customer | Map<string, any> | null | no | Customer info (camelCase keys) |
| payload | Map<string, string> | null | no | Custom data (camelCase keys) |
| callback | (result) => void | yes | Result as enum string |
Customer keys: name, email, phoneNumber, externalId, customAttributes (both camelCase and snake_case variants like phone_number, external_id are also accepted)
Payload keys: any key-value pairs relevant to your context (e.g. screenName, orderId, productCategory)
Callback values: "Closed", "SendFeedback", "Outside", "Opened", "DisplayOnce", "PreventMultipleFeedback", "QuotaExceeded", "DisplayRateLimited", "SurveyPassive", "HealthCheckFailed"
feedbackSDKClear()
Clears native SDK session and cached state.
New Architecture support
The SDK works with both architectures out of the box:
newArchEnabled=true→ TurboModulenewArchEnabled=false→ Legacy bridge
No extra configuration needed. The SDK reads the standard newArchEnabled flag from gradle.properties.
Example app
See example/ for a working demo with all SDK functions. Setup guides:
License
MIT
