UNPKG

we-insights-react-native

Version:

[we-insights] is a powerful utility library designed to streamline data collection processes for WeApp employees. It simplifies the process of gathering, storing, and managing data within WeApp projects, making it an invaluable tool for enhancing efficien

56 lines (55 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useInsights = void 0; var _react = require("react"); const useInsights = () => { const [isLoading, setIsLoading] = (0, _react.useState)(false); const [error, setError] = (0, _react.useState)(null); const sendFeedback = async feedback => { setIsLoading(true); setError(null); try { //TODO: Call native modules when available console.log('sendFeedback', feedback); return { success: true, message: 'Feedback sent successfully' }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Failed to send feedback due to an unknown error'; setError(errorMessage); return { success: false, message: errorMessage }; } finally { setIsLoading(false); } }; const sendTrackingEvent = async event => { //TODO: implement //TODO: send correct type of event console.log('trackEvent', event); }; const sendTrackingEventOnNavigate = async options => { console.log('sendEventOnNavigate', options.screenName); sendTrackingEvent(options.screenName); }; const initializeSDK = async configuration => { //TODO: implement //TODO: pass apiKey to native modules when available console.log('initializeSDK', configuration); }; return { isLoading, error, sendFeedback, sendTrackingEvent, sendTrackingEventOnNavigate, initializeSDK }; }; exports.useInsights = useInsights; //# sourceMappingURL=useInsights.js.map