UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

69 lines (66 loc) 10.2 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.createNotification = createNotification; exports.successNotification = exports.exportImageError = exports.errorNotification = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _commonUtils = require("@kepler.gl/common-utils"); var _constants = require("@kepler.gl/constants"); var _excluded = ["message", "type", "topic", "id", "count"]; // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Creates a notification */ function createNotification(_ref) { var _ref$message = _ref.message, message = _ref$message === void 0 ? _constants.DEFAULT_NOTIFICATION_MESSAGE : _ref$message, _ref$type = _ref.type, type = _ref$type === void 0 ? _constants.DEFAULT_NOTIFICATION_TYPES.info : _ref$type, _ref$topic = _ref.topic, topic = _ref$topic === void 0 ? _constants.DEFAULT_NOTIFICATION_TOPICS.global : _ref$topic, _ref$id = _ref.id, id = _ref$id === void 0 ? (0, _commonUtils.generateHashId)(_constants.DEFAULT_UUID_COUNT) : _ref$id, _ref$count = _ref.count, count = _ref$count === void 0 ? 1 : _ref$count, options = (0, _objectWithoutProperties2["default"])(_ref, _excluded); return _objectSpread(_objectSpread({}, options), {}, { id: id, message: message, type: type, topic: topic, count: count > 99 ? 99 : count // no more than 2 digits }); } /** * Creates an error notification * @param options * @returns {{topic, id, message, type: (null|number)}} */ var errorNotification = exports.errorNotification = function errorNotification(options) { return _objectSpread(_objectSpread({}, createNotification(options)), {}, { type: _constants.DEFAULT_NOTIFICATION_TYPES.error }); }; /** * Creates a success notification * @param options * @returns {{topic, id, message, type: null}} */ var successNotification = exports.successNotification = function successNotification(options) { return _objectSpread(_objectSpread({}, createNotification(options)), {}, { type: _constants.DEFAULT_NOTIFICATION_TYPES.success }); }; var exportImageError = exports.exportImageError = function exportImageError(options) { return errorNotification(_objectSpread(_objectSpread({}, options), {}, { id: 'EXPORT_IMAGE_ERROR_ID', topic: _constants.DEFAULT_NOTIFICATION_TOPICS.global, message: "Failed to export image, please take a screenshot of the javascript console, report the with [this link](".concat(_constants.BUG_REPORT_LINK, ") ") })); }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfY29tbW9uVXRpbHMiLCJyZXF1aXJlIiwiX2NvbnN0YW50cyIsIl9leGNsdWRlZCIsIm93bktleXMiLCJlIiwiciIsInQiLCJPYmplY3QiLCJrZXlzIiwiZ2V0T3duUHJvcGVydHlTeW1ib2xzIiwibyIsImZpbHRlciIsImdldE93blByb3BlcnR5RGVzY3JpcHRvciIsImVudW1lcmFibGUiLCJwdXNoIiwiYXBwbHkiLCJfb2JqZWN0U3ByZWFkIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiZm9yRWFjaCIsIl9kZWZpbmVQcm9wZXJ0eTIiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzIiwiZGVmaW5lUHJvcGVydGllcyIsImRlZmluZVByb3BlcnR5IiwiY3JlYXRlTm90aWZpY2F0aW9uIiwiX3JlZiIsIl9yZWYkbWVzc2FnZSIsIm1lc3NhZ2UiLCJERUZ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