AnalyticsController.js 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = exports.AnalyticsController = void 0;
  6. var _AdaptableController = _interopRequireDefault(require("./AdaptableController"));
  7. var _AnalyticsAdapter = require("../Adapters/Analytics/AnalyticsAdapter");
  8. function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
  9. class AnalyticsController extends _AdaptableController.default {
  10. appOpened(req) {
  11. return Promise.resolve().then(() => {
  12. return this.adapter.appOpened(req.body, req);
  13. }).then(response => {
  14. return {
  15. response: response || {}
  16. };
  17. }).catch(() => {
  18. return {
  19. response: {}
  20. };
  21. });
  22. }
  23. trackEvent(req) {
  24. return Promise.resolve().then(() => {
  25. return this.adapter.trackEvent(req.params.eventName, req.body, req);
  26. }).then(response => {
  27. return {
  28. response: response || {}
  29. };
  30. }).catch(() => {
  31. return {
  32. response: {}
  33. };
  34. });
  35. }
  36. expectedAdapterType() {
  37. return _AnalyticsAdapter.AnalyticsAdapter;
  38. }
  39. }
  40. exports.AnalyticsController = AnalyticsController;
  41. var _default = exports.default = AnalyticsController;
  42. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfQWRhcHRhYmxlQ29udHJvbGxlciIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX0FuYWx5dGljc0FkYXB0ZXIiLCJlIiwiX19lc01vZHVsZSIsImRlZmF1bHQiLCJBbmFseXRpY3NDb250cm9sbGVyIiwiQWRhcHRhYmxlQ29udHJvbGxlciIsImFwcE9wZW5lZCIsInJlcSIsIlByb21pc2UiLCJyZXNvbHZlIiwidGhlbiIsImFkYXB0ZXIiLCJib2R5IiwicmVzcG9uc2UiLCJjYXRjaCIsInRyYWNrRXZlbnQiLCJwYXJhbXMiLCJldmVudE5hbWUiLCJleHBlY3RlZEFkYXB0ZXJUeXBl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