"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.uploadBase64 = exports.getImageBase64ByUrl = exports.getBase64DownloadUrl = exports.addShare = void 0;

var _axios = _interopRequireDefault(require("axios"));

var _BSGlobal$tenantInfo, _BSGlobal$loginUserIn;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var tenantId = BSGlobal && ((_BSGlobal$tenantInfo = BSGlobal.tenantInfo) === null || _BSGlobal$tenantInfo === void 0 ? void 0 : _BSGlobal$tenantInfo.Id) || 0;
var userId = BSGlobal && ((_BSGlobal$loginUserIn = BSGlobal.loginUserInfo) === null || _BSGlobal$loginUserIn === void 0 ? void 0 : _BSGlobal$loginUserIn.Id) || 0;

var requestDomain = function requestDomain() {
  if (!window.location.hostname.match(/dev/)) return "";
  return "http://www.tita.gift";
};

var getImageBase64ByUrl = function getImageBase64ByUrl(toUserId) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/okr/share/getBase64Str"), {
    toUserId: toUserId
  }).then(function (getBase64Str) {
    return getBase64Str.data;
  });
};

exports.getImageBase64ByUrl = getImageBase64ByUrl;

var getBase64DownloadUrl = function getBase64DownloadUrl(base64) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/okr/share/imageDownLoadDfs"), {
    SharePicLink: base64
  }).then(function (dfs) {
    return dfs.data;
  });
};

exports.getBase64DownloadUrl = getBase64DownloadUrl;

var uploadBase64 = function uploadBase64(base64) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/okr/share/imagedfs"), {
    SharePicLink: base64
  }).then(function (dfs) {
    return dfs.data;
  });
};

exports.uploadBase64 = uploadBase64;

var addShare = function addShare(data) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v2/").concat(tenantId, "/").concat(userId, "/user/feed/AddShare"), data).then(function (dfs) {
    return dfs.data;
  });
};

exports.addShare = addShare;