@foreverrbum/ethsign
Version:
This package will allow you to electronically sign documents within your application
700 lines (622 loc) • 31 kB
JavaScript
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _view = _interopRequireDefault(require("../../assets/contracts_actions/view.svg"));
var _sign = _interopRequireDefault(require("../../assets/contracts_actions/sign.svg"));
var _archive = _interopRequireDefault(require("../../assets/contracts_actions/archive.svg"));
var _download = _interopRequireDefault(require("../../assets/contracts_actions/download.svg"));
var _history = _interopRequireDefault(require("../../assets/contracts_actions/history.svg"));
var _info = _interopRequireDefault(require("../../assets/contracts_actions/info.svg"));
var _reactRouterDom = require("react-router-dom");
var _download2 = require("../../helpers/download");
var _dashboard = require("../../helpers/dashboard");
var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
var _Alert = _interopRequireDefault(require("../Alert"));
var _reactIntl = require("react-intl");
var _DownloadPDF = _interopRequireDefault(require("../PDF/DownloadPDF"));
var _reactCopyToClipboard = _interopRequireDefault(require("react-copy-to-clipboard"));
var _moment = _interopRequireDefault(require("moment"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var ContractActions = function ContractActions(props) {
var _doc$creation, _doc$expiration, _doc$expiration2;
var doc = props.doc,
signers = props.signers,
initiator = props.initiator,
contract = props.contract,
provider = props.provider,
idx = props.idx,
handleArchiveData = props.handleArchiveData,
filter = props.filter,
error = props.error,
reloadContractDetails = props.reloadContractDetails; // onClick={()=>{handleData(doc.documentKey, 3)}} for deleting
// onClick={()=>{handleData(doc.documentKey, 1)}} for updating data
var _useState = (0, _react.useState)(false),
_useState2 = _slicedToArray(_useState, 2),
loading = _useState2[0],
handleLoading = _useState2[1];
var _useState3 = (0, _react.useState)(false),
_useState4 = _slicedToArray(_useState3, 2),
archivedWaiting = _useState4[0],
handleArchivedWaiting = _useState4[1];
var _useState5 = (0, _react.useState)(false),
_useState6 = _slicedToArray(_useState5, 2),
showPasswordPopup = _useState6[0],
handleShowPasswordPopup = _useState6[1];
var _useState7 = (0, _react.useState)(false),
_useState8 = _slicedToArray(_useState7, 2),
showArchivePopup = _useState8[0],
handleShowArchivePopup = _useState8[1];
var _useState9 = (0, _react.useState)(false),
_useState10 = _slicedToArray(_useState9, 2),
showDownloadPopup = _useState10[0],
handleShowDownloadPopup = _useState10[1];
var _useState11 = (0, _react.useState)(false),
_useState12 = _slicedToArray(_useState11, 2),
showDetailsPopup = _useState12[0],
handleShowDetailsPopup = _useState12[1];
var _useState13 = (0, _react.useState)(null),
_useState14 = _slicedToArray(_useState13, 2),
showWebviewer = _useState14[0],
handleShowWebviewer = _useState14[1];
var _useState15 = (0, _react.useState)(true),
_useState16 = _slicedToArray(_useState15, 2),
creationUseDate = _useState16[0],
handleCreationUseDate = _useState16[1];
var _useState17 = (0, _react.useState)(true),
_useState18 = _slicedToArray(_useState17, 2),
expirationUseDate = _useState18[0],
handleExpirationUseDate = _useState18[1];
var _useIntl = (0, _reactIntl.useIntl)(),
formatMessage = _useIntl.formatMessage;
var handleSignSubmission = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var password, fileArr, sigArr;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
handleLoading(true);
password = doc.withPassword == true ? document.getElementById('password_input') ? document.getElementById('password_input').value : '' : '';
_context.next = 4;
return (0, _download2.getFileArray)(password, doc.ipfsHash, doc.storageProvider, false, formatMessage);
case 4:
fileArr = _context.sent;
sigArr = null;
if (!(fileArr != false)) {
_context.next = 12;
break;
}
if (!(doc.metaHash != null && doc.metaHash != undefined)) {
_context.next = 11;
break;
}
_context.next = 10;
return (0, _download2.getFileArray)(password, doc.metaHash, doc.storageProvider, false, formatMessage);
case 10:
sigArr = _context.sent;
case 11:
props.history.push({
pathname: '/sign',
state: {
doc: doc,
idx: idx,
fileArr: fileArr,
sigArr: sigArr,
commentData: doc.commentData,
password: password
}
});
case 12:
handleLoading(false);
case 13:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function handleSignSubmission() {
return _ref.apply(this, arguments);
};
}();
var handleDownloadSubmission = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
var password;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
// console.log(data)
handleLoading(true);
password = doc.withPassword == true ? document.getElementById('password_input') ? document.getElementById('password_input').value : '' : '';
handleShowWebviewer({
password: password,
doc: doc
}); // await downloadFile(password, doc.ipfsHash, doc.name, () => handleShowDownloadPopup(false), doc.storageProvider, formatMessage);
handleLoading(false);
case 4:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function handleDownloadSubmission() {
return _ref2.apply(this, arguments);
};
}();
var handleArchiveSubmission = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
var tx;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
handleLoading(true);
_context3.next = 3;
return (0, _dashboard.archiveDocuments)(provider, contract, [doc.documentKey], handleArchivedWaiting, formatMessage);
case 3:
tx = _context3.sent;
// console.log(tx)
if (tx == true) {
handleArchiveData(doc.documentKey, 3);
handleShowArchivePopup(false);
(0, _dashboard.storeNotif)('', formatMessage({
id: 'SUCCESSFULLY_ARCHIVED_CONTRACT'
}), 'success');
}
handleLoading(false);
handleArchivedWaiting(false);
case 7:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function handleArchiveSubmission() {
return _ref3.apply(this, arguments);
};
}();
var handleHistorySubmission = /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
handleLoading(true);
props.history.push({
pathname: '/history',
state: {
doc: doc,
signers: signers,
initiator: initiator,
idx: idx
}
});
handleLoading(false);
case 3:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
return function handleHistorySubmission() {
return _ref4.apply(this, arguments);
};
}();
var handleReuploadDocument = /*#__PURE__*/function () {
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
handleLoading(true);
props.history.push({
pathname: '/upload',
state: {
doc: doc,
filter: filter,
idx: idx
}
});
handleLoading(false);
case 3:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
return function handleReuploadDocument() {
return _ref5.apply(this, arguments);
};
}();
if (!doc) {
return null;
}
return doc.status == 0 || error ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
className: "select-none bg-red-100 text-red-500 hover:bg-red-150 active:bg-red-200 outline-none py-1 px-2 rounded",
onClick: function onClick(event) {
event.stopPropagation();
if (doc.status == 0) {
handleReuploadDocument();
} else {
reloadContractDetails(doc.documentKey, idx);
}
}
}, doc.status == 0 ? 'Upload PDF' : formatMessage({
id: 'RETRY'
}))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
className: "rounded-lg text-xs text-white px-2 py-0 bg-gray-300",
delayShow: 500,
delayHide: 100,
offset: {
'top': -10
},
arrowColor: "rgba(0,0,0,0)",
place: "top",
type: "dark",
effect: "solid"
}), /*#__PURE__*/_react.default.createElement("img", {
onClick: function onClick(event) {
event.stopPropagation();
if (doc.status === 0 || doc.status === '') {
return;
}
if (doc.withPassword == false) {
handleLoading(true);
handleSignSubmission();
} else {
handleShowPasswordPopup(true);
}
},
"data-tip": doc.status == 2 ? formatMessage({
id: "SIGN"
}) : formatMessage({
id: "VIEW"
}),
style: {
opacity: doc.status === 0 || doc.status === '' ? '.5' : '1'
},
src: doc.status == 2 ? _sign.default : _view.default,
className: "select-none mr-2 cursor-pointer"
}), filter !== 'archived' && /*#__PURE__*/_react.default.createElement("img", {
onClick: function onClick(event) {
event.stopPropagation();
if (filter == 'archived') {
return;
}
handleShowArchivePopup(true);
},
"data-tip": formatMessage({
id: "ARCHIVE"
}),
style: {
opacity: filter == 'archived' ? '.5' : '1'
},
src: _archive.default,
className: "select-none mr-2 cursor-pointer"
}), /*#__PURE__*/_react.default.createElement("img", {
onClick: function onClick(event) {
event.stopPropagation();
if (doc.status === 0 || doc.status === '') {
return;
}
if (doc.withPassword == false) {
handleLoading(true);
handleDownloadSubmission();
} else {
handleShowDownloadPopup(true);
}
},
"data-tip": formatMessage({
id: 'DOWNLOAD'
}),
style: {
opacity: doc.status === 0 || doc.status === '' ? '.5' : '1'
},
src: _download.default,
className: "select-none mr-2 cursor-pointer"
}), /*#__PURE__*/_react.default.createElement("img", {
"data-tip": formatMessage({
id: 'HISTORY'
}),
onClick: handleHistorySubmission,
src: _history.default,
className: "select-none mr-2 cursor-pointer"
}), /*#__PURE__*/_react.default.createElement("img", {
onClick: function onClick(event) {
event.stopPropagation();
var date = "".concat(_moment.default.unix(doc === null || doc === void 0 ? void 0 : doc.creation.date).format('lll'), " \n ").concat(doc !== null && doc !== void 0 && doc.expiration.date ? "- ".concat(_moment.default.unix(doc === null || doc === void 0 ? void 0 : doc.expiration.date).format('lll')) : '');
handleCreationUseDate(true);
handleExpirationUseDate(true);
handleShowDetailsPopup(true);
},
"data-tip": formatMessage({
id: 'DETAILS'
}),
src: _info.default,
className: "select-none mr-2 cursor-pointer"
}), showPasswordPopup && /*#__PURE__*/_react.default.createElement(_Alert.default, {
title: formatMessage({
id: 'DOCUMENT_PASSWORD'
}),
message: formatMessage({
id: 'THIS_CONTRACT_IS_PROTECTED'
}),
loading: loading,
displayLoader: doc.withPassword ? false : true,
loadingText: doc.withPassword ? formatMessage({
id: 'DECRYPTING_YOUR_FILE_WITH_POINT'
}) : formatMessage({
id: 'LOADING'
}),
closeCallback: function closeCallback() {
return handleShowPasswordPopup(false);
},
closeButtonText: formatMessage({
id: 'CANCEL'
}),
okCallback: function okCallback() {
return handleSignSubmission();
},
okButtonText: formatMessage({
id: "OK"
}),
closeOnOutsideClick: true,
customComponent: /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-wrap sm:flex-nowrap justify-start"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "mb-2 sm:my-auto mr-4 hidden sm:block"
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
id: "PASSWORD"
}), ":"), /*#__PURE__*/_react.default.createElement("form", {
onSubmit: function onSubmit(e) {
e.preventDefault();
handleSignSubmission();
}
}, /*#__PURE__*/_react.default.createElement("input", {
placeholder: formatMessage({
id: 'ENTER_YOUR_PASSWORD'
}),
required: false,
name: "password",
type: "password",
autoComplete: "new-password",
autoFocus: true,
maxLength: 32,
id: "password_input",
className: "flex-grow-1 rounded-sm focus:outline-none rounded-sm px-4 py-1 border mr-0 border-gray-200"
})))
}), showArchivePopup && /*#__PURE__*/_react.default.createElement(_Alert.default, {
title: formatMessage({
id: 'ARCHIVE_CONTRACT'
}),
message: formatMessage({
id: 'ARE_YOU_WANT_TO_ARCHIVE_THE_DOC'
}, {
name: doc.name
}),
closeButtonText: formatMessage({
id: 'CANCEL'
}),
loading: loading,
loadingText: archivedWaiting ? formatMessage({
id: 'WAITING_FOR_CONFIRMATIONS_FROM_NEWWORK'
}) : formatMessage({
id: 'ARCHIVING_CONTRACT'
}),
closeCallback: function closeCallback() {
return handleShowArchivePopup(false);
},
closeOnOutsideClick: true,
okButtonText: formatMessage({
id: 'ARCHIVE'
}),
okCallback: function okCallback() {
handleArchiveSubmission();
}
}), showDownloadPopup && /*#__PURE__*/_react.default.createElement(_Alert.default, {
title: formatMessage({
id: 'DOCUMENT_PASSWORD'
}),
message: formatMessage({
id: 'THIS_CONTRACT_IS_PROTECTED'
}),
loading: loading,
displayLoader: doc.withPassword ? false : true,
loadingText: doc.withPassword ? formatMessage({
id: 'DECRYPTING_YOUR_FILE_WITH_POINT'
}) : formatMessage({
id: 'LOADING'
}),
closeCallback: function closeCallback() {
return handleShowDownloadPopup(false);
},
closeOnOutsideClick: true,
closeButtonText: formatMessage({
id: "CANCEL"
}),
okCallback: function okCallback() {
return handleDownloadSubmission();
},
okButtonText: formatMessage({
id: "OK"
}),
customComponent: /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-wrap sm:flex-nowrap justify-start"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "mb-2 sm:my-auto mr-4 hidden sm:block"
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
id: "PASSWORD"
}), ":"), /*#__PURE__*/_react.default.createElement("form", {
onSubmit: function onSubmit(e) {
e.preventDefault();
handleDownloadSubmission();
}
}, /*#__PURE__*/_react.default.createElement("input", {
placeholder: formatMessage({
id: 'ENTER_YOUR_PASSWORD'
}),
required: false,
name: "password",
type: "password",
autoComplete: "new-password",
autoFocus: true,
maxLength: 32,
id: "password_input",
className: "flex-grow-1 rounded-sm focus:outline-none rounded-sm px-4 py-1 border mr-0 border-gray-200"
})))
}), showDetailsPopup && /*#__PURE__*/_react.default.createElement(_Alert.default, {
title: formatMessage({
id: 'DOCUMENT_DETAILS'
}),
type: 2,
closeCallback: function closeCallback() {
return handleShowDetailsPopup(false);
},
closeOnOutsideClick: true,
customComponent: /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-wrap sm:flex-nowrap justify-start flex-col w-full text-gray"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pt-4 pb-6"
}, /*#__PURE__*/_react.default.createElement("div", null, formatMessage({
id: 'UPLOADED_DOCUMENT'
}) + ":"), /*#__PURE__*/_react.default.createElement("div", {
className: "text-right"
}, doc.name)), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-2"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-col"
}, /*#__PURE__*/_react.default.createElement("div", null, (creationUseDate ? formatMessage({
id: "CREATED_DATE"
}) : formatMessage({
id: "CREATION_BLOCK"
})) + ":"), /*#__PURE__*/_react.default.createElement("div", {
onClick: function onClick() {
return handleCreationUseDate(!creationUseDate);
},
className: "cursor-pointer select-none text-10 underline text-blue-200"
}, creationUseDate ? formatMessage({
id: "CREATION_BLOCK"
}) : formatMessage({
id: "CREATED_DATE"
}))), /*#__PURE__*/_react.default.createElement("div", {
className: "text-right"
}, creationUseDate ? "".concat(_moment.default.unix(doc === null || doc === void 0 ? void 0 : doc.creation.date).format('lll'), " \n ").concat(doc !== null && doc !== void 0 && doc.expiration.date ? "- ".concat(_moment.default.unix(doc === null || doc === void 0 ? void 0 : doc.expiration.date).format('lll')) : '') : (_doc$creation = doc.creation) === null || _doc$creation === void 0 ? void 0 : _doc$creation.block)), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-2"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-col"
}, /*#__PURE__*/_react.default.createElement("div", null, (expirationUseDate ? formatMessage({
id: "EXPIRATION_DATE"
}) : formatMessage({
id: "EXPIRATION_BLOCK"
})) + ":"), /*#__PURE__*/_react.default.createElement("div", {
onClick: function onClick() {
return handleExpirationUseDate(!expirationUseDate);
},
className: "cursor-pointer select-none text-10 underline text-blue-200"
}, expirationUseDate ? formatMessage({
id: "EXPIRATION_BLOCK"
}) : formatMessage({
id: "EXPIRATION_DATE"
}))), /*#__PURE__*/_react.default.createElement("div", {
className: "text-right"
}, expirationUseDate ? (_doc$expiration = doc.expiration) !== null && _doc$expiration !== void 0 && _doc$expiration.date ? doc.expiration.date : formatMessage({
id: 'NEVER'
}) : ((_doc$expiration2 = doc.expiration) === null || _doc$expiration2 === void 0 ? void 0 : _doc$expiration2.block) !== 'Never' ? doc.expiration.block : formatMessage({
id: 'NEVER'
}))), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-6"
}, /*#__PURE__*/_react.default.createElement("div", null, formatMessage({
id: "DOCUMENT_KEY"
}) + ":"), /*#__PURE__*/_react.default.createElement("div", {
className: "flex"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "pr-1 text-right"
}, doc.documentKey && doc.documentKey.slice(0, 6) + '...' + doc.documentKey.slice(doc.documentKey.length - 6)), /*#__PURE__*/_react.default.createElement(_reactCopyToClipboard.default, {
text: doc.documentKey
}, /*#__PURE__*/_react.default.createElement("div", {
className: "inline mb-1 cursor-pointer"
}, /*#__PURE__*/_react.default.createElement("svg", {
width: "15",
height: "17",
viewBox: "0 0 15 17",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/_react.default.createElement("path", {
d: "M13.4375 0.1875H3.49219C3.41055 0.1875 3.34375 0.254297 3.34375 0.335938V1.375C3.34375 1.45664 3.41055 1.52344 3.49219 1.52344H12.6953V14.2891C12.6953 14.3707 12.7621 14.4375 12.8438 14.4375H13.8828C13.9645 14.4375 14.0312 14.3707 14.0312 14.2891V0.78125C14.0312 0.452832 13.7659 0.1875 13.4375 0.1875ZM11.0625 2.5625H1.5625C1.23408 2.5625 0.96875 2.82783 0.96875 3.15625V13.0032C0.96875 13.1609 1.03184 13.3112 1.14316 13.4226L4.35869 16.6381C4.39951 16.6789 4.4459 16.7123 4.496 16.7401V16.7754H4.57393C4.63887 16.7995 4.70752 16.8125 4.77803 16.8125H11.0625C11.3909 16.8125 11.6562 16.5472 11.6562 16.2188V3.15625C11.6562 2.82783 11.3909 2.5625 11.0625 2.5625ZM4.49414 14.8865L2.89658 13.2871H4.49414V14.8865ZM10.3203 15.4766H5.68164V12.8418C5.68164 12.4317 5.34951 12.0996 4.93945 12.0996H2.30469V3.89844H10.3203V15.4766Z",
fill: "currentColor"
})))))), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-6"
}, /*#__PURE__*/_react.default.createElement("div", null, formatMessage({
id: "DOCUMENT_STORAGE_CID"
}) + ":"), /*#__PURE__*/_react.default.createElement("div", {
className: "flex"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "pr-1 text-right"
}, doc.ipfsHash && doc.ipfsHash.slice(0, 6) + '...' + doc.ipfsHash.slice(doc.ipfsHash.length - 6), !doc.ipfsHash && '--'), /*#__PURE__*/_react.default.createElement(_reactCopyToClipboard.default, {
text: doc.ipfsHash
}, /*#__PURE__*/_react.default.createElement("div", {
className: "inline mb-1 cursor-pointer"
}, /*#__PURE__*/_react.default.createElement("svg", {
width: "15",
height: "17",
viewBox: "0 0 15 17",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/_react.default.createElement("path", {
d: "M13.4375 0.1875H3.49219C3.41055 0.1875 3.34375 0.254297 3.34375 0.335938V1.375C3.34375 1.45664 3.41055 1.52344 3.49219 1.52344H12.6953V14.2891C12.6953 14.3707 12.7621 14.4375 12.8438 14.4375H13.8828C13.9645 14.4375 14.0312 14.3707 14.0312 14.2891V0.78125C14.0312 0.452832 13.7659 0.1875 13.4375 0.1875ZM11.0625 2.5625H1.5625C1.23408 2.5625 0.96875 2.82783 0.96875 3.15625V13.0032C0.96875 13.1609 1.03184 13.3112 1.14316 13.4226L4.35869 16.6381C4.39951 16.6789 4.4459 16.7123 4.496 16.7401V16.7754H4.57393C4.63887 16.7995 4.70752 16.8125 4.77803 16.8125H11.0625C11.3909 16.8125 11.6562 16.5472 11.6562 16.2188V3.15625C11.6562 2.82783 11.3909 2.5625 11.0625 2.5625ZM4.49414 14.8865L2.89658 13.2871H4.49414V14.8865ZM10.3203 15.4766H5.68164V12.8418C5.68164 12.4317 5.34951 12.0996 4.93945 12.0996H2.30469V3.89844H10.3203V15.4766Z",
fill: "currentColor"
})))))), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-6"
}, /*#__PURE__*/_react.default.createElement("div", null, formatMessage({
id: "DOCUMENT_META_STORAGE_CID"
}) + ":"), /*#__PURE__*/_react.default.createElement("div", {
className: "flex"
}, /*#__PURE__*/_react.default.createElement("div", {
className: "pr-1 text-right"
}, doc.metaHash && doc.metaHash.slice(0, 6) + '...' + doc.metaHash.slice(doc.metaHash.length - 6), !doc.metaHash && '--'), /*#__PURE__*/_react.default.createElement(_reactCopyToClipboard.default, {
text: doc.metaHash
}, /*#__PURE__*/_react.default.createElement("div", {
className: "inline mb-1 cursor-pointer"
}, /*#__PURE__*/_react.default.createElement("svg", {
width: "15",
height: "17",
viewBox: "0 0 15 17",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/_react.default.createElement("path", {
d: "M13.4375 0.1875H3.49219C3.41055 0.1875 3.34375 0.254297 3.34375 0.335938V1.375C3.34375 1.45664 3.41055 1.52344 3.49219 1.52344H12.6953V14.2891C12.6953 14.3707 12.7621 14.4375 12.8438 14.4375H13.8828C13.9645 14.4375 14.0312 14.3707 14.0312 14.2891V0.78125C14.0312 0.452832 13.7659 0.1875 13.4375 0.1875ZM11.0625 2.5625H1.5625C1.23408 2.5625 0.96875 2.82783 0.96875 3.15625V13.0032C0.96875 13.1609 1.03184 13.3112 1.14316 13.4226L4.35869 16.6381C4.39951 16.6789 4.4459 16.7123 4.496 16.7401V16.7754H4.57393C4.63887 16.7995 4.70752 16.8125 4.77803 16.8125H11.0625C11.3909 16.8125 11.6562 16.5472 11.6562 16.2188V3.15625C11.6562 2.82783 11.3909 2.5625 11.0625 2.5625ZM4.49414 14.8865L2.89658 13.2871H4.49414V14.8865ZM10.3203 15.4766H5.68164V12.8418C5.68164 12.4317 5.34951 12.0996 4.93945 12.0996H2.30469V3.89844H10.3203V15.4766Z",
fill: "currentColor"
})))))), /*#__PURE__*/_react.default.createElement("div", {
className: "flex flex-row justify-between pb-2"
}, /*#__PURE__*/_react.default.createElement("div", null, formatMessage({
id: "STORAGE_PROVIDER"
}) + ":"), /*#__PURE__*/_react.default.createElement("div", {
className: "text-right"
}, doc.storageProvider == "IP" ? 'IPFS (Arweave)' : doc.storageProvider == "FL" ? 'IPFS (Fleek)' : doc.storageProvider == "AR" ? "Arweave" : "Unknown")))
}), showWebviewer && /*#__PURE__*/_react.default.createElement(_DownloadPDF.default, {
data: showWebviewer,
handleShowWebviewer: handleShowWebviewer,
handleShowDownloadPopup: handleShowDownloadPopup
}));
};
var _default = (0, _reactRouterDom.withRouter)(ContractActions);
exports.default = _default;