'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../impl/SmartsRecommenderFeature', './api/SmartsRecommenderAPI', './api/DeprecatedSmartsRecommenderAPI'], function (APIFactory, SmartsRecommenderFeature, SmartsRecommenderAPI, DeprecatedSmartsRecommenderAPI) { 'use strict'; var VisualizationSmartsRecommender = function (_SmartsRecommenderFea) { _inherits(VisualizationSmartsRecommender, _SmartsRecommenderFea); function VisualizationSmartsRecommender(options) { _classCallCheck(this, VisualizationSmartsRecommender); var _this = _possibleConstructorReturn(this, _SmartsRecommenderFea.call(this, options)); _this._api = APIFactory.createAPI(_this, [SmartsRecommenderAPI]); _this._deprecatedAPI = APIFactory.createAPI(_this, [DeprecatedSmartsRecommenderAPI]); return _this; } VisualizationSmartsRecommender.prototype.destroy = function destroy() { _SmartsRecommenderFea.prototype.destroy.call(this); this._api = null; this._deprecatedAPI = null; }; VisualizationSmartsRecommender.prototype.getAPI = function getAPI(type) { if (type === 'deprecated') { return this._deprecatedAPI; } return this._api; }; VisualizationSmartsRecommender.prototype.recommendAlternateContent = function recommendAlternateContent() { throw new Error('Not implemented yet'); }; VisualizationSmartsRecommender.prototype.recommendRelatedContent = function recommendRelatedContent() { throw new Error('Not implemented yet'); }; VisualizationSmartsRecommender.prototype.recommendAlternateVisualizationsAsWidgetSpecs = function recommendAlternateVisualizationsAsWidgetSpecs(dataSourceId, columnIds) { var _this2 = this; return _SmartsRecommenderFea.prototype.recommendAlternateVisualizationsFromColumnIds.call(this, dataSourceId, columnIds).then(function (recommendations) { return _this2._transformToWidgetSpecs(recommendations, dataSourceId); }); }; // deprecated interface -- called by explore VisualizationSmartsRecommender.prototype.recommendRelatedVisualizationsAsWidgetSpecs = function recommendRelatedVisualizationsAsWidgetSpecs(dataSourceId, columnIds, includeBestVisForTargetFields) { var _this3 = this; return _SmartsRecommenderFea.prototype.recommendRelatedVisualizationsFromColumnIds.call(this, dataSourceId, columnIds, null, includeBestVisForTargetFields).then(function (recommendations) { return _this3._transformToWidgetSpecs(recommendations, dataSourceId); }); }; VisualizationSmartsRecommender.prototype.transformRecommendationsToLiveWidgetSpecs = function transformRecommendationsToLiveWidgetSpecs(recommendations, sourceId) { var transformedRecommendations = this._visRecommenderDelegator.smarts._transformRecommendationResponse(sourceId, recommendations); return this._transformToWidgetSpecs(transformedRecommendations, sourceId); }; VisualizationSmartsRecommender.prototype._transformToWidgetSpecs = function _transformToWidgetSpecs(recommendations, sourceId) { return this._transformWidgetRecommendationsToLiveWidgetSpecs(recommendations, { type: 'live', data: { dataViews: [{ id: 'id_123', modelRef: sourceId }] } }); }; return VisualizationSmartsRecommender; }(SmartsRecommenderFeature); return VisualizationSmartsRecommender; }); //# sourceMappingURL=SmartsRecommender.js.map