recordSentryAppInteraction.tsx 462 B

1234567891011121314151617181920
  1. import {Client} from 'sentry/api';
  2. type TSDBField = 'sentry_app_viewed' | 'sentry_app_component_interacted';
  3. export const recordInteraction = async (
  4. sentryAppSlug: string,
  5. field: TSDBField,
  6. data?: object
  7. ): Promise<void> => {
  8. const api = new Client();
  9. const endpoint = `/sentry-apps/${sentryAppSlug}/interaction/`;
  10. return await api.requestPromise(endpoint, {
  11. method: 'POST',
  12. data: {
  13. tsdbField: field,
  14. ...data,
  15. },
  16. });
  17. };