@corva/ui 0.35.0-0 → 0.35.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import t from'./../../../../../../ext-esm/style-inject/dist/style-inject.es.js';var n={cAnnotationCommentsList:"style_cAnnotationCommentsList__QB1u0",cAnnotationCommentsListItems:"style_cAnnotationCommentsListItems__M9gf7",cAnnotationCommentsListInput:"style_cAnnotationCommentsListInput__jsIk6"};t(".style_cAnnotationCommentsList__QB1u0{margin-top:5px}.style_cAnnotationCommentsListItems__M9gf7{margin-bottom:5px;padding:0 0 5px 19px}.style_cAnnotationCommentsListInput__jsIk6{margin-left:18px;padding-bottom:15px}.style_cAnnotationCommentsListInput__jsIk6 .c-user-mention{font-size:14px}");export{n as default};
1
+ import t from'./../../../../../../ext-esm/style-inject/dist/style-inject.es.js';var n={cAnnotationCommentsList:"style_cAnnotationCommentsList__QB1u0",cAnnotationCommentsListItems:"style_cAnnotationCommentsListItems__M9gf7",cAnnotationCommentsListInput:"style_cAnnotationCommentsListInput__jsIk6"};t(".style_cAnnotationCommentsList__QB1u0{margin-top:5px}.style_cAnnotationCommentsListItems__M9gf7{margin-bottom:5px;padding:0 0 5px 19px}.style_cAnnotationCommentsListInput__jsIk6{padding-bottom:15px}.style_cAnnotationCommentsListInput__jsIk6 .c-user-mention{font-size:14px}");export{n as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as t,useCallback as a}from"react";import i from"prop-types";import o from"react-player";import{withStyles as r}from"@material-ui/core/styles";import l from"@material-ui/core/Typography";import n from"@material-ui/core/IconButton";import{Dialog as s}from"@material-ui/core";import m from"@material-ui/icons/Image";import c from"@material-ui/icons/SaveAlt";import d from"@material-ui/icons/Fullscreen";import p from"@material-ui/core/colors/grey";import h from"../FileTypeIcon.js";import u from"../ImageViewer/index.js";import f from"../GoogleDocsViewer/index.js";import{isNativeDetected as g}from"../../utils/mobileDetect.js";import{getIsImage as v,getIsVideo as b}from"../../utils/fileExtension.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import N from"../../effects/useSignedURL.js";import w from"../../utils/main.js";import y from"./styles.css.js";import{jsx as x,jsxs as I,Fragment as A}from"react/jsx-runtime";var j=p[200],P=p[400],L=p[600],U={label:"small",value:135},z={label:"medium",value:300},F={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===U.label?U.value:z.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{marginTop:10,padding:"10px 10px 10px 5px",border:"1px solid ".concat(L),borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:j,borderRadius:3,marginTop:10,height:135,width:135}},W=function(e){return I(A,{children:[I("div",{onClick:e.openLightbox,className:y.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:e.attachmentUrl,style:F.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),x("div",{"data-testid":"".concat("Attachment","_button"),className:y.cAttachmentImgPreviwBtn,children:x(d,{})})]}),!e.imageIsLoaded&&x("div",{style:F.imagePlaceholder,children:x(m,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),e.lightboxIsOpen&&x(u,{mainSrc:e.attachmentUrl,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},R=function(e){return I("div",{className:y.cAttachmentFileWrapper,children:[I("div",{className:y.cAttachmentFileDownloadWrapper,style:F.fileDownloadWrapper,onClick:e.openPreview,children:[x(h,{fileName:e.displayName||e.attachmentUrl,className:y.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),x("div",{"data-testid":"".concat("Attachment","_name"),className:y.cAttachmentFileDownloadWrapperFileName,children:x(l,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),x(s,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:g?e.classes.nativeDialog:e.classes.dialog},children:x(f,{fileUrl:e.attachmentUrl,fileName:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),x("a",{download:e.displayName,href:e.attachmentUrl,className:y.cAttachmentFileDownloadWrapperForm,children:x(n,{"data-testid":"".concat("Attachment","_downloadButton"),type:"submit",children:x(c,{className:e.classes.downloadIcon})})})]})};function D(i){var r=t(!1),l=e(r,2),n=l[0],s=l[1],m=t(!1),c=e(m,2),d=c[0],p=c[1],h=t(!1),u=e(h,2),f=u[0],w=u[1],I=i.displayName||i.attachmentUrl||i.fileName,A=v(I),j=b(I),P=N(!i.attachmentUrl&&i.fileName),L=i.attachmentUrl||P,F=a((function(e){return e.preventDefault()}),[]);return A?x("div",{className:y.cAttachment,children:x(W,{size:i.size,openLightbox:function(){return p(!0)},attachmentUrl:L,setImageIsLoaded:function(){return s(!0)},imageIsLoaded:n,lightboxIsOpen:d,handleLightboxOpen:function(){g&&document.documentElement.addEventListener("touchmove",F,{passive:!1})},handleLightboxClose:function(){g&&document.documentElement.removeEventListener("touchmove",F),p(!1)},classes:i.classes})}):j&&o.canPlay(L)?x("div",{className:y.cAttachment,children:x(o,{"data-testid":"".concat("Attachment","_player"),className:y.cAttachmentReactPlayer,url:L,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:i.size===U.label?U.value:z.value,width:null})}):x("div",{className:y.cAttachment,children:x(R,{attachmentUrl:L,attachmentSize:i.attachmentSize,displayName:i.displayName,openPreview:function(){return w(!0)},closePreview:function(e){e.stopPropagation(),w(!1)},previewIsOpen:f,classes:i.classes,small:i.small})})}D.propTypes={attachmentUrl:i.string.isRequired,attachmentSize:i.number,displayName:i.string,fileName:i.string,size:i.oneOf([U.label,z.label]),classes:i.shape({}).isRequired,small:i.bool},D.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var S=r((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},downloadIcon:{color:L,"&:hover":{color:e.palette.common.white}}}}))(D);export{S as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as t,useCallback as a}from"react";import i from"prop-types";import o from"react-player";import{withStyles as r}from"@material-ui/core/styles";import l from"@material-ui/core/Typography";import{Dialog as n}from"@material-ui/core";import s from"@material-ui/icons/Image";import m from"@material-ui/icons/SaveAlt";import c from"@material-ui/icons/Fullscreen";import d from"@material-ui/core/colors/grey";import p from"../FileTypeIcon.js";import h from"../ImageViewer/index.js";import u from"../GoogleDocsViewer/index.js";import f from"../IconButton/index.js";import{isNativeDetected as g}from"../../utils/mobileDetect.js";import{getIsImage as v,getIsVideo as b}from"../../utils/fileExtension.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import N from"../../effects/useSignedURL.js";import w from"../../utils/main.js";import y from"./styles.css.js";import{jsx as x,jsxs as I,Fragment as j}from"react/jsx-runtime";var A=d[200],P=d[400],L={label:"small",value:135},U={label:"medium",value:300},W={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===L.label?L.value:U.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:A,borderRadius:3,marginTop:10,height:135,width:135}},z=function(e){return I(j,{children:[I("div",{onClick:e.openLightbox,className:y.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:e.attachmentUrl,style:W.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),x("div",{"data-testid":"".concat("Attachment","_button"),className:y.cAttachmentImgPreviwBtn,children:x(c,{})})]}),!e.imageIsLoaded&&x("div",{style:W.imagePlaceholder,children:x(s,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),e.lightboxIsOpen&&x(h,{mainSrc:e.attachmentUrl,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},F=function(e){return I("div",{className:y.cAttachmentFileWrapper,children:[I("div",{className:y.cAttachmentFileDownloadWrapper,style:W.fileDownloadWrapper,onClick:e.openPreview,children:[x(p,{fileName:e.displayName||e.attachmentUrl,className:y.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),x("div",{"data-testid":"".concat("Attachment","_name"),className:y.cAttachmentFileDownloadWrapperFileName,children:x(l,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),x(n,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:g?e.classes.nativeDialog:e.classes.dialog},children:x(u,{fileUrl:e.attachmentUrl,fileName:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),x("a",{download:e.displayName,href:e.attachmentUrl,className:y.cAttachmentFileDownloadWrapperForm,children:x(f,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:x(m,{className:e.classes.downloadIcon})})})]})};function R(i){var r=t(!1),l=e(r,2),n=l[0],s=l[1],m=t(!1),c=e(m,2),d=c[0],p=c[1],h=t(!1),u=e(h,2),f=u[0],w=u[1],I=i.displayName||i.attachmentUrl||i.fileName,j=v(I),A=b(I),P=N(!i.attachmentUrl&&i.fileName),W=i.attachmentUrl||P,R=a((function(e){return e.preventDefault()}),[]);return j?x("div",{className:y.cAttachment,children:x(z,{size:i.size,openLightbox:function(){return p(!0)},attachmentUrl:W,setImageIsLoaded:function(){return s(!0)},imageIsLoaded:n,lightboxIsOpen:d,handleLightboxOpen:function(){g&&document.documentElement.addEventListener("touchmove",R,{passive:!1})},handleLightboxClose:function(){g&&document.documentElement.removeEventListener("touchmove",R),p(!1)},classes:i.classes})}):A&&o.canPlay(W)?x("div",{className:y.cAttachment,children:x(o,{"data-testid":"".concat("Attachment","_player"),className:y.cAttachmentReactPlayer,url:W,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:i.size===L.label?L.value:U.value,width:null})}):x("div",{className:y.cAttachment,children:x(F,{attachmentUrl:W,attachmentSize:i.attachmentSize,displayName:i.displayName,openPreview:function(){return w(!0)},closePreview:function(e){e.stopPropagation(),w(!1)},previewIsOpen:f,classes:i.classes,small:i.small})})}R.propTypes={attachmentUrl:i.string.isRequired,attachmentSize:i.number,displayName:i.string,fileName:i.string,size:i.oneOf([L.label,U.label]),classes:i.shape({}).isRequired,small:i.bool},R.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:U.label,small:!1};var D=r((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:e.palette.primary.text3}}}))(R);export{D as default};
@@ -1 +1 @@
1
- import t from'./../../ext-esm/style-inject/dist/style-inject.es.js';var e={cAttachmentFileWrapper:"styles_cAttachmentFileWrapper__w3whH",cAttachmentFileDownloadWrapper:"styles_cAttachmentFileDownloadWrapper__bRnOU",cAttachmentFileDownloadWrapperFileIcon:"styles_cAttachmentFileDownloadWrapperFileIcon__Eew6w",cAttachmentFileDownloadWrapperFileName:"styles_cAttachmentFileDownloadWrapperFileName__K8HDS",cAttachmentFileDownloadWrapperForm:"styles_cAttachmentFileDownloadWrapperForm__a0lvj",cAttachmentReactPlayer:"styles_cAttachmentReactPlayer__-6Q9y",cAttachment:"styles_cAttachment__AiNfC",cAttachmentImg:"styles_cAttachmentImg__uS-Lc",cAttachmentImgPreviwBtn:"styles_cAttachmentImgPreviwBtn__6YA0k"};t(".styles_cAttachmentFileWrapper__w3whH{align-items:center;display:flex}.styles_cAttachmentFileDownloadWrapper__bRnOU{align-items:center;cursor:pointer;display:flex}.styles_cAttachmentFileDownloadWrapperFileIcon__Eew6w{margin-right:10px}.styles_cAttachmentFileDownloadWrapperFileName__K8HDS{display:inline-block;vertical-align:top;width:calc(100% - 60px)}.styles_cAttachmentFileDownloadWrapperForm__a0lvj{margin-left:5px}.styles_cAttachmentFileDownloadWrapper__bRnOU:hover{background-color:#616161}.styles_cAttachmentReactPlayer__-6Q9y video{background-color:#000;max-width:500px}.styles_cAttachment__AiNfC .react-player__preview{background-color:#eee;border-radius:3px;height:235px!important;max-width:500px}.styles_cAttachmentImg__uS-Lc{display:inline-block;margin-top:10px;position:relative}.styles_cAttachmentImgPreviwBtn__6YA0k{align-items:center;background-color:rgba(97,97,97,.4);border-radius:40px;cursor:pointer;display:none;height:40px;justify-content:center;position:absolute;right:10px;top:10px;width:40px}.styles_cAttachmentImg__uS-Lc:hover{opacity:.7}.styles_cAttachmentImg__uS-Lc:hover .styles_cAttachmentImgPreviwBtn__6YA0k{display:flex}");export{e as default};
1
+ import t from'./../../ext-esm/style-inject/dist/style-inject.es.js';var e={cAttachmentFileWrapper:"styles_cAttachmentFileWrapper__w3whH",cAttachmentFileDownloadWrapper:"styles_cAttachmentFileDownloadWrapper__bRnOU",cAttachmentFileDownloadWrapperFileIcon:"styles_cAttachmentFileDownloadWrapperFileIcon__Eew6w",cAttachmentFileDownloadWrapperFileName:"styles_cAttachmentFileDownloadWrapperFileName__K8HDS",cAttachmentFileDownloadWrapperForm:"styles_cAttachmentFileDownloadWrapperForm__a0lvj",cAttachmentReactPlayer:"styles_cAttachmentReactPlayer__-6Q9y",cAttachment:"styles_cAttachment__AiNfC",cAttachmentImg:"styles_cAttachmentImg__uS-Lc",cAttachmentImgPreviwBtn:"styles_cAttachmentImgPreviwBtn__6YA0k"};t(".styles_cAttachmentFileWrapper__w3whH{align-items:center;display:flex;margin-top:10px}.styles_cAttachmentFileDownloadWrapper__bRnOU{align-items:center;cursor:pointer;display:flex}.styles_cAttachmentFileDownloadWrapperFileIcon__Eew6w{margin-right:10px}.styles_cAttachmentFileDownloadWrapperFileName__K8HDS{display:inline-block;vertical-align:top;width:calc(100% - 60px)}.styles_cAttachmentFileDownloadWrapperForm__a0lvj{margin-left:5px}.styles_cAttachmentFileDownloadWrapper__bRnOU:hover{background-color:#616161}.styles_cAttachmentReactPlayer__-6Q9y video{background-color:#000;max-width:500px}.styles_cAttachment__AiNfC .react-player__preview{background-color:#eee;border-radius:3px;height:235px!important;max-width:500px}.styles_cAttachmentImg__uS-Lc{display:inline-block;margin-top:10px;position:relative}.styles_cAttachmentImgPreviwBtn__6YA0k{align-items:center;background-color:rgba(97,97,97,.4);border-radius:40px;cursor:pointer;display:none;height:40px;justify-content:center;position:absolute;right:10px;top:10px;width:40px}.styles_cAttachmentImg__uS-Lc:hover{opacity:.7}.styles_cAttachmentImg__uS-Lc:hover .styles_cAttachmentImgPreviwBtn__6YA0k{display:flex}");export{e as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/assertThisInitialized";import o from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import c from"@babel/runtime/regenerator";import{createRef as m,PureComponent as l}from"react";import p from"prop-types";import u from"moment";import{get as d,includes as h,noop as f}from"lodash";import v from"classnames";import{withStyles as g}from"@material-ui/core/styles";import y from"@material-ui/core/Typography";import b from"@material-ui/core/IconButton";import C from"@material-ui/core/Menu";import D from"@material-ui/core/MenuItem";import M from"@material-ui/icons/MoreVert";import w from"@material-ui/core/colors/grey";import E from"../CommentWrapper.js";import O from"../CommentLoader.js";import I from"../CommentInput/index.js";import j from"../Avatar/index.js";import k from"../Attachment/index.js";import x from"../ConfirmationDialog.js";import A from"../UserCardPopover.js";import{formatMentionText as _}from"../UserMention/utils/index.js";import{isNativeDetected as N}from"../../utils/mobileDetect.js";import{deleteFeedItemComment as S}from"../../clients/jsonApi/index.js";import R from"../../utils/main.js";import P from"./styles.css.js";import{jsxs as T,jsx as U}from"react/jsx-runtime";function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=a(e);if(t){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return i(this,n)}}var W={chatAvatarWrapper:{paddingTop:2,position:"absolute",top:6,left:-18},commentInfoContainer:{display:"inline-flex",alignItems:"center",width:"100%",paddingTop:5},userNameWrapper:{overflow:"hidden"},infoContainer:{display:"inline-block",verticalAlign:"top",width:"100%",paddingLeft:10}},B={commentWrapper:{width:"calc(100% - 10px)"},timeRoot:{color:w[700],float:"right",marginRight:5,marginLeft:10,fontSize:"10px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",height:40,width:40,padding:0,visibility:"hidden"},userName:{fontSize:"12px"}},q=function(i){o(p,l);var a=L(p);function p(n){var o,i;return t(this,p),o=a.call(this,n),s(r(o),"deleteComment",(i=e(c.mark((function e(t,n){var r;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,S(t,n);case 3:r=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,t){return i.apply(this,arguments)})),s(r(o),"showIntoView",(function(){o.props.handleShowOnMount(),o.commentEl.current.scrollIntoView({block:"end"})})),s(r(o),"handleToggleActionsMenu",(function(e){var t=e.currentTarget;o.setState((function(e){return{actionsMenuAnchorEl:e.actionsMenuAnchorEl?null:t}}))})),s(r(o),"handleKeyDown",(function(e){27===e.keyCode&&o.setState({isEditing:!1}),document.removeEventListener("keydown",o.handleKeyDown,!1)})),s(r(o),"handleEditMenuItem",(function(){document.addEventListener("keydown",o.handleKeyDown,!1),o.setState({isEditing:!0},(function(){o.inputEl.current&&o.inputEl.current.focus()}))})),s(r(o),"getEditCommentProps",(function(){var e=o.props.comment,t=e.id,n=e.body,r=e.attachment;return{editFeedItemId:e.feed_activity_id,editCommentId:t,editComment:n,editAttachment:r}})),s(r(o),"onEditFinish",(function(){o.setState({isEditing:!1,isLoading:!1})})),s(r(o),"handleDeleteMenuItem",(function(){o.setState({openDeleteDialog:!0})})),s(r(o),"handleDelete",e(c.mark((function e(){var t,n,r;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.props.comment.id,n=o.props.comment.feed_activity_id,o.setState({isLoading:!0}),e.next=5,o.deleteComment(n,t);case 5:r=e.sent,o.setState({isLoading:!1,openDeleteDialog:!1}),r&&o.props.handleDeleteCallback(t);case 8:case"end":return e.stop()}}),e)})))),o.state={actionsMenuAnchorEl:null,isLoading:!1,isEditing:!1,openDeleteDialog:!1},o.inputEl=m(),o.commentEl=m(),o}return n(p,[{key:"componentDidMount",value:function(){this.props.showOnMount&&this.showIntoView()}},{key:"isCurrentUserCommentCreator",get:function(){return Number(d(this.props.comment,["user","id"]))===Number(this.props.currentUser.id)}},{key:"renderMenuIcon",value:function(){var e=this.isCurrentUserCommentCreator,t=this.isCurrentUserCommentCreator||h(this.props.comment.allowed_actions,"destroy");return t||e?T("div",{className:P.cCommentMenu,children:[U(b,{"data-testid":"".concat("comment","_menuButton"),"aria-label":"Actions","aria-owns":this.state.actionsMenuAnchorEl?"c-comment__actions-menu":void 0,"aria-haspopup":"true",classes:{root:this.props.classes.iconButtonRoot},onClick:this.handleToggleActionsMenu,children:U(M,{htmlColor:w[400]})}),T(C,{id:"c-comment__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:this.state.actionsMenuAnchorEl,open:!!this.state.actionsMenuAnchorEl,onClick:this.handleToggleActionsMenu,children:[e&&U(D,{"data-testid":"".concat("comment","_editMenuItem"),onClick:this.handleEditMenuItem,children:"Edit"}),t&&U(D,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:this.handleDeleteMenuItem,children:"Delete"})]})]}):null}},{key:"render",value:function(){var e,t,n=this,r=this.state,o=r.isLoading,i=r.isEditing;if(o){var a=this.props.spaceAround;return U(O,{spaceAround:a})}var c=this.props,m=c.comment,l=c.classes,p=c.spaceAround,h=c.isNative,g=c.patchCommentCallback,b=c.companyId;if(i)return U(I,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({inputRef:this.inputEl,postComment:f,exitEditMode:this.onEditFinish,setIsEditting:function(){return n.setState({isLoading:!0})},patchCommentCallback:g,companyId:b},this.getEditCommentProps()));var C=R.getUserFullName(m.user),D=h?"MM/DD HH:mm":"MM/DD/YY HH:mm",M=u(m.created_at).format(D),w=(null==m||null===(e=m.attachment)||void 0===e?void 0:e.signed_url)||(null==m||null===(t=m.attachment)||void 0===t?void 0:t.url),N=d(m,["attachment","size"]);return T("div",{"data-testid":"".concat("comment","_commentItem_").concat(m.body),className:v(P.cComment,s({},P.cCommentNative,h)),ref:this.commentEl,children:[T(E,{spaceAround:p,className:this.props.classes.commentWrapper,children:[U("div",{style:W.chatAvatarWrapper,children:h?U(j,{size:26,displayName:C,imgSrc:d(m,["user","profile_photo"]),className:this.props.classes.avatar}):U(A,{user:m.user,currentUser:this.props.currentUser,children:U(j,{size:26,displayName:C,imgSrc:d(m,["user","profile_photo"]),className:this.props.classes.avatar})})}),T("div",{style:W.infoContainer,children:[U("div",{children:T("div",{style:W.commentInfoContainer,children:[U("div",{style:W.userNameWrapper,children:U(y,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:l.userName,children:C})}),U("div",{style:W.timeWrapper,children:U(y,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:l.timeRoot},children:M})})]})}),T("div",{className:P.cCommentBody,children:[this.renderMenuIcon(),U(y,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:l.textRoot},children:_(m.body,m.mentioned_users,h,"#00bcd4",this.props.currentUser)}),w&&U(k,{attachmentUrl:w,attachmentSize:N,size:"small"})]})]})]}),this.state.openDeleteDialog&&U(x,{open:this.state.openDeleteDialog,text:"Do you really want to delete comment?",handleClose:function(){return n.setState({openDeleteDialog:!1})},handleOk:this.handleDelete,okText:"Delete"})]})}}]),p}();q.propTypes={comment:p.shape({}).isRequired,showOnMount:p.bool,spaceAround:p.bool,handleShowOnMount:p.func,handleEdit:p.func,handleDeleteCallback:p.func.isRequired,patchCommentCallback:p.func.isRequired,companyId:p.number,currentUser:p.shape(),classes:p.shape({}).isRequired,isNative:p.bool},q.defaultProps={showOnMount:!1,spaceAround:!1,handleShowOnMount:f,handleEdit:f,companyId:null,isNative:N,currentUser:{}};var F=g(B)(q);export{F as default};
1
+ import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/assertThisInitialized";import o from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import c from"@babel/runtime/regenerator";import{createRef as m,PureComponent as l}from"react";import p from"prop-types";import u from"moment";import{get as d,includes as h,noop as f}from"lodash";import v from"classnames";import{withStyles as y}from"@material-ui/core/styles";import g from"@material-ui/core/Typography";import b from"@material-ui/core/Menu";import C from"@material-ui/core/MenuItem";import D from"@material-ui/icons/MoreVert";import M from"@material-ui/core/colors/grey";import E from"../CommentWrapper.js";import w from"../CommentLoader.js";import O from"../CommentInput/index.js";import I from"../Avatar/index.js";import j from"../Attachment/index.js";import k from"../IconButton/index.js";import x from"../ConfirmationDialog.js";import A from"../UserCardPopover.js";import{formatMentionText as N}from"../UserMention/utils/index.js";import{isNativeDetected as _}from"../../utils/mobileDetect.js";import{deleteFeedItemComment as S}from"../../clients/jsonApi/index.js";import R from"../../utils/main.js";import P from"./styles.css.js";import{jsxs as U,jsx as T}from"react/jsx-runtime";function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=a(e);if(t){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return i(this,n)}}var W={chatAvatarWrapper:{paddingTop:2,position:"absolute",top:6,left:0},commentInfoContainer:{display:"inline-flex",alignItems:"center",width:"100%",paddingTop:5},userNameWrapper:{overflow:"hidden"},infoContainer:{display:"inline-block",verticalAlign:"top",width:"100%",paddingLeft:33}},B=function(i){o(p,l);var a=L(p);function p(n){var o,i;return t(this,p),o=a.call(this,n),s(r(o),"deleteComment",(i=e(c.mark((function e(t,n){var r;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,S(t,n);case 3:r=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,t){return i.apply(this,arguments)})),s(r(o),"showIntoView",(function(){o.props.handleShowOnMount(),o.commentEl.current.scrollIntoView({block:"end"})})),s(r(o),"handleToggleActionsMenu",(function(e){var t=e.currentTarget;o.setState((function(e){return{actionsMenuAnchorEl:e.actionsMenuAnchorEl?null:t}}))})),s(r(o),"handleKeyDown",(function(e){27===e.keyCode&&o.setState({isEditing:!1}),document.removeEventListener("keydown",o.handleKeyDown,!1)})),s(r(o),"handleEditMenuItem",(function(){document.addEventListener("keydown",o.handleKeyDown,!1),o.setState({isEditing:!0},(function(){o.inputEl.current&&o.inputEl.current.focus()}))})),s(r(o),"getEditCommentProps",(function(){var e=o.props.comment,t=e.id,n=e.body,r=e.attachment;return{editFeedItemId:e.feed_activity_id,editCommentId:t,editComment:n,editAttachment:r}})),s(r(o),"onEditFinish",(function(){o.setState({isEditing:!1,isLoading:!1})})),s(r(o),"handleDeleteMenuItem",(function(){o.setState({openDeleteDialog:!0})})),s(r(o),"handleDelete",e(c.mark((function e(){var t,n,r;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.props.comment.id,n=o.props.comment.feed_activity_id,o.setState({isLoading:!0}),e.next=5,o.deleteComment(n,t);case 5:r=e.sent,o.setState({isLoading:!1,openDeleteDialog:!1}),r&&o.props.handleDeleteCallback(t);case 8:case"end":return e.stop()}}),e)})))),o.state={actionsMenuAnchorEl:null,isLoading:!1,isEditing:!1,openDeleteDialog:!1},o.inputEl=m(),o.commentEl=m(),o}return n(p,[{key:"componentDidMount",value:function(){this.props.showOnMount&&this.showIntoView()}},{key:"isCurrentUserCommentCreator",get:function(){return Number(d(this.props.comment,["user","id"]))===Number(this.props.currentUser.id)}},{key:"renderMenuIcon",value:function(){var e=this.isCurrentUserCommentCreator,t=this.isCurrentUserCommentCreator||h(this.props.comment.allowed_actions,"destroy");return t||e?U("div",{className:P.cCommentMenu,children:[T(k,{"data-testid":"".concat("comment","_menuButton"),"aria-label":"Actions","aria-owns":this.state.actionsMenuAnchorEl?"c-comment__actions-menu":void 0,"aria-haspopup":"true",className:this.props.classes.iconButtonRoot,size:"small",onClick:this.handleToggleActionsMenu,children:T(D,{})}),U(b,{id:"c-comment__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:this.state.actionsMenuAnchorEl,open:!!this.state.actionsMenuAnchorEl,onClick:this.handleToggleActionsMenu,children:[e&&T(C,{"data-testid":"".concat("comment","_editMenuItem"),onClick:this.handleEditMenuItem,children:"Edit"}),t&&T(C,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:this.handleDeleteMenuItem,children:"Delete"})]})]}):null}},{key:"render",value:function(){var e,t,n=this,r=this.state,o=r.isLoading,i=r.isEditing;if(o){var a=this.props.spaceAround;return T(w,{spaceAround:a})}var c=this.props,m=c.comment,l=c.classes,p=c.spaceAround,h=c.isNative,y=c.patchCommentCallback,b=c.companyId;if(i)return T(O,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({inputRef:this.inputEl,postComment:f,exitEditMode:this.onEditFinish,setIsEditting:function(){return n.setState({isLoading:!0})},patchCommentCallback:y,companyId:b,currentUser:this.props.currentUser},this.getEditCommentProps()));var C=R.getUserFullName(m.user),D=h?"MM/DD HH:mm":"MM/DD/YY HH:mm",M=u(m.created_at).format(D),k=(null==m||null===(e=m.attachment)||void 0===e?void 0:e.signed_url)||(null==m||null===(t=m.attachment)||void 0===t?void 0:t.url),_=d(m,["attachment","size"]);return U("div",{"data-testid":"".concat("comment","_commentItem_").concat(m.body),className:v(P.cComment,s({},P.cCommentNative,h)),ref:this.commentEl,children:[U(E,{spaceAround:p,className:this.props.classes.commentWrapper,children:[T("div",{style:W.chatAvatarWrapper,children:h?T(I,{size:24,displayName:C,imgSrc:d(m,["user","profile_photo"]),className:this.props.classes.avatar}):T(A,{user:m.user,currentUser:this.props.currentUser,children:T(I,{size:24,displayName:C,imgSrc:d(m,["user","profile_photo"]),className:this.props.classes.avatar})})}),U("div",{style:W.infoContainer,children:[T("div",{children:U("div",{style:W.commentInfoContainer,children:[T("div",{style:W.userNameWrapper,children:T(g,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:l.userName,children:C})}),T("div",{style:W.timeWrapper,children:T(g,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:l.timeRoot},children:M})})]})}),U("div",{className:P.cCommentBody,children:[this.renderMenuIcon(),T(g,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:l.textRoot},children:N(m.body,m.mentioned_users,h,"#00bcd4",this.props.currentUser)}),k&&T(j,{attachmentUrl:k,attachmentSize:_,size:"small"})]})]})]}),this.state.openDeleteDialog&&T(x,{open:this.state.openDeleteDialog,text:"Do you really want to delete comment?",handleClose:function(){return n.setState({openDeleteDialog:!1})},handleOk:this.handleDelete,okText:"Delete"})]})}}]),p}();B.propTypes={comment:p.shape({}).isRequired,showOnMount:p.bool,spaceAround:p.bool,handleShowOnMount:p.func,handleEdit:p.func,handleDeleteCallback:p.func.isRequired,patchCommentCallback:p.func.isRequired,companyId:p.number,currentUser:p.shape(),classes:p.shape({}).isRequired,isNative:p.bool},B.defaultProps={showOnMount:!1,spaceAround:!1,handleShowOnMount:f,handleEdit:f,companyId:null,isNative:_,currentUser:{}};var q=y((function(e){return{commentWrapper:{width:"calc(100% - 10px)"},timeRoot:{color:M[700],float:"right",marginRight:5,marginLeft:10,fontSize:"10px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",visibility:"hidden",color:e.palette.primary.text7},userName:{fontSize:"12px",fontWeight:"bold"}}}))(B);export{q as default};
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import m from"prop-types";import p from"lodash/noop";import{withStyles as d}from"@material-ui/core/styles";import u from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as v,IconButton as x}from"@material-ui/core";import I from"@material-ui/core/colors/grey";import y from"../Avatar/index.js";import E from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import S from"../FailedFileUploading.js";import U from"../UserMention/index.js";import N from"../FilePreview/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as w}from"../../utils/nativeMessages.js";import{patchFeedItemComment as L}from"../../clients/jsonApi/index.js";import T from"./styles.css.js";import{jsxs as P,jsx as B}from"react/jsx-runtime";function D(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var z={chatAvatarWrapper:{display:"inline-block",verticalAlign:"top",position:"absolute",left:-18},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(m,c);var r=D(m);function m(n){var i,a,c;return e(this,m),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,L(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(w(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCloseEditClick",(function(){i.setState({comment:""}),i.props.exitEditMode()})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null},i}return n(m,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.url:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?z.commentTextFieldContainerSpaceAround:z.commentTextFieldContainer,children:[B("div",{style:z.chatAvatarWrapper,children:B(y,{displayName:i,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),B(f,{className:this.props.classes.paperRoot,children:B(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:U,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&B(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:B("div",{className:u(T.cCommentInputIconContainer,T.cCommentInputIconUpload),children:B(E,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],inputId:"comment-attachment-".concat(this.props.editCommentId)})})}),B(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:B("div",{className:T.cCommentInputIconContainer,children:B(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&B(S,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&B(N,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),P("div",{className:T.cCommentInputSendContainer,children:[B("div",{className:T.cCommentInputSendContainerCancel,children:this.isEditMode&&B(v,{variant:"caption",className:u(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.props.exitEditMode,children:"Cancel"})}),P("div",{className:T.cCommentInputSendContainerSend,children:[P(v,{variant:"caption",className:u(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",B(v,{variant:"caption",color:"primary",className:u(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),B(x,{"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,children:B(k,{})})]})]})]})}}]),m}();_.propTypes={inputRef:m.shape({current:m.shape({focus:m.shape({})})}),editFeedItemId:m.number,editCommentId:m.number,editComment:m.string,editAttachment:m.shape({url:m.string}),spaceAround:m.bool,postComment:m.func.isRequired,postCommentCallback:m.func,patchCommentCallback:m.func,exitEditMode:m.func,setIsPosting:m.func,setIsEditting:m.func,onMount:m.func,autoFocus:m.bool,disabled:m.bool,classes:m.shape({}).isRequired,currentUser:m.shape(),isNative:m.bool,companyId:m.number},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:p,setIsEditting:p,onMount:p,autoFocus:void 0,disabled:!1,patchCommentCallback:p,postCommentCallback:p,exitEditMode:p,companyId:null,currentUser:{},isNative:R};var O=d((function(t){return{paperRoot:{width:"calc(100% - 28px)",marginLeft:25,display:"inline-block",height:35,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:35,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"5px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:".7rem",color:t.palette.grey[700]},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"}}}))(_);export{O as default};
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import m from"prop-types";import p from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as v}from"@material-ui/core";import I from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(m,c);var r=z(m);function m(n){var i,a,c;return e(this,m),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(m,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.url:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],inputId:"comment-attachment-".concat(this.props.editCommentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(v,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),m}();_.propTypes={inputRef:m.shape({current:m.shape({focus:m.shape({})})}),editFeedItemId:m.number,editCommentId:m.number,editComment:m.string,editAttachment:m.shape({url:m.string}),spaceAround:m.bool,postComment:m.func.isRequired,postCommentCallback:m.func,patchCommentCallback:m.func,exitEditMode:m.func,setIsPosting:m.func,setIsEditting:m.func,onMount:m.func,autoFocus:m.bool,disabled:m.bool,classes:m.shape({}).isRequired,currentUser:m.shape(),isNative:m.bool,companyId:m.number},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:p,setIsEditting:p,onMount:p,autoFocus:void 0,disabled:!1,patchCommentCallback:p,postCommentCallback:p,exitEditMode:p,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
@@ -1 +1 @@
1
- import n from'./../../ext-esm/style-inject/dist/style-inject.es.js';var e={cCommentInputSendContainer:"styles_cCommentInputSendContainer__YGdyj",cCommentInputSendContainerSend:"styles_cCommentInputSendContainerSend__v2QuS",cCommentInputSendContainerCancel:"styles_cCommentInputSendContainerCancel__ihM5z",cCommentInputIconContainer:"styles_cCommentInputIconContainer__GI8uz",cCommentInputIconUpload:"styles_cCommentInputIconUpload__-4I0T"};n(".styles_cCommentInputSendContainer__YGdyj{display:flex;justify-content:space-between;margin-left:25px;padding-right:6px}.styles_cCommentInputSendContainerCancel__ihM5z,.styles_cCommentInputSendContainerSend__v2QuS{align-items:center;display:flex}.styles_cCommentInputIconContainer__GI8uz{border-radius:20px;height:40px;margin-right:-10px;padding:5px;text-align:center}.styles_cCommentInputIconContainer__GI8uz:hover{background:hsla(0,0%,100%,.1)}.styles_cCommentInputIconUpload__-4I0T{align-items:center;display:flex}");export{e as default};
1
+ import n from'./../../ext-esm/style-inject/dist/style-inject.es.js';var e={cCommentInputSendContainer:"styles_cCommentInputSendContainer__YGdyj",cCommentInputSendContainerSend:"styles_cCommentInputSendContainerSend__v2QuS",cCommentInputSendContainerCancel:"styles_cCommentInputSendContainerCancel__ihM5z",cCommentInputIconContainer:"styles_cCommentInputIconContainer__GI8uz",cCommentInputIconUpload:"styles_cCommentInputIconUpload__-4I0T"};n(".styles_cCommentInputSendContainer__YGdyj{display:flex;justify-content:space-between;margin-left:40px;margin-top:4px}.styles_cCommentInputSendContainerCancel__ihM5z,.styles_cCommentInputSendContainerSend__v2QuS{align-items:center;display:flex;height:36px}.styles_cCommentInputIconContainer__GI8uz{border-radius:20px;height:40px;margin-right:-10px;padding:5px;text-align:center}.styles_cCommentInputIconContainer__GI8uz:hover{background:hsla(0,0%,100%,.1)}.styles_cCommentInputIconUpload__-4I0T{align-items:center;display:flex}");export{e as default};
@@ -1 +1 @@
1
- import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var n={hideOverflow:"FeedItem_hideOverflow__VxJHT",downloadLink:"FeedItem_downloadLink__60HIj",mainContainer:"FeedItem_mainContainer__Y9I2W",mainContainerNative:"FeedItem_mainContainerNative__chnEh",mainContainerClickable:"FeedItem_mainContainerClickable__jG6kG",mainContainerTop:"FeedItem_mainContainerTop__SqKjI",mainContainerTopNative:"FeedItem_mainContainerTopNative__i-JrG",mainContainerTopMenu:"FeedItem_mainContainerTopMenu__QE3-N",loadingContainer:"FeedItem_loadingContainer__B9lMF"};e(".FeedItem_hideOverflow__VxJHT{overflow:hidden}.FeedItem_downloadLink__60HIj{color:inherit;outline:0}.FeedItem_mainContainer__Y9I2W{padding:15px 16px 0 33px}.FeedItem_mainContainerNative__chnEh{padding:15px 16px 0}.FeedItem_mainContainerClickable__jG6kG{cursor:pointer}.FeedItem_mainContainerTop__SqKjI{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.FeedItem_mainContainerTopNative__i-JrG{padding-left:55px}.FeedItem_mainContainerTopMenu__QE3-N{align-items:center;display:flex;margin-left:auto}.FeedItem_loadingContainer__B9lMF{height:100%;left:0;position:absolute;top:0;width:100%}");export{n as default};
1
+ import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var n={hideOverflow:"FeedItem_hideOverflow__VxJHT",downloadLink:"FeedItem_downloadLink__60HIj",mainContainer:"FeedItem_mainContainer__Y9I2W",mainContainerNative:"FeedItem_mainContainerNative__chnEh",mainContainerClickable:"FeedItem_mainContainerClickable__jG6kG",mainContainerTop:"FeedItem_mainContainerTop__SqKjI",mainContainerTopNative:"FeedItem_mainContainerTopNative__i-JrG",mainContainerTopMenu:"FeedItem_mainContainerTopMenu__QE3-N",loadingContainer:"FeedItem_loadingContainer__B9lMF"};e(".FeedItem_hideOverflow__VxJHT{overflow:hidden}.FeedItem_downloadLink__60HIj{color:inherit;outline:0}.FeedItem_mainContainer__Y9I2W{padding:16px 24px 0 32px}.FeedItem_mainContainerNative__chnEh{padding:15px 16px 0}.FeedItem_mainContainerClickable__jG6kG{cursor:pointer}.FeedItem_mainContainerTop__SqKjI{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.FeedItem_mainContainerTopNative__i-JrG{padding-left:55px}.FeedItem_mainContainerTopMenu__QE3-N{align-items:center;display:flex;margin-left:auto}.FeedItem_loadingContainer__B9lMF{height:100%;left:0;position:absolute;top:0;width:100%}");export{n as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import o from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/regenerator";import{useState as i}from"react";import a from"prop-types";import s from"classnames";import{makeStyles as m,Paper as p,Divider as c}from"@material-ui/core";import{includes as l,noop as d}from"lodash";import u from"@material-ui/core/colors/grey";import{isNativeDetected as f}from"../../utils/mobileDetect.js";import v from"../ConfirmationDialog.js";import y from"../LoadingIndicator/LoadingIndicator.js";import{FEED_ITEM_TYPES as b,FEED_ITEM_TYPES_BY_KEY as h}from"../../constants/feed.js";import{deleteFeedItem as I,toggleFeedItemLike as g}from"../../clients/jsonApi/index.js";import j from"../../utils/main.js";import T from"./components/Actions.js";import O from"./components/Comments.js";import C from"./components/Content.js";import F from"./components/CreatedAt.js";import P from"./components/Icon.js";import w from"./components/Reactions.js";import D from"./components/RigAndWell.js";import k from"./components/TypeAndAssetTitle.js";import x from"./FeedItem.css.js";import{jsxs as R,jsx as N}from"react/jsx-runtime";var E=["feedItem","editableFeedItemTypes","removeFeedItem","enterEditMode","router","currentUser","appData","customFeedItemTypeTemplates"];function _(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function A(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?_(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var M=m((function(e){return{paperRoot:{position:"relative",marginBottom:10,paddingBottom:5,backgroundColor:e.palette.background.b8},clickablePaperRoot:{"&:hover":{filter:"brightness(90%)",transition:"filter 0.3s"}},headerDividerRoot:{margin:"10px 0"}}}));function U(a){var m,d,b,_,U,S,L,q,B,W,G,z=a.feedItem,H=a.editableFeedItemTypes,J=a.removeFeedItem,K=a.enterEditMode,Q=a.router,V=a.currentUser,X=a.appData,Y=a.customFeedItemTypeTemplates,Z=r(a,E),$=l(z.allowed_actions,"destroy"),ee=M(),te=i(!1),oe=o(te,2),re=oe[0],ne=oe[1],ie=i(!0),ae=o(ie,2),se=ae[0],me=ae[1],pe=i(!1),ce=o(pe,2),le=ce[0],de=ce[1],ue=z.type===h.post.type,fe=H.includes(z.type),ve=z.type===h.geosteering_comments.type&&(null===(m=z.context)||void 0===m||null===(d=m.geosteering_comments)||void 0===d||null===(b=d.data)||void 0===b?void 0:b.isRecommendation),ye=h[z.type].label,be=j.getUserFullName(z.user),he=z.type===h.alert.type&&"/alerts/".concat(null===(_=z.context)||void 0===_||null===(U=_.alert)||void 0===U?void 0:U.id),Ie=z.type===h.alert.type&&he,ge=(W=t(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne(!0),e.prev=1,e.next=4,I(z.id);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return");case 9:return e.prev=9,ne(!1),e.finish(9);case 12:j.showSuccessNotification("Item was deleted"),J(z.id);case 14:case"end":return e.stop()}}),e,null,[[1,6,9,12]])}))),function(){return W.apply(this,arguments)}),je=(G=t(n.mark((function e(){var t;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=z.id,e.prev=1,e.next=4,g(t);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,null,[[1,6]])}))),function(){return G.apply(this,arguments)});return R(p,{"data-testid":"".concat("FeedPo","_post_").concat(null===(S=z.context)||void 0===S||null===(L=S.post)||void 0===L?void 0:L.body,"_rigName_").concat(function(e){var t,o,r;return!!e.rig?null===(t=e.rig)||void 0===t?void 0:t.name:null===(o=e.well)||void 0===o||null===(r=o.parent_asset)||void 0===r?void 0:r.name}(z)),className:s(ee.paperRoot,(q={},e(q,ee.clickablePaperRoot,Ie),e(q,x.hideOverflow,re),q)),elevation:0,children:[R("div",{onClick:function(){Ie&&Q.push(he)},className:s(x.mainContainer,(B={},e(B,x.mainContainerClickable,Ie),e(B,x.mainContainerNative,f),B)),children:[N(P,{feedItem:z,classes:ee,displayName:be,isRecommended:ve}),R("div",{className:s(x.mainContainerTop,e({},x.mainContainerTopNative,f)),children:[N(k,{feedItem:z,userFullName:be,typeLabel:ye,classes:ee,isPost:ue}),R("div",{className:x.mainContainerTopMenu,children:[N(F,{feedItem:z,classes:ee}),N(T,{"data-testid":"".concat("FeedPo","_actionsDropdown"),isPost:ue,isEditableItem:fe,canDeleteFeedItem:$,handleEditMenuItem:function(){K(z)},handleDeleteMenuItem:function(){de(!0)},copyFeedItemLink:function(){var e=z.id,t="".concat(window.location.host,"/feed/").concat(e);j.copyToClipboard(t)},feedItem:z,currentUser:V})]}),N(D,{feedItem:z,isPost:ue})]}),N(c,{className:ee.headerDividerRoot}),N(C,A({feedItem:z,appData:X,customFeedItemTypeTemplates:Y,currentUser:V},Z))]}),N(w,{feedItem:z,handleToggleLike:je,setOpenCommentInput:me,openCommentInput:se,currentUser:V}),N(O,{openCommentInput:se,feedItem:z,setOpenCommentInput:me,user:V}),re&&N("div",{className:x.loadingContainer,style:{backgroundColor:u[800]},children:N(y,{})}),le&&N(v,{open:le,title:"Delete post",text:"Are you sure you want to delete post and all attachments?",handleClose:function(){return de(!1)},handleOk:function(){ge()},okText:"Delete"})]})}U.propTypes={feedItem:a.shape().isRequired,enterEditMode:a.func,removeFeedItem:a.func,editableFeedItemTypes:a.oneOf([b.TRACES_MEMO,b.POST]),currentUser:a.shape().isRequired,appData:a.shape().isRequired,customFeedItemTypeTemplates:a.shape()},U.defaultProps={enterEditMode:d,removeFeedItem:d,editableFeedItemTypes:[b.POST],customFeedItemTypeTemplates:{}};export{U as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import o from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/regenerator";import{useState as i}from"react";import a from"prop-types";import s from"classnames";import{makeStyles as m,Paper as p,Divider as c}from"@material-ui/core";import{includes as l,noop as d}from"lodash";import u from"@material-ui/core/colors/grey";import{isNativeDetected as f}from"../../utils/mobileDetect.js";import v from"../ConfirmationDialog.js";import y from"../LoadingIndicator/LoadingIndicator.js";import{FEED_ITEM_TYPES as b,FEED_ITEM_TYPES_BY_KEY as h}from"../../constants/feed.js";import{deleteFeedItem as I,toggleFeedItemLike as g}from"../../clients/jsonApi/index.js";import"../../utils/index.js";import j from"../../utils/main.js";import T from"./components/Actions.js";import O from"./components/FeedComments.js";import C from"./components/Content.js";import F from"./components/CreatedAt.js";import P from"./components/Icon.js";import w from"./components/Reactions.js";import k from"./components/RigAndWell.js";import x from"./components/TypeAndAssetTitle.js";import D from"./FeedItem.css.js";import{jsxs as R,jsx as N}from"react/jsx-runtime";import{showSuccessNotification as E}from"../../utils/notificationToasts.js";var _=["feedItem","editableFeedItemTypes","removeFeedItem","enterEditMode","router","currentUser","appData","customFeedItemTypeTemplates"];function A(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function M(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?A(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var U=m((function(e){return{paperRoot:{position:"relative",marginBottom:10,paddingBottom:16,backgroundColor:e.palette.background.b8},clickablePaperRoot:{"&:hover":{filter:"brightness(90%)",transition:"filter 0.3s"}},headerDividerRoot:{margin:"12px 0 20px 0",backgroundColor:"#595959"}}}));function L(a){var m,d,b,A,L,S,q,B,W,G,z,H=a.feedItem,J=a.editableFeedItemTypes,K=a.removeFeedItem,Q=a.enterEditMode,V=a.router,X=a.currentUser,Y=a.appData,Z=a.customFeedItemTypeTemplates,$=r(a,_),ee=l(H.allowed_actions,"destroy"),te=U(),oe=i(!1),re=o(oe,2),ne=re[0],ie=re[1],ae=i(!0),se=o(ae,2),me=se[0],pe=se[1],ce=i(!1),le=o(ce,2),de=le[0],ue=le[1],fe=H.type===h.post.type,ve=J.includes(H.type),ye=H.type===h.geosteering_comments.type&&(null===(m=H.context)||void 0===m||null===(d=m.geosteering_comments)||void 0===d||null===(b=d.data)||void 0===b?void 0:b.isRecommendation),be=h[H.type].label,he=j.getUserFullName(H.user),Ie=H.type===h.alert.type&&"/alerts/".concat(null===(A=H.context)||void 0===A||null===(L=A.alert)||void 0===L?void 0:L.id),ge=H.type===h.alert.type&&Ie,je=(G=t(n.mark((function e(){return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ie(!0),e.prev=1,e.next=4,I(H.id);case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return");case 9:return e.prev=9,ie(!1),e.finish(9);case 12:E("Item was deleted"),K(H.id);case 14:case"end":return e.stop()}}),e,null,[[1,6,9,12]])}))),function(){return G.apply(this,arguments)}),Te=(z=t(n.mark((function e(){var t;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=H.id,e.prev=1,e.next=4,g(t);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,null,[[1,6]])}))),function(){return z.apply(this,arguments)});return R(p,{"data-testid":"".concat("FeedPo","_post_").concat(null===(S=H.context)||void 0===S||null===(q=S.post)||void 0===q?void 0:q.body,"_rigName_").concat(function(e){var t,o,r;return!!e.rig?null===(t=e.rig)||void 0===t?void 0:t.name:null===(o=e.well)||void 0===o||null===(r=o.parent_asset)||void 0===r?void 0:r.name}(H)),className:s(te.paperRoot,(B={},e(B,te.clickablePaperRoot,ge),e(B,D.hideOverflow,ne),B)),elevation:0,children:[R("div",{onClick:function(){ge&&V.push(Ie)},className:s(D.mainContainer,(W={},e(W,D.mainContainerClickable,ge),e(W,D.mainContainerNative,f),W)),children:[N(P,{feedItem:H,classes:te,displayName:he,isRecommended:ye}),R("div",{className:s(D.mainContainerTop,e({},D.mainContainerTopNative,f)),children:[N(x,{feedItem:H,userFullName:he,typeLabel:be,classes:te,isPost:fe}),R("div",{className:D.mainContainerTopMenu,children:[N(F,{feedItem:H,classes:te}),N(T,{"data-testid":"".concat("FeedPo","_actionsDropdown"),isPost:fe,isEditableItem:ve,canDeleteFeedItem:ee,handleEditMenuItem:function(){Q(H)},handleDeleteMenuItem:function(){ue(!0)},copyFeedItemLink:function(){var e=H.id,t="".concat(window.location.host,"/feed/").concat(e);j.copyToClipboard(t)},feedItem:H,currentUser:X})]}),N(k,{feedItem:H,isPost:fe})]}),N(c,{className:te.headerDividerRoot}),N(C,M({feedItem:H,appData:Y,customFeedItemTypeTemplates:Z,currentUser:X},$))]}),N(w,{feedItem:H,handleToggleLike:Te,setOpenCommentInput:pe,openCommentInput:me,currentUser:X}),N(O,{openCommentInput:me,feedItem:H,currentUser:X}),ne&&N("div",{className:D.loadingContainer,style:{backgroundColor:u[800]},children:N(y,{})}),de&&N(v,{open:de,title:"Delete post",text:"Are you sure you want to delete post and all attachments?",handleClose:function(){return ue(!1)},handleOk:function(){je()},okText:"Delete"})]})}L.propTypes={feedItem:a.shape().isRequired,enterEditMode:a.func,removeFeedItem:a.func,editableFeedItemTypes:a.oneOf([b.TRACES_MEMO,b.POST]),currentUser:a.shape().isRequired,appData:a.shape().isRequired,customFeedItemTypeTemplates:a.shape()},L.defaultProps={enterEditMode:d,removeFeedItem:d,editableFeedItemTypes:[b.POST],customFeedItemTypeTemplates:{}};export{L as default};
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/slicedToArray";import{memo as e,useState as o}from"react";import{makeStyles as i,useTheme as n,IconButton as r,Menu as a,MenuItem as l}from"@material-ui/core";import d from"@material-ui/icons/MoreVert";import c from"react-player";import{getIsVideo as m}from"../../../utils/fileExtension.js";import{jsxs as u,Fragment as s,jsx as h}from"react/jsx-runtime";var p=i({actionsIconButtonRoot:{verticalAlign:"middle",height:24,width:24,padding:0,marginLeft:5}}),f=e((function(e){var i,f,v,g,_=e.feedItem,k=e.copyFeedItemLink,I=e.currentUser,P=e.isEditableItem,y=e.canDeleteFeedItem,B=e.handleEditMenuItem,C=e.handleDeleteMenuItem,F=e.isPost,w=n(),E=p(),b=o(null),x=t(b,2),D=x[0],L=x[1],A=(null===(i=_.user)||void 0===i?void 0:i.id)===I.id,M=null===(f=_.context)||void 0===f||null===(v=f.post)||void 0===v||null===(g=v.attachment)||void 0===g?void 0:g.url,j=m(M)&&c.canPlay(M),z=function(t){t.stopPropagation();var e=t.currentTarget;L((function(t){return t?null:e}))},N=P&&A,O=y,R=F&&j;return N||O||R?u(s,{children:[h(r,{"data-testid":"".concat("FeedPo","_menuButton"),"aria-label":"Actions","aria-owns":D?"c-feed-item__actions-menu":void 0,"aria-haspopup":"true",className:E.actionsIconButtonRoot,onClick:z,children:h(d,{htmlColor:w.palette.grey[400]})}),u(a,{id:"c-feed-item__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:D,open:!!D,onClick:z,children:[R&&h("a",{href:M,className:"c-feed-item__download-link",children:h(l,{"data-testid":"".concat("FeedPo","_downloadButton"),children:"Download"})}),N&&h(l,{"data-testid":"".concat("FeedPo","_editButton"),onClick:B,children:"Edit"}),O&&h(l,{"data-testid":"".concat("FeedPo","_deleteButton"),onClick:C,children:"Delete"}),h(l,{"data-testid":"".concat("FeedPo","_copyLinkButton"),onClick:k,children:"Copy Link"})]})]}):null}));export{f as default};
1
+ import t from"@babel/runtime/helpers/slicedToArray";import{memo as e,useState as o}from"react";import{makeStyles as n,Menu as i,MenuItem as r}from"@material-ui/core";import a from"@material-ui/icons/MoreVert";import l from"react-player";import c from"../../IconButton/index.js";import{getIsVideo as d}from"../../../utils/fileExtension.js";import{jsxs as m,Fragment as u,jsx as s}from"react/jsx-runtime";var p=n((function(t){return{actionsIconButtonRoot:{marginLeft:5,color:t.palette.primary.text7}}})),f=e((function(e){var n,f,h,v,_=e.feedItem,k=e.copyFeedItemLink,I=e.currentUser,B=e.isEditableItem,P=e.canDeleteFeedItem,g=e.handleEditMenuItem,y=e.handleDeleteMenuItem,F=e.isPost,x=p(),C=o(null),E=t(C,2),b=E[0],w=E[1],D=(null===(n=_.user)||void 0===n?void 0:n.id)===I.id,L=null===(f=_.context)||void 0===f||null===(h=f.post)||void 0===h||null===(v=h.attachment)||void 0===v?void 0:v.url,j=d(L)&&l.canPlay(L),z=function(t){t.stopPropagation();var e=t.currentTarget;w((function(t){return t?null:e}))},M=B&&D,A=P,N=F&&j;return M||A||N?m(u,{children:[s(c,{"data-testid":"".concat("FeedPo","_menuButton"),"aria-label":"Actions","aria-owns":b?"c-feed-item__actions-menu":void 0,"aria-haspopup":"true",className:x.actionsIconButtonRoot,size:"small",onClick:z,children:s(a,{})}),m(i,{id:"c-feed-item__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:b,open:!!b,onClick:z,children:[N&&s("a",{href:L,className:"c-feed-item__download-link",children:s(r,{"data-testid":"".concat("FeedPo","_downloadButton"),children:"Download"})}),M&&s(r,{"data-testid":"".concat("FeedPo","_editButton"),onClick:g,children:"Edit"}),A&&s(r,{"data-testid":"".concat("FeedPo","_deleteButton"),onClick:y,children:"Delete"}),s(r,{"data-testid":"".concat("FeedPo","_copyLinkButton"),onClick:k,children:"Copy Link"})]})]}):null}));export{f as default};
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/defineProperty";import e from"classnames";import{makeStyles as a}from"@material-ui/core";import o from"../../Avatar/index.js";import i from"../../UserCardPopover.js";import{isNativeDetected as t}from"../../../utils/mobileDetect.js";import m from"../../Icons/RecommendationIcon.js";import{jsxs as s,jsx as p}from"react/jsx-runtime";var l=a({avatar:{border:"1.5px solid #FFFFFF"},avatarWrapper:{width:46,height:46,backgroundColor:"grey",borderRadius:23,position:"absolute",top:15,left:-23},avatarWrapperNative:{left:"auto"},recommendationWrapper:{position:"absolute",bottom:-8,right:-6}}),d=function(a){var d,n,c=a.displayName,v=a.feedItem,u=a.isRecommended,f=l();return s("div",{className:e(f.avatarWrapper,r({},f.avatarWrapperNative,t)),children:[t?p(o,{displayName:c,imgSrc:null===(d=v.user)||void 0===d?void 0:d.profile_photo,size:46,className:f.avatar}):p(i,{user:v.user,children:p(o,{displayName:c,imgSrc:null===(n=v.user)||void 0===n?void 0:n.profile_photo,size:46,className:f.avatar})}),u&&p("div",{className:f.recommendationWrapper,children:p(m,{})})]})};export{d as default};
1
+ import r from"@babel/runtime/helpers/defineProperty";import e from"classnames";import{makeStyles as a}from"@material-ui/core";import o from"../../Avatar/index.js";import i from"../../UserCardPopover.js";import{isNativeDetected as t}from"../../../utils/mobileDetect.js";import m from"../../Icons/RecommendationIcon.js";import{jsxs as p,jsx as s}from"react/jsx-runtime";var l=a({avatarWrapper:{width:32,height:32,backgroundColor:"grey",borderRadius:"100%",position:"absolute",top:18,left:-21},avatarWrapperNative:{left:"auto"},recommendationWrapper:{position:"absolute",bottom:-8,right:-6}}),d=function(a){var d,n,c=a.displayName,u=a.feedItem,v=a.isRecommended,f=l();return p("div",{className:e(f.avatarWrapper,r({},f.avatarWrapperNative,t)),children:[t?s(o,{displayName:c,imgSrc:null===(d=u.user)||void 0===d?void 0:d.profile_photo,size:32}):s(i,{user:u.user,children:s(o,{displayName:c,imgSrc:null===(n=u.user)||void 0===n?void 0:n.profile_photo,size:32,className:f.avatar})}),v&&s("div",{className:f.recommendationWrapper,children:s(m,{})})]})};export{d as default};
@@ -1 +1 @@
1
- import t from"moment";import{makeStyles as e,Typography as r}from"@material-ui/core";import{jsx as a}from"react/jsx-runtime";var o=e({flexShrink:0,marginLeft:"auto"}),m=function(e){var m=e.feedItem,i=o();return a(r,{variant:"body2","data-testid":"".concat("FeedPo","_createdPostDate"),className:i.createdAtRoot,children:t(m.created_at).format("MM/DD/YY H:mm")})};export{m as default};
1
+ import t from"moment";import{makeStyles as e,Typography as r}from"@material-ui/core";import{jsx as a}from"react/jsx-runtime";var o=e((function(t){return{createdAtRoot:{color:t.palette.primary.text6}}})),m=function(e){var m=e.feedItem,c=o();return a(r,{variant:"body2","data-testid":"".concat("FeedPo","_createdPostDate"),className:c.createdAtRoot,children:t(m.created_at).format("MM/DD/YY H:mm")})};export{m as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import p from"../../Comment/index.js";import c from"../../CommentLoader.js";import d from"../../CommentInput/index.js";import{postFeedItemComment as u}from"../../../clients/jsonApi/index.js";import{jsxs as l,jsx as f}from"react/jsx-runtime";var C=i({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 16px 0 33px"}});function h(r){var i=r.openCommentInput,h=r.feedItem,x=r.isNative,v=r.user,y=o(!1),I=e(y,2),b=I[0],R=I[1],j=o(3),g=e(j,2),k=g[0],q=g[1],w=t(),_=C(),M=h.comments.length,N=M>k;return l("div",{className:(i||!!M)&&_.feedCommentsContainer,children:[i&&!x&&f(d,{inputRef:w,postComment:function(e){u(h.id,e)},setIsPosting:R,companyId:h.company_id,autoFocus:!1}),N&&f(s,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:_.showMoreButtonRoot,onClick:function(){q((function(e){return 3===e?e+7:e+10}))},children:f(a,{variant:"caption",color:"primary",children:"View more comments"})}),h.comments.sort((function(e){return-m(e.created_at).unix()})).slice(0,k).reverse().map((function(e){return f(p,{comment:e,handleDeleteCallback:n,patchCommentCallback:n,companyId:h.company_id,user:v},e.id)})),b&&f(c,{})]})}h.propTypes={openCommentInput:r.bool.isRequired,feedItem:r.shape().isRequired,user:r.shape().isRequired,isNative:r.bool.isRequired};export{h as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import p from"../../Comment/index.js";import c from"../../CommentLoader.js";import d from"../../CommentInput/index.js";import{postFeedItemComment as u}from"../../../clients/jsonApi/index.js";import{isNativeDetected as l}from"../../../utils/mobileDetect.js";import{jsxs as f,jsx as C}from"react/jsx-runtime";var h=i({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 24px 0 32px"}});function x(r){var i=r.openCommentInput,x=r.feedItem,y=r.currentUser,I=o(!1),b=e(I,2),j=b[0],v=b[1],R=o(3),g=e(R,2),k=g[0],w=g[1],U=t(),_=h(),q=x.comments.length,M=q>k;return f("div",{className:(i||!!q)&&_.feedCommentsContainer,children:[i&&!l&&C(d,{inputRef:U,postComment:function(e){u(x.id,e)},setIsPosting:v,companyId:x.company_id,autoFocus:!1,currentUser:y}),M&&C(s,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:_.showMoreButtonRoot,onClick:function(){w((function(e){return 3===e?e+7:e+10}))},children:C(a,{variant:"caption",color:"primary",children:"View more comments"})}),x.comments.sort((function(e){return-m(e.created_at).unix()})).slice(0,k).reverse().map((function(e){return C(p,{comment:e,handleDeleteCallback:n,patchCommentCallback:n,companyId:x.company_id,currentUser:y},e.id)})),j&&C(c,{})]})}x.propTypes={openCommentInput:r.bool.isRequired,feedItem:r.shape().isRequired,currentUser:r.shape().isRequired};export{x as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import o from"classnames";import{makeStyles as t}from"@material-ui/core";import{isNativeDetected as i}from"../../../utils/mobileDetect.js";import{getIconForFeedItemType as r,AVATAR_ICON as a}from"../../../utils/feed.js";import{FEED_ITEM_TYPES_BY_KEY as m}from"../../../constants/feed.js";import{ALERT_LEVEL_COLOR as n}from"../../../constants/alerts.js";import l from"./AvatarIcon.js";import{jsx as d}from"react/jsx-runtime";var c=t({icon:{width:46,height:46,backgroundColor:"grey",borderRadius:23,position:"absolute",top:15,left:-23,padding:9},iconWrapper:{display:"inline-block",height:28,width:28,overflow:"hidden"},iconImg:{height:28,width:28},iconNative:{left:"auto"}}),s=function(t){var r,a=t.feedItem,l=t.feedItemType,s=t.icon,p=c(),f=m[l]?m[l].label:"Other";if(l===m.alert.type){var u,h,v=null===(u=a.context)||void 0===u||null===(h=u.alert)||void 0===h?void 0:h.level;r={backgroundColor:n[v]}}return d("div",{className:o(p.icon,e({},p.iconNative,i)),style:r,children:d("div",{className:p.iconWrapper,children:d("img",{src:s,alt:"".concat(f," icon"),className:p.iconImg})})})},p=function(e){var o=e.feedItem,t=e.displayName,i=e.isRecommended,m=o.type,n=r(m);return n===a?d(l,{displayName:t,feedItem:o,isRecommended:i}):d(s,{icon:n,feedItem:o,feedItemType:m})};export{p as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import o from"classnames";import{makeStyles as t}from"@material-ui/core";import{isNativeDetected as i}from"../../../utils/mobileDetect.js";import{getIconForFeedItemType as r,AVATAR_ICON as a}from"../../../utils/feed.js";import{FEED_ITEM_TYPES_BY_KEY as m}from"../../../constants/feed.js";import{ALERT_LEVEL_COLOR as n}from"../../../constants/alerts.js";import l from"./AvatarIcon.js";import{jsx as d}from"react/jsx-runtime";var c=t({icon:{width:32,height:32,backgroundColor:"grey",borderRadius:23,position:"absolute",top:15,left:-23,padding:9},iconWrapper:{display:"inline-block",height:28,width:28,overflow:"hidden"},iconImg:{height:28,width:28},iconNative:{left:"auto"}}),s=function(t){var r,a=t.feedItem,l=t.feedItemType,s=t.icon,p=c(),f=m[l]?m[l].label:"Other";if(l===m.alert.type){var u,h,v=null===(u=a.context)||void 0===u||null===(h=u.alert)||void 0===h?void 0:h.level;r={backgroundColor:n[v]}}return d("div",{className:o(p.icon,e({},p.iconNative,i)),style:r,children:d("div",{className:p.iconWrapper,children:d("img",{src:s,alt:"".concat(f," icon"),className:p.iconImg})})})},p=function(e){var o=e.feedItem,t=e.displayName,i=e.isRecommended,m=o.type,n=r(m);return n===a?d(l,{displayName:t,feedItem:o,isRecommended:i}):d(s,{icon:n,feedItem:o,feedItemType:m})};export{p as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"classnames";import i from"moment";import{uniq as n}from"lodash";import{makeStyles as r,useTheme as o,IconButton as m}from"@material-ui/core";import a from"@material-ui/icons/ThumbUp";import s from"@material-ui/icons/Comment";import{notifyOpenFeedCommentInput as l}from"../../../utils/nativeMessages.js";import{isNativeDetected as c}from"../../../utils/mobileDetect.js";import u from"../../CommentsInfo/index.js";import p from"../../../utils/main.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";var g=r({reactionButton:{padding:8},reactions:{minHeight:48,marginTop:5,display:"flex",alignItems:"center",padding:"0 16px 0 33px",flexWrap:"wrap"},reactionsNative:{padding:"0 16px"},actions:{display:"flex",marginRight:30,alignItems:"center",marginLeft:-12}}),h=c?2:4,C=function(r){var C=r.feedItem,k=r.currentUser,v=r.setOpenCommentInput,x=r.openCommentInput,N=r.handleToggleLike,I=o(),b=g(),y=C.likes_count,j=C.comments.length,B=-1!==(C.likes||[]).findIndex((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===k.id})),L=(C.likes||[]).map((function(e){return p.getUserFullName(e.user)})),U=n((C.comments||[]).map((function(e){return p.getUserFullName(e.user)}))),F=n((C.comments||[]).concat(C.likes||[]).sort((function(e){return i(e.created_at).unix()})).map((function(e){return e.user}))).slice(0,h);return d("div",{className:t(b.reactions,e({},b.reactionsNative,c)),children:f("div",{className:b.actions,children:[d(m,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:N,className:b.reactionButton,children:d(a,{htmlColor:B?I.palette.primary.main:I.palette.grey[400]})}),d(m,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){c?l(C.id):v(!x)},className:b.reactionButton,children:d(s,{htmlColor:I.palette.grey[400]})}),d(u,{likesCount:y,usersWhoLike:L,commentsCount:j,usersWhoCommented:U,activeUsersList:F,onCommentsClick:function(){return v(!x)},small:!0})]})})};export{C as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"classnames";import n from"moment";import{uniq as i}from"lodash";import{makeStyles as o,useTheme as r}from"@material-ui/core";import m from"@material-ui/icons/ThumbUp";import a from"@material-ui/icons/Comment";import{notifyOpenFeedCommentInput as s}from"../../../utils/nativeMessages.js";import{isNativeDetected as l}from"../../../utils/mobileDetect.js";import c from"../../CommentsInfo/index.js";import u from"../../IconButton/index.js";import p from"../../../utils/main.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";var g=o({reactionButton:{padding:8},reactions:{minHeight:48,marginTop:5,display:"flex",alignItems:"center",padding:"0 24px 16px 32px",flexWrap:"wrap"},reactionsNative:{padding:"0 16px"},actions:{display:"flex",marginRight:30,alignItems:"center"}}),h=l?2:4,C=function(o){var C=o.feedItem,x=o.currentUser,k=o.setOpenCommentInput,v=o.openCommentInput,I=o.handleToggleLike,N=r(),b=g(),j=C.likes_count,y=C.comments.length,B=-1!==(C.likes||[]).findIndex((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===x.id})),U=(C.likes||[]).map((function(e){return p.getUserFullName(e.user)})),F=i((C.comments||[]).map((function(e){return p.getUserFullName(e.user)}))),L=i((C.comments||[]).concat(C.likes||[]).sort((function(e){return n(e.created_at).unix()})).map((function(e){return e.user}))).slice(0,h);return d("div",{className:t(b.reactions,e({},b.reactionsNative,l)),children:f("div",{className:b.actions,children:[d(u,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:I,className:b.reactionButton,children:d(m,{htmlColor:B?N.palette.primary.main:N.palette.grey[400]})}),d(u,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){l?s(C.id):k(!v)},className:b.reactionButton,children:d(a,{htmlColor:N.palette.grey[400]})}),d(c,{likesCount:j,usersWhoLike:U,commentsCount:y,usersWhoCommented:F,activeUsersList:L,onCommentsClick:function(){return k(!v)},small:!0})]})})};export{C as default};
@@ -1 +1 @@
1
- import{Link as e}from"react-router";import{makeStyles as i,Typography as t}from"@material-ui/core";import{jsx as n,jsxs as o}from"react/jsx-runtime";var l=i((function(e){return{contentAssetInfo:{color:e.palette.grey[400],width:"100%",fontSize:12},assetLink:{cursor:"pointer",display:"block",width:"100%",padding:"2px 0",fontSize:"12px"}}})),r=function(i){var r,a,d,c,s,v,u=i.feedItem,m=l(),f=!!u.rig,p=function(e){var i,t,n;return e.rig?null===(i=e.rig)||void 0===i?void 0:i.name:null===(t=e.well)||void 0===t||null===(n=t.parent_asset)||void 0===n?void 0:n.name}(u),g=f?null===(r=u.rig)||void 0===r||null===(a=r.active_well)||void 0===a?void 0:a.name:null===(d=u.well)||void 0===d?void 0:d.name,w=f?null===(c=u.rig)||void 0===c||null===(s=c.active_well)||void 0===s?void 0:s.id:null===(v=u.well)||void 0===v?void 0:v.id;return w?n(e,{"data-testid":"".concat("FeedPo","_wellLink"),className:m.assetLink,onClick:function(e){return e.stopPropagation()},to:"/assets/".concat(w,"/"),children:o(t,{variant:"body2",className:m.contentAssetInfo,children:[p," - ",g]})}):o(t,{variant:"body2",className:m.contentAssetInfo,children:[p," - No Active Well"]})};export{r as default};
1
+ import{Link as e}from"react-router";import{makeStyles as t,Typography as i}from"@material-ui/core";import{jsx as n,jsxs as o}from"react/jsx-runtime";var l=t((function(e){return{contentAssetInfo:{color:e.palette.primary.text6,width:"100%",fontSize:12},assetLink:{cursor:"pointer",display:"block",width:"100%",padding:"2px 0",fontSize:"12px"}}})),r=function(t){var r,a,d,c,s,v,u=t.feedItem,m=l(),f=!!u.rig,p=function(e){var t,i,n;return e.rig?null===(t=e.rig)||void 0===t?void 0:t.name:null===(i=e.well)||void 0===i||null===(n=i.parent_asset)||void 0===n?void 0:n.name}(u),w=f?null===(r=u.rig)||void 0===r||null===(a=r.active_well)||void 0===a?void 0:a.name:null===(d=u.well)||void 0===d?void 0:d.name,g=f?null===(c=u.rig)||void 0===c||null===(s=c.active_well)||void 0===s?void 0:s.id:null===(v=u.well)||void 0===v?void 0:v.id;return g?n(e,{"data-testid":"".concat("FeedPo","_wellLink"),className:m.assetLink,onClick:function(e){return e.stopPropagation()},to:"/assets/".concat(g,"/"),children:o(i,{variant:"body2",className:m.contentAssetInfo,children:[p," - ",w]})}):o(i,{variant:"body2",className:m.contentAssetInfo,children:[p," - No Active Well"]})};export{r as default};
@@ -1 +1 @@
1
- import{makeStyles as e,Typography as t}from"@material-ui/core";import{FEED_ITEM_TYPES_BY_KEY as o,FEED_ITEM_TYPES as a}from"../../../constants/feed.js";import{jsx as r}from"react/jsx-runtime";var s=[o.post.type,o.app_annotation.type,o.geosteering_comments.type,a.TRACES_MEMO],i=e((function(e){return{assetRoot:{color:e.palette.grey[400],whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",marginRight:10},postTitle:{color:"#fff"}}})),n=function(e){var o=e.feedItem,a=e.userFullName,n=e.typeLabel,l=i(),p=s.includes(o.type)?a:n;return r(t,{variant:"body2",className:l.assetRoot,children:r("span",{"data-testid":"".concat("FeedPo","_postTitle"),className:l.postTitle,children:p})})};export{n as default};
1
+ import{makeStyles as e,Typography as t}from"@material-ui/core";import{FEED_ITEM_TYPES_BY_KEY as o,FEED_ITEM_TYPES as a}from"../../../constants/feed.js";import{jsx as r}from"react/jsx-runtime";var i=[o.post.type,o.app_annotation.type,o.geosteering_comments.type,a.TRACES_MEMO],n=e((function(e){return{assetRoot:{color:e.palette.grey[400],whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",marginRight:10,fontWeight:700,letterSpacing:.25},postTitle:{color:"#fff"}}})),s=function(e){var o=e.feedItem,a=e.userFullName,s=e.typeLabel,l=n(),p=i.includes(o.type)?a:s;return r(t,{variant:"body2",className:l.assetRoot,children:r("span",{"data-testid":"".concat("FeedPo","_postTitle"),className:l.postTitle,children:p})})};export{s as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/defineProperty";import{shape as r,oneOfType as i,number as a,string as o,func as n}from"prop-types";import{Map as p,List as s}from"immutable";import c from"moment";import{makeStyles as m,Typography as d}from"@material-ui/core";import{isNativeDetected as u}from"../../../../utils/mobileDetect.js";import l from"../../../EmbeddedApp/DevCenterEmbeddedApp.js";import b from"../../../EmbeddedApp/EmbeddedApp.js";import f from"../../../Attachment/index.js";import{formatMentionText as g}from"../../../UserMention/utils/index.js";import{normalizeAssetForApp as y}from"./helpers.js";import A from"./styles.css.js";import{jsx as h,jsxs as j}from"react/jsx-runtime";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function O(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?w(Object(i),!0).forEach((function(r){t(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var R=m({attachmentLable:{fontSize:"12px",color:"#ccc"}}),v=function(e){var t=e.feedItem,r=t.id,i=t.well,a=t.rig,o=t.app,n=t.package,m=t.company_id,w=t.context.app_annotation,v=w.body,_=w.app_category,q=w.app_key,D=w.created_at,E=w.settings,S=void 0===E?{}:E,C=w.attachment,P=w.data_timestamp,x=t.mentioned_users,F=e.appContext,I=e.appRegistry,N=e.subscribeAppForAsset,k=e.unsubscribeAppFromAsset,L=e.currentUser,U=e.appData,z=e.isSubDataLoading,B=e.getSubErrors,K=e.isSubDataEmpty,M=R(),T=!!o,G=T&&"dev_center"===o.platform;if(!T||G&&!n)return h(d,{variant:"body2",children:"App not found"});var H=y(i||a,m),J=c(P||D).unix();return[H,_,q,D].every(Boolean)&&H.id?j("div",{className:A.appAnnotationFeedItem,children:[h(d,{variant:"body2","data-testid":"".concat("FeedActivityPo_appAnnotation","_message"),children:g(v,x,u)}),h("br",{}),n&&n.url?h(l,{appContainerClassName:A.appAnnotationFeedItemApp,appId:r,assetId:H.id,asset:H,app:{app:O(O({},o),{},{settings:S}),package:n},coordinates:{},timestamp:J,time:P,currentUser:L}):h(b,{appContainerClassName:A.appAnnotationFeedItemApp,appId:r,assetId:H.id,asset:p(H),appComponentKey:q,appComponentCategory:_,requiresSubscription:!0,appContext:p(F),assetDashboards:s(),timestamp:J,time:P,onSettingChange:function(){},settings:S,internalSelectors:{isSubDataLoading:z,getSubErrors:B,isSubDataEmpty:K},appRegistry:I,appData:U,subscribeAppForAsset:N,unsubscribeAppFromAsset:k}),C&&C.s3_link&&j("div",{className:A.appAnnotationFeedItemAttachment,children:[h(d,{variant:"subtitle1",className:M.attachmentLable,children:"Attachments"}),h(f,{small:!0,attachmentUrl:C.signed_url,fileName:C.file_name,displayName:C.file_name})]})]}):h(d,{variant:"body2",children:"No Data"})};v.propTypes={feedItem:r({id:i([a,o]).isRequired,well:function(t,r,i){return t.well||t.rig?t.well&&"object"!==e(t.well)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},rig:function(t,r,i){return t.well||t.rig?t.rig&&"object"!==e(t.rig)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},context:r({app_annotation:r({body:o,app_category:o.isRequired,app_name:o.isRequired,created_at:o.isRequired,settings:r()}).isRequired}).isRequired}).isRequired,appContext:r().isRequired,currentUser:r().isRequired,appData:r().isRequired,appRegistry:r().isRequired,subscribeAppForAsset:n.isRequired,unsubscribeAppFromAsset:n.isRequired,isSubDataLoading:n.isRequired,getSubErrors:n.isRequired,isSubDataEmpty:n.isRequired};export{v as default};
1
+ import e from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/defineProperty";import{shape as r,oneOfType as i,number as a,string as n,func as o}from"prop-types";import{Map as p,List as s}from"immutable";import m from"moment";import{makeStyles as c,Typography as d}from"@material-ui/core";import{isNativeDetected as u}from"../../../../utils/mobileDetect.js";import l from"../../../EmbeddedApp/DevCenterEmbeddedApp.js";import b from"../../../EmbeddedApp/EmbeddedApp.js";import f from"../../../Attachment/index.js";import{formatMentionText as g}from"../../../UserMention/utils/index.js";import{normalizeAssetForApp as y}from"./helpers.js";import A from"./styles.css.js";import{jsx as h,jsxs as j}from"react/jsx-runtime";function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function O(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?w(Object(i),!0).forEach((function(r){t(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var R=c((function(e){return{attachmentLable:{fontSize:"12px",color:e.palette.primary.text6}}})),v=function(e){var t=e.feedItem,r=t.id,i=t.well,a=t.rig,n=t.app,o=t.package,c=t.company_id,w=t.context.app_annotation,v=w.body,_=w.app_category,q=w.app_key,D=w.created_at,E=w.settings,S=void 0===E?{}:E,x=w.attachment,C=w.data_timestamp,P=t.mentioned_users,F=e.appContext,I=e.appRegistry,N=e.subscribeAppForAsset,k=e.unsubscribeAppFromAsset,L=e.currentUser,U=e.appData,z=e.isSubDataLoading,B=e.getSubErrors,K=e.isSubDataEmpty,M=R(),T=!!n,G=T&&"dev_center"===n.platform;if(!T||G&&!o)return h(d,{variant:"body2",children:"App not found"});var H=y(i||a,c),J=m(C||D).unix();return[H,_,q,D].every(Boolean)&&H.id?j("div",{className:A.appAnnotationFeedItem,children:[h(d,{variant:"body2","data-testid":"".concat("FeedActivityPo_appAnnotation","_message"),children:g(v,P,u)}),h("br",{}),o&&o.url?h(l,{appContainerClassName:A.appAnnotationFeedItemApp,appId:r,assetId:H.id,asset:H,app:{app:O(O({},n),{},{settings:S}),package:o},coordinates:{},timestamp:J,time:C,currentUser:L}):h(b,{appContainerClassName:A.appAnnotationFeedItemApp,appId:r,assetId:H.id,asset:p(H),appComponentKey:q,appComponentCategory:_,requiresSubscription:!0,appContext:p(F),assetDashboards:s(),timestamp:J,time:C,onSettingChange:function(){},settings:S,internalSelectors:{isSubDataLoading:z,getSubErrors:B,isSubDataEmpty:K},appRegistry:I,appData:U,subscribeAppForAsset:N,unsubscribeAppFromAsset:k}),x&&x.s3_link&&j("div",{className:A.appAnnotationFeedItemAttachment,children:[h(d,{variant:"subtitle1",className:M.attachmentLable,children:"Attachments"}),h(f,{small:!0,attachmentUrl:x.signed_url,fileName:x.file_name,displayName:x.file_name})]})]}):h(d,{variant:"body2",children:"No Data"})};v.propTypes={feedItem:r({id:i([a,n]).isRequired,well:function(t,r,i){return t.well||t.rig?t.well&&"object"!==e(t.well)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},rig:function(t,r,i){return t.well||t.rig?t.rig&&"object"!==e(t.rig)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},context:r({app_annotation:r({body:n,app_category:n.isRequired,app_name:n.isRequired,created_at:n.isRequired,settings:r()}).isRequired}).isRequired}).isRequired,appContext:r().isRequired,currentUser:r().isRequired,appData:r().isRequired,appRegistry:r().isRequired,subscribeAppForAsset:o.isRequired,unsubscribeAppFromAsset:o.isRequired,isSubDataLoading:o.isRequired,getSubErrors:o.isRequired,isSubDataEmpty:o.isRequired};export{v as default};
@@ -1 +1 @@
1
- import t from'./../../../../ext-esm/style-inject/dist/style-inject.es.js';var e={appAnnotationFeedItem:"styles_appAnnotationFeedItem__YxXXr",appAnnotationFeedItemApp:"styles_appAnnotationFeedItemApp__ocHQR",appAnnotationFeedItemAttachment:"styles_appAnnotationFeedItemAttachment__0MiDo"};t(".styles_appAnnotationFeedItem__YxXXr{display:flex;flex-direction:column}.styles_appAnnotationFeedItemApp__ocHQR{display:inline-block;height:500px;margin-right:15px;position:relative;width:600px}.styles_appAnnotationFeedItemAttachment__0MiDo{padding-top:10px;width:200px}");export{e as default};
1
+ import t from'./../../../../ext-esm/style-inject/dist/style-inject.es.js';var e={appAnnotationFeedItem:"styles_appAnnotationFeedItem__YxXXr",appAnnotationFeedItemApp:"styles_appAnnotationFeedItemApp__ocHQR",appAnnotationFeedItemAttachment:"styles_appAnnotationFeedItemAttachment__0MiDo"};t(".styles_appAnnotationFeedItem__YxXXr{display:flex;flex-direction:column}.styles_appAnnotationFeedItemApp__ocHQR{display:inline-block;height:480px;margin-right:15px;position:relative;width:628px}.styles_appAnnotationFeedItemAttachment__0MiDo{padding-top:10px;width:300px}");export{e as default};
@@ -1 +1 @@
1
- import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var i={cComponentFilePreview:"styles_cComponentFilePreview__u5R6s",cComponentFilePreviewWrapper:"styles_cComponentFilePreviewWrapper__efPtx",cComponentFilePreviewDeleteFile:"styles_cComponentFilePreviewDeleteFile__I4343",cComponentFilePreviewDeleteFileCentered:"styles_cComponentFilePreviewDeleteFileCentered__6rfz6",cComponentFilePreviewImageFileWrapper:"styles_cComponentFilePreviewImageFileWrapper__BW-s-",cComponentFilePreviewName:"styles_cComponentFilePreviewName__x37wX",cComponentFilePreviewImage:"styles_cComponentFilePreviewImage__affFU",cComponentFilePreviewDownload:"styles_cComponentFilePreviewDownload__MlNlb",cComponentFilePreviewDownloadText:"styles_cComponentFilePreviewDownloadText__qoZzr"};e(".styles_cComponentFilePreview__u5R6s{background:#4d4d4d;border-radius:4px;display:flex;margin-left:26px;margin-top:10px;padding:2px 0;position:relative;width:calc(100% - 29px)}.styles_cComponentFilePreviewWrapper__efPtx{align-items:center;display:flex;margin-left:8px}.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewDeleteFile__I4343{margin-left:20px;position:relative;visibility:visible}.styles_cComponentFilePreviewDeleteFile__I4343{position:absolute!important;right:8px;top:0;visibility:hidden}.styles_cComponentFilePreviewDeleteFileCentered__6rfz6{top:50%;transform:translateY(-50%)}.styles_cComponentFilePreviewImageFileWrapper__BW-s-{border-radius:3px;margin-bottom:0;margin-top:0;overflow:hidden;text-align:center}.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewImageFileWrapper__BW-s-,.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewWrapper__efPtx{opacity:.7}.styles_cComponentFilePreviewImageFileWrapper__BW-s-:hover .styles_cComponentFilePreviewDeleteFile__I4343{visibility:visible}.styles_cComponentFilePreviewName__x37wX{align-items:center;display:flex;justify-content:space-between;margin:20px 0 0}.styles_cComponentFilePreviewImage__affFU{max-height:100%;max-width:100%;vertical-align:top}.styles_cComponentFilePreviewDownload__MlNlb{align-items:center;border-radius:3px;cursor:pointer;display:flex;margin:5px 0;padding:5px;width:150px}.styles_cComponentFilePreviewDownloadText__qoZzr{display:flex;justify-content:space-between;margin-left:10px;width:calc(100% - 60px)}");export{i as default};
1
+ import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var i={cComponentFilePreview:"styles_cComponentFilePreview__u5R6s",cComponentFilePreviewWrapper:"styles_cComponentFilePreviewWrapper__efPtx",cComponentFilePreviewDeleteFile:"styles_cComponentFilePreviewDeleteFile__I4343",cComponentFilePreviewDeleteFileCentered:"styles_cComponentFilePreviewDeleteFileCentered__6rfz6",cComponentFilePreviewImageFileWrapper:"styles_cComponentFilePreviewImageFileWrapper__BW-s-",cComponentFilePreviewName:"styles_cComponentFilePreviewName__x37wX",cComponentFilePreviewImage:"styles_cComponentFilePreviewImage__affFU",cComponentFilePreviewDownload:"styles_cComponentFilePreviewDownload__MlNlb",cComponentFilePreviewDownloadText:"styles_cComponentFilePreviewDownloadText__qoZzr"};e(".styles_cComponentFilePreview__u5R6s{background:#4d4d4d;border-radius:4px;display:flex;margin-left:40px;margin-top:10px;max-height:300px;padding:2px 0;position:relative}.styles_cComponentFilePreviewWrapper__efPtx{align-items:center;display:flex;margin-left:8px}.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewDeleteFile__I4343{margin-left:20px;position:relative;visibility:visible}.styles_cComponentFilePreviewDeleteFile__I4343{position:absolute!important;right:8px;top:0;visibility:hidden}.styles_cComponentFilePreviewDeleteFileCentered__6rfz6{top:50%;transform:translateY(-50%)}.styles_cComponentFilePreviewImageFileWrapper__BW-s-{border-radius:3px;margin-bottom:0;margin-top:0;overflow:hidden;text-align:center}.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewImageFileWrapper__BW-s-,.styles_cComponentFilePreview__u5R6s:hover .styles_cComponentFilePreviewWrapper__efPtx{opacity:.7}.styles_cComponentFilePreviewImageFileWrapper__BW-s-:hover .styles_cComponentFilePreviewDeleteFile__I4343{visibility:visible}.styles_cComponentFilePreviewName__x37wX{align-items:center;display:flex;justify-content:space-between;margin:20px 0 0}.styles_cComponentFilePreviewImage__affFU{max-height:100%;max-width:100%;vertical-align:top}.styles_cComponentFilePreviewDownload__MlNlb{align-items:center;border-radius:3px;cursor:pointer;display:flex;margin:5px 0;padding:5px;width:150px}.styles_cComponentFilePreviewDownloadText__qoZzr{display:flex;justify-content:space-between;margin-left:10px;width:calc(100% - 60px)}");export{i as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{useCallback as o,useEffect as n}from"react";import{debounce as r}from"lodash";import t from"prop-types";import{withStyles as i}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as c}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as p}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import u from"../Avatar/index.js";import{handleFetchUsers as m}from"./utils/index.js";import{USER_MARKUP as d}from"./constants.js";import f from"./style.css.js";import{jsx as g,jsxs as y}from"react/jsx-runtime";function b(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),n.push.apply(n,r)}return n}function h(o){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?b(Object(r),!0).forEach((function(n){e(o,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var _={backgroundColor:l[100]},j={color:"#00bcd4"},O={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},v=h(h({},O),{},{input:{color:"transparent",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),P=h(h({},O),{},{input:{color:"#000"}}),w=function(e){var t=e.onChange,i=e.singleLine,l=e.suggestionsPortalHost,c=e.value,p=e.inputRef,b=e.classes,h=e.withLightTheme,O=e.placeholder,w=e.onMount,C=e.onKeyDown,S=e.onKeyUp,x=e.autoFocus,R=e.disabled,D=e.companyId,K=e.currentUser,L=e.isCompanySelectVisible,N=o(r((function(e,o){var n=L&&K.company_id!==D?[K.company_id,D]:null;m(e,o,n)}),400),[D]);return n(w,[]),g(s,{value:c,onChange:function(e,o){t(o)},singleLine:i,allowSpaceInQuery:!0,classNames:f,placeholder:O,suggestionsPortalHost:l,inputRef:p,style:h?P:v,onKeyDown:C,onKeyUp:S,autoFocus:x,disabled:R,children:g(a,{markup:d,renderSuggestion:function(e){return function(e,o){return y("div",{className:f.mention__suggestion,children:[g(u,{alt:e.display,displayName:e.display,className:o.avatar,imgSrc:e.photo}),y("div",{className:f.mention__suggestion__info,children:[g("span",{"data-testid":"".concat("userMention","_name_").concat(e.display),className:f.mention__suggestion__info__name,children:e.display}),e.title&&g("span",{className:f.mention__suggestion__info__group,children:e.title})]})]})}(e,b)},trigger:"@",data:N,displayTransform:function(e,o){return"@".concat(o)},style:h?_:j,appendSpaceOnAdd:!0})})};w.propTypes={onChange:t.func,singleLine:t.bool,suggestionsPortalHost:t.shape({current:t.instanceOf(Element)}),value:t.string,inputRef:t.shape({}),classes:t.shape({avatar:t.string.isRequired}).isRequired,withLightTheme:t.bool,placeholder:t.string,onMount:t.func,onKeyDown:t.func,onKeyUp:t.func,autoFocus:t.bool,disabled:t.bool,currentUser:t.shape({company_id:t.number.isRequired}).isRequired,companyId:t.number,isCompanySelectVisible:t.bool.isRequired},w.defaultProps={onChange:function(){},singleLine:!1,suggestionsPortalHost:null,value:"",inputRef:null,withLightTheme:!0,placeholder:"Mention people using '@'",onMount:function(){},onKeyDown:function(){},onKeyUp:function(){},autoFocus:!0,disabled:!1,companyId:null};var C=p({isCompanySelectVisible:c.companySelectorView})(i({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(w));export{C as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import{useCallback as o,useEffect as n}from"react";import{debounce as r}from"lodash";import t from"prop-types";import{withStyles as i}from"@material-ui/core/styles";import{MentionsInput as s,Mention as a}from"react-mentions";import l from"@material-ui/core/colors/blue";import"../../permissions/PermissionsContext.js";import{PERMISSIONS as c}from"../../permissions/constants/index.js";import"@babel/runtime/helpers/slicedToArray";import{withPermissionsHOC as u}from"../../permissions/withPermissionsHOC.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import p from"../Avatar/index.js";import{handleFetchUsers as m}from"./utils/index.js";import{USER_MARKUP as f}from"./constants.js";import d from"./style.css.js";import{jsx as g,jsxs as y}from"react/jsx-runtime";function b(e,o){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),n.push.apply(n,r)}return n}function h(o){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?b(Object(r),!0).forEach((function(n){e(o,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var _={backgroundColor:l[100]},j={color:"#00bcd4"},O={suggestions:{item:{"&focused":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},v=h(h({},O),{},{input:{color:"transparent",caretColor:"#fff",zIndex:1},highlighter:{color:"#fff"}}),P=h(h({},O),{},{input:{color:"#000"}}),w=function(e){var t=e.onChange,i=e.singleLine,l=e.suggestionsPortalHost,c=e.value,u=e.inputRef,b=e.classes,h=e.withLightTheme,O=e.placeholder,w=e.onMount,C=e.onKeyDown,S=e.onKeyUp,x=e.onFocus,R=e.onBlur,D=e.autoFocus,F=e.disabled,K=e.companyId,L=e.currentUser,N=e.isCompanySelectVisible,T=o(r((function(e,o){var n=N&&L.company_id!==K?[L.company_id,K]:null;m(e,o,n)}),400),[K]);return n(w,[]),g(s,{value:c,onChange:function(e,o){t(o)},singleLine:i,allowSpaceInQuery:!0,classNames:d,placeholder:O,suggestionsPortalHost:l,inputRef:u,style:h?P:v,onKeyDown:C,onKeyUp:S,autoFocus:D,onFocus:x,onBlur:R,disabled:F,children:g(a,{markup:f,renderSuggestion:function(e){return function(e,o){return y("div",{className:d.mention__suggestion,children:[g(p,{alt:e.display,displayName:e.display,className:o.avatar,imgSrc:e.photo}),y("div",{className:d.mention__suggestion__info,children:[g("span",{"data-testid":"".concat("userMention","_name_").concat(e.display),className:d.mention__suggestion__info__name,children:e.display}),e.title&&g("span",{className:d.mention__suggestion__info__group,children:e.title})]})]})}(e,b)},trigger:"@",data:T,displayTransform:function(e,o){return"@".concat(o)},style:h?_:j,appendSpaceOnAdd:!0})})};w.propTypes={onChange:t.func,singleLine:t.bool,suggestionsPortalHost:t.shape({current:t.instanceOf(Element)}),value:t.string,inputRef:t.shape({}),classes:t.shape({avatar:t.string.isRequired}).isRequired,withLightTheme:t.bool,placeholder:t.string,onMount:t.func,onKeyDown:t.func,onKeyUp:t.func,onFocus:t.func,onBlur:t.func,autoFocus:t.bool,disabled:t.bool,currentUser:t.shape({company_id:t.number.isRequired}).isRequired,companyId:t.number,isCompanySelectVisible:t.bool.isRequired},w.defaultProps={onChange:function(){},singleLine:!1,suggestionsPortalHost:null,value:"",inputRef:null,withLightTheme:!0,placeholder:"Mention people using '@'",onMount:function(){},onKeyDown:function(){},onKeyUp:function(){},onFocus:function(){},onBlur:function(){},autoFocus:!0,disabled:!1,companyId:null};var C=u({isCompanySelectVisible:c.companySelectorView})(i({avatar:{height:45,width:45,border:"1.5px solid #fff"}})(w));export{C as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.35.0-0",
3
+ "version": "0.35.0-1",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"
@@ -1 +0,0 @@
1
- import{makeStyles as e,Divider as t}from"@material-ui/core";import{isNativeDetected as m}from"../../../utils/mobileDetect.js";import o from"./FeedComments.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";var n=e({commentsDividerRoot:{margin:"5px 16px 10px 33px"},commentsDividerRootNative:{margin:"5px 16px 10px 16px"}}),p=function(e){var p=e.feedItem,s=e.openCommentInput,a=e.user,c=n(),d=p.comments.length;return i("div",{children:[(!!d||s)&&r(t,{className:m?c.commentsDividerRootNative:c.commentsDividerRoot}),r(o,{openCommentInput:s,feedItem:p,isNative:m,user:a})]})};export{p as default};