feedback-react-native-sdk
v0.2.8
Published
test
Readme
feedback-react-native-sdk
Pisano Feedback SDK for React Native
Installation
npm install feedback-react-native-sdkUsage
import { feedbackSDKDebugMode } from 'feedback-react-native-sdk';
import { feedbackSDKBoot } from 'feedback-react-native-sdk';
import { feedbackSDKShow } from 'feedback-react-native-sdk';
import { feedbackSDKTrack } from 'feedback-react-native-sdk';
import { feedbackSDKClear } from 'feedback-react-native-sdk';
import { feedbackSDKViewMode } from 'feedback-react-native-sdk';
// ...
feedbackSDKDebugMode(bool);
feedbackSDKBoot(appId, accessKey, apiUrl, feedbackUrl, eventUrl);
feedbackSDKShow(flowId, language, customer, payload, (status) => {
console.log("Show Status: " + status);
});
feedbackSDKTrack(event, payload, customer, language, (status) => {
console.log("Show Status: " + status);
});
feedbackSDKClear();
Quick start (recommended flow)
- Enable debug logs (optional)
feedbackSDKDebugMode(true);- Initialize the native SDK (call once on app start)
feedbackSDKBoot(
'YOUR_APP_ID',
'YOUR_ACCESS_KEY',
'https://api.pisano.co',
'https://web.pisano.co/web_feedback',
undefined, // eventUrl (optional)
(status) => console.log('Boot status:', status)
);- Show the widget
feedbackSDKShow(
feedbackSDKViewMode.BottomSheet, // or feedbackSDKViewMode.Default
'We Value Your Feedback', // title (string | null)
16, // titleFontSize (number | null)
null, // flowId (string | null)
'en', // language (string | null)
new Map([['email', '[email protected]']]), // customer (Map | null)
new Map([['source', 'home']]), // payload (Map | null)
(result) => console.log('Show result:', result) // enum string like "Closed"
);- Track an event (optional)
feedbackSDKTrack(
'purchase_completed',
new Map([['amount', '49.99']]),
new Map([['externalId', 'USER-123']]),
'en',
(status) => console.log('Track status:', status)
);- Clear session/state (optional)
feedbackSDKClear();API reference
feedbackSDKBoot(appId, accessKey, apiUrl, feedbackUrl, eventUrl?, callback?)
- appId: string
- accessKey: string
- apiUrl: string (e.g.
https://api.pisano.co) - feedbackUrl: string (e.g.
https://web.pisano.co/web_feedback) - eventUrl: string | undefined (optional)
- callback:
(status: string) => void(optional)
feedbackSDKShow(viewMode, title, titleFontSize, flowId, language, customer, payload, callback)
- viewMode:
feedbackSDKViewMode.Default|feedbackSDKViewMode.BottomSheet - title: string | null
- titleFontSize: number | null
- flowId: string | null
- language: string | null (e.g.
"en","tr") - customer:
Map<string, any>| null - payload:
Map<string, string>| null - callback:
(result) => voidresultis returned as an enum string:"Closed","SendFeedback","Outside","Opened","DisplayOnce","PreventMultipleFeedback","QuotaExceeded"(or"None")
feedbackSDKTrack(event, payload?, customer?, language?, callback?)
- event: string
- payload:
Map<string, string>(optional) - customer:
Map<string, any>(optional) - language: string (optional)
- callback:
(status: string) => void(optional)
feedbackSDKClear()
Clears native SDK state (session/cache) for the current user.
Sample apps (iOS / Android)
This repo includes a React Native example app under example/ that installs the SDK from this repo via file:../.
- iOS example app setup:
example/ios/README.md - Android example app setup:
example/android/README.md
You can also see the demo usage in example/src/App.tsx.
Android new architecture (TurboModule) toggle
The package ships with the legacy bridge enabled by default to guarantee compatibility with existing apps. If you need to opt in to the new architecture/TurboModule implementation:
- Open your app’s
android/gradle.properties. - Add
FeedbackReactNativeSdk_newArchEnabled=true. - Follow the React Native new-arch guide (e.g. run
./gradlew generateCodegenArtifactsFromSchema).
When the property is omitted (the default), only the legacy Java module is compiled and no extra steps are required for consumers upgrading to a newer SDK version.
Development guide
See DEVELOPMENT.md for a deeper look at the bridge architecture, native integration points, and local development workflow.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
