UNPKG

@livelike/react-native

Version:

LiveLike React Native package

38 lines 928 B
import { useCallback } from 'react'; import { useAnalytics } from './useAnalytics'; import { useWidget } from './useWidget'; import { useWidgetInteractionActions } from './useWidgetInteractionActions'; export function useWidgetSubmitAction(_ref) { let { widgetId } = _ref; const widget = useWidget({ widgetId }); const { trackEvent } = useAnalytics(); const { createWidgetInteractionAction } = useWidgetInteractionActions({ widgetId }); const onInteractionSubmit = useCallback(_ref2 => { let { interactionItem } = _ref2; return createWidgetInteractionAction({ interactionItem }).then(res => { trackEvent('Widget Submitted', { widget, interactionItem }); return res; }); }, [widgetId, createWidgetInteractionAction, trackEvent]); return { onInteractionSubmit }; } //# sourceMappingURL=useWidgetSubmitAction.js.map