@corva/ui 0.65.0-1 → 0.65.0-2

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
- "use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),i=require("react"),r=require("classnames"),s=require("prop-types"),o=require("@material-ui/core/styles"),c=require("lodash"),u=require("@material-ui/core/withWidth"),d=require("moment"),l=require("@material-ui/core"),m=require("@material-ui/core/colors/grey"),p=require("@material-ui/icons/MoreVert"),h=require("../../../../../Avatar/index.js"),f=require("../../../../../UserCardPopover.js"),q=require("../../../../../ConfirmationDialog.js"),x=require("../../../../../CommentsInfo/index.js"),j=require("../../../../../UserMention/utils/index.js"),v=require("../../../../../Attachment/index.js"),g=require("../../../../../../utils/mobileDetect.js"),y=require("../../../../../../clients/jsonApi/index.js"),A=require("../AnnotationComments/index.js"),b=require("../../../../AnnotationsContext.js"),C=require("../../../../constants.js"),_=require("../AnnotationInput/index.js"),N=require("./style.css.js"),R=require("react/jsx-runtime");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=T(e),M=T(t),D=T(n),w=T(a),k=T(r),E=T(u),O=T(d),S=T(m),U=T(p),B="AppAnnotationItemPo",P=function(e){var t=e.user,n=e.currentUser,a=e.classes;return R.jsx("div",{className:N.cAnnotationUserAvatar,children:g.isNativeDetected?R.jsx(h.default,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:a.avatar}):R.jsx(f,{user:t,currentUser:n,children:R.jsx(h.default,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:a.avatar})})})},z=function(e){var t=e.actionsMenuAnchorEl,n=e.handleToggleActionsMenu,a=e.classes,i=e.handleEdit,r=e.handleDelete;return R.jsxs(R.Fragment,{children:[R.jsx(l.IconButton,{"data-testid":"".concat(B,"_menuButton"),"aria-label":"Actions","aria-owns":t?N.cAnnotationContainerActionsMenu:void 0,"aria-haspopup":"true",className:a.iconButtonRoot,onClick:n,children:R.jsx(U.default,{htmlColor:S.default[400]})}),R.jsxs(l.Menu,{id:"cAnnotationContainerActionsMenu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:t,open:!!t,onClick:n,children:[R.jsx(l.MenuItem,{"data-testid":"".concat(B,"_editMenuItem"),onClick:i,children:"Edit"}),R.jsx(l.MenuItem,{"data-testid":"".concat(B,"_deleteMenuItem"),onClick:r,children:"Delete"})]})]})},L=function(e){var t,n,a=e.included,r=e.annotation,s=e.assetCompanyId,o=e.classes,c=e.showSuccessNotification,d=e.width,m=i.useState(!1),p=D.default(m,2),h=p[0],f=p[1],T=i.useState(null),E=D.default(T,2),S=E[0],U=E[1],L=i.useState(!1),W=D.default(L,2),F=W[0],Y=W[1],G=i.useState(!1),H=D.default(G,2),V=H[0],J=H[1],K=!u.isWidthUp("sm",d),Q=r.attributes.comments_count||0,X=i.useState(Q),Z=D.default(X,2),$=Z[0],ee=Z[1],te=b.useAnnotationsDispatch(),ne=r.relationships.comment_users.data.reduce((function(e,t){var n=t.id,i=a.find((function(e){return e.id===n}));return i&&e.push(i.attributes),e}),[]),ae=ne.map((function(e){var t=e.last_name,n=e.first_name;return"".concat(n," ").concat(t)})),ie=(t=M.default(w.default.mark((function e(){return w.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.deleteAnnotation(r.id);case 3:e.sent&&te({type:C.DELETE_ANNOTATION,id:r.id}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),function(){return t.apply(this,arguments)}),re=(n=M.default(w.default.mark((function e(t,n,a){var i,s;return w.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i={body:t,active_until:n,attachment:{file_name:a&&a.attachmentName,signed_url:a&&a.attachmentUrl}},e.next=4,y.patchAnnotation(r.id,i);case 4:s=e.sent,te({type:C.EDIT_ANNOTATION,annotation:s,id:r.id}),e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return");case 12:c("Annotation has been changed"),Y(!1);case 14:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(e,t,a){return n.apply(this,arguments)}),se=r.relationships.user.data.id,oe=a.find((function(e){var t=e.type,n=e.id;return"user"===t&&n===se})),ce=oe.attributes,ue=r.attributes.attachment;return R.jsxs(l.Paper,{className:o.container,elevation:0,children:[R.jsxs("div",{"data-testid":"".concat(B,"_annotation_").concat(r.attributes.body),className:N.cAnnotationContainer,children:[R.jsx(P,{user:ce,classes:o,isNative:g.isNativeDetected,currentUser:oe}),R.jsxs("div",{className:N.cAnnotationContainerTop,children:[R.jsxs("div",{className:N.cAnnotationContainerTopMainInfo,children:[R.jsx(l.Typography,{variant:"body2","data-testid":"".concat(B,"_userName"),children:"".concat(ce.first_name," ").concat(ce.last_name)}),R.jsx(l.Typography,{"data-testid":"".concat(B,"_addDate"),variant:"caption",className:o.createdAt,children:O.default(r.attributes.created_at).format("MM/DD/YY H:mm")})]}),R.jsx("div",{className:k.default(N.cAnnotationContainerTopMenu,I.default({},N.cAnnotationContainerTopMenuSmall,K)),children:R.jsx(z,{actionsMenuAnchorEl:S,handleToggleActionsMenu:function(e){var t=e.currentTarget;U(S?null:t)},handleEdit:function(){return Y(!0)},handleDelete:function(){return J(!0)},classes:o})})]}),R.jsx(l.Divider,{className:o.headerDividerRoot}),R.jsx("div",{"data-testid":"".concat(B,"_message"),className:N.cAnnotationContainerContent,children:F?R.jsx(_,{initialText:r.attributes.body,assetCompanyId:s,initialPeriod:r.attributes.created_at,initialAttachment:ue,onSend:re,onClose:function(){return Y(!1)},closeOnEsc:!0}):R.jsxs(R.Fragment,{children:[j.formatMentionText(r.attributes.body,r.relationships.mentioned_users.data,g.isNativeDetected,null,oe),ue&&ue.signed_url&&R.jsx(v,{attachmentUrl:ue.signed_url,size:"small"})]})})]}),R.jsxs("div",{"data-testid":"".concat(B,"_comments_").concat(r.attributes.body),className:N.cAnnotationComments,children:[R.jsxs("div",{className:N.cAnnotationCommentsInfo,children:[R.jsx(l.Typography,{"data-testid":"".concat(B,"_commentButton"),variant:"caption",color:"primary",className:o.link,onClick:function(){return f(!0)},children:"Comment"}),R.jsx(x,{commentsCount:$,usersWhoCommented:ae,activeUsersList:ne,currentUser:oe,small:!0})]}),R.jsx(A,{annotationId:r.id,commentInputIsOpen:h,setCommentInputIsOpen:f,commentsCount:$,initialCommentsCount:Q,assetCompanyId:s,setCommentsCount:ee,currentUser:oe})]}),V&&R.jsx(q,{open:V,text:"Do you really want to delete annotation?",handleClose:function(){return J(!1)},handleOk:ie,okText:"Delete"})]})};P.propTypes={user:s.shape({id:s.number.isRequired,first_name:s.string.isRequired,last_name:s.string.isRequired,profile_photo:s.string.isRequired}).isRequired,currentUser:s.shape({}).isRequired,classes:s.shape({}).isRequired},z.propTypes={actionsMenuAnchorEl:s.oneOf([s.node,null]).isRequired,handleToggleActionsMenu:s.func.isRequired,classes:s.shape({}).isRequired,handleDelete:s.func.isRequired,handleEdit:s.func.isRequired},L.propTypes={included:s.arrayOf(s.shape({})).isRequired,annotation:s.shape({relationships:s.shape({user:s.shape({data:s.shape({id:s.string.isRequired}).isRequired}).isRequired,mentioned_users:s.shape({data:s.arrayOf(s.shape({})).isRequired}).isRequired}).isRequired,attributes:s.shape({body:s.string.isRequired,created_at:s.string.isRequired})}).isRequired,classes:s.shape({}).isRequired,showSuccessNotification:s.func,width:s.string.isRequired,assetCompanyId:s.number.isRequired},L.defaultProps={showSuccessNotification:function(){}};var W=c.flowRight([o.withStyles((function(e){return{container:{backgroundColor:"#3b3b3be6",marginBottom:16,marginLeft:26},headerDividerRoot:{margin:"10px 0"},createdAt:{color:e.palette.grey[700],marginLeft:5},link:{cursor:"pointer"},iconButtonRoot:{height:24,width:24,padding:0,margin:"0 -10px 0 5px"}}})),E.default()])(L);module.exports=W;
1
+ "use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),i=require("react"),r=require("classnames"),s=require("prop-types"),o=require("@material-ui/core/styles"),c=require("lodash"),u=require("@material-ui/core/withWidth"),d=require("moment"),l=require("@material-ui/core"),m=require("@material-ui/core/colors/grey"),p=require("@material-ui/icons/MoreVert"),h=require("../../../../../Avatar/index.js"),f=require("../../../../../UserCardPopover.js"),q=require("../../../../../ConfirmationDialog.js"),x=require("../../../../../CommentsInfo/index.js"),j=require("../../../../../UserMention/utils/index.js"),v=require("../../../../../Attachment/index.js"),g=require("../../../../../../utils/mobileDetect.js"),y=require("../../../../../../clients/jsonApi/index.js"),A=require("../AnnotationComments/index.js"),b=require("../../../../AnnotationsContext.js"),_=require("../../../../constants.js"),C=require("../AnnotationInput/index.js"),N=require("./style.css.js"),R=require("react/jsx-runtime");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=T(e),M=T(t),D=T(n),w=T(a),k=T(r),E=T(u),O=T(d),S=T(m),U=T(p),B="AppAnnotationItemPo",P=function(e){var t=e.user,n=e.currentUser,a=e.classes;return R.jsx("div",{className:N.cAnnotationUserAvatar,children:g.isNativeDetected?R.jsx(h.default,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:a.avatar}):R.jsx(f,{user:t,currentUser:n,children:R.jsx(h.default,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:a.avatar})})})},z=function(e){var t=e.actionsMenuAnchorEl,n=e.handleToggleActionsMenu,a=e.classes,i=e.handleEdit,r=e.handleDelete;return R.jsxs(R.Fragment,{children:[R.jsx(l.IconButton,{"data-testid":"".concat(B,"_menuButton"),"aria-label":"Actions","aria-owns":t?N.cAnnotationContainerActionsMenu:void 0,"aria-haspopup":"true",className:a.iconButtonRoot,onClick:n,children:R.jsx(U.default,{htmlColor:S.default[400]})}),R.jsxs(l.Menu,{id:"cAnnotationContainerActionsMenu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:t,open:!!t,onClick:n,children:[R.jsx(l.MenuItem,{"data-testid":"".concat(B,"_editMenuItem"),onClick:i,children:"Edit"}),R.jsx(l.MenuItem,{"data-testid":"".concat(B,"_deleteMenuItem"),onClick:r,children:"Delete"})]})]})},L=function(e){var t,n,a=e.included,r=e.annotation,s=e.assetCompanyId,o=e.classes,c=e.showSuccessNotification,d=e.width,m=i.useState(!1),p=D.default(m,2),h=p[0],f=p[1],T=i.useState(null),E=D.default(T,2),S=E[0],U=E[1],L=i.useState(!1),W=D.default(L,2),F=W[0],Y=W[1],G=i.useState(!1),H=D.default(G,2),V=H[0],J=H[1],K=!u.isWidthUp("sm",d),Q=r.attributes.comments_count||0,X=i.useState(Q),Z=D.default(X,2),$=Z[0],ee=Z[1],te=b.useAnnotationsDispatch(),ne=r.relationships.comment_users.data.reduce((function(e,t){var n=t.id,i=a.find((function(e){return e.id===n}));return i&&e.push(i.attributes),e}),[]),ae=ne.map((function(e){var t=e.last_name,n=e.first_name;return"".concat(n," ").concat(t)})),ie=(t=M.default(w.default.mark((function e(){return w.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.deleteAnnotation(r.id);case 3:e.sent&&te({type:_.DELETE_ANNOTATION,id:r.id}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),function(){return t.apply(this,arguments)}),re=(n=M.default(w.default.mark((function e(t,n,a){var i,s;return w.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i={body:t,active_until:n,attachment:{file_name:a&&a.attachmentName,signed_url:a&&a.attachmentUrl}},e.next=4,y.patchAnnotation(r.id,i);case 4:s=e.sent,te({type:_.EDIT_ANNOTATION,annotation:s,id:r.id}),e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return");case 12:c("Annotation has been changed"),Y(!1);case 14:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(e,t,a){return n.apply(this,arguments)}),se=r.relationships.user.data.id,oe=a.find((function(e){var t=e.type,n=e.id;return"user"===t&&n===se})),ce=oe.attributes,ue=r.attributes.attachment;return R.jsxs(l.Paper,{className:o.container,elevation:0,children:[R.jsxs("div",{"data-testid":"".concat(B,"_annotation_").concat(r.attributes.body),className:N.cAnnotationContainer,children:[R.jsx(P,{user:ce,classes:o,isNative:g.isNativeDetected,currentUser:oe}),R.jsxs("div",{className:N.cAnnotationContainerTop,children:[R.jsxs("div",{className:N.cAnnotationContainerTopMainInfo,children:[R.jsx(l.Typography,{variant:"body2","data-testid":"".concat(B,"_userName"),children:"".concat(ce.first_name," ").concat(ce.last_name)}),R.jsx(l.Typography,{"data-testid":"".concat(B,"_addDate"),variant:"caption",className:o.createdAt,children:O.default(r.attributes.created_at).format("MM/DD/YY H:mm")})]}),R.jsx("div",{className:k.default(N.cAnnotationContainerTopMenu,I.default({},N.cAnnotationContainerTopMenuSmall,K)),children:R.jsx(z,{actionsMenuAnchorEl:S,handleToggleActionsMenu:function(e){var t=e.currentTarget;U(S?null:t)},handleEdit:function(){return Y(!0)},handleDelete:function(){return J(!0)},classes:o})})]}),R.jsx(l.Divider,{className:o.headerDividerRoot}),R.jsx("div",{"data-testid":"".concat(B,"_message"),className:N.cAnnotationContainerContent,children:F?R.jsx(C,{initialText:r.attributes.body,assetCompanyId:s,initialPeriod:r.attributes.created_at,initialAttachment:ue,onSend:re,onClose:function(){return Y(!1)},closeOnEsc:!0}):R.jsxs(R.Fragment,{children:[j.formatMentionText(r.attributes.body,r.relationships.mentioned_users.data,g.isNativeDetected,null,oe),ue&&ue.signed_url&&R.jsx(v,{attachmentUrl:ue.signed_url,fileName:ue.file_name,size:"small"})]})})]}),R.jsxs("div",{"data-testid":"".concat(B,"_comments_").concat(r.attributes.body),className:N.cAnnotationComments,children:[R.jsxs("div",{className:N.cAnnotationCommentsInfo,children:[R.jsx(l.Typography,{"data-testid":"".concat(B,"_commentButton"),variant:"caption",color:"primary",className:o.link,onClick:function(){return f(!0)},children:"Comment"}),R.jsx(x,{commentsCount:$,usersWhoCommented:ae,activeUsersList:ne,currentUser:oe,small:!0})]}),R.jsx(A,{annotationId:r.id,commentInputIsOpen:h,setCommentInputIsOpen:f,commentsCount:$,initialCommentsCount:Q,assetCompanyId:s,setCommentsCount:ee,currentUser:oe})]}),V&&R.jsx(q,{open:V,text:"Do you really want to delete annotation?",handleClose:function(){return J(!1)},handleOk:ie,okText:"Delete"})]})};P.propTypes={user:s.shape({id:s.number.isRequired,first_name:s.string.isRequired,last_name:s.string.isRequired,profile_photo:s.string.isRequired}).isRequired,currentUser:s.shape({}).isRequired,classes:s.shape({}).isRequired},z.propTypes={actionsMenuAnchorEl:s.oneOf([s.node,null]).isRequired,handleToggleActionsMenu:s.func.isRequired,classes:s.shape({}).isRequired,handleDelete:s.func.isRequired,handleEdit:s.func.isRequired},L.propTypes={included:s.arrayOf(s.shape({})).isRequired,annotation:s.shape({relationships:s.shape({user:s.shape({data:s.shape({id:s.string.isRequired}).isRequired}).isRequired,mentioned_users:s.shape({data:s.arrayOf(s.shape({})).isRequired}).isRequired}).isRequired,attributes:s.shape({body:s.string.isRequired,created_at:s.string.isRequired})}).isRequired,classes:s.shape({}).isRequired,showSuccessNotification:s.func,width:s.string.isRequired,assetCompanyId:s.number.isRequired},L.defaultProps={showSuccessNotification:function(){}};var W=c.flowRight([o.withStyles((function(e){return{container:{backgroundColor:"#3b3b3be6",marginBottom:16,marginLeft:26},headerDividerRoot:{margin:"10px 0"},createdAt:{color:e.palette.grey[700],marginLeft:5},link:{cursor:"pointer"},iconButtonRoot:{height:24,width:24,padding:0,margin:"0 -10px 0 5px"}}})),E.default()])(L);module.exports=W;
@@ -1 +1 @@
1
- "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),a=require("prop-types"),i=require("react-player"),s=require("@material-ui/core/styles"),r=require("@material-ui/core/Typography"),l=require("@material-ui/core"),n=require("@material-ui/icons/Image"),o=require("@material-ui/icons/SaveAlt"),c=require("@material-ui/icons/Fullscreen"),d=require("@material-ui/core/colors/grey"),u=require("../FileTypeIcon.js"),m=require("../ImageViewer/index.js"),h=require("../GoogleDocsViewer/index.js"),p=require("../IconButton/index.js"),g=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../GradientManager/configuration/constants.js");var q=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js");var x=require("../../utils/main.js"),j=require("./styles.css.js"),v=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=b(e),w=b(a),y=b(i),I=b(r),A=b(n),F=b(o),P=b(c),S=b(d),D=S.default[200],L=S.default[400],W={label:"small",value:135},z={label:"medium",value:300},C={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===W.label?W.value:z.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:D,borderRadius:3,marginTop:10,height:135,width:135}},R=function(e){var t=q(e.attachmentFileName);return v.jsxs(v.Fragment,{children:[v.jsxs("div",{onClick:e.openLightbox,className:j.cAttachmentImg,children:[v.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:t,style:C.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),v.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:j.cAttachmentImgPreviwBtn,children:v.jsx(P.default,{})})]}),!e.imageIsLoaded&&v.jsx("div",{style:C.imagePlaceholder,children:v.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:L,fontSize:"large"})}),e.lightboxIsOpen&&v.jsx(m,{mainSrc:t,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},U=function(e){var t=q(e.attachmentFileName);return v.jsxs("div",{className:j.cAttachmentFileWrapper,children:[v.jsxs("div",{className:j.cAttachmentFileDownloadWrapper,style:C.fileDownloadWrapper,onClick:e.openPreview,children:[v.jsx(u,{fileName:e.displayName||e.attachmentUrl,className:j.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),v.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:j.cAttachmentFileDownloadWrapperFileName,children:v.jsx(I.default,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),v.jsx(l.Dialog,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:g.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},onClick:e.closePreview,children:v.jsx(h,{fileUrl:t,fileName:x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),v.jsx("a",{download:e.displayName,href:t,className:j.cAttachmentFileDownloadWrapperForm,children:v.jsx(p,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:v.jsx(F.default,{className:e.classes.downloadIcon})})})]})};function O(e){var a=t.useState(!1),i=N.default(a,2),s=i[0],r=i[1],l=t.useState(!1),n=N.default(l,2),o=n[0],c=n[1],d=t.useState(!1),u=N.default(d,2),m=u[0],h=u[1],p=e.displayName||e.attachmentUrl||e.fileName,x=f.getIsImage(p),b=f.getIsVideo(p),w=q(!e.attachmentUrl&&e.fileName),I=e.attachmentUrl||w,A=t.useCallback((function(e){return e.preventDefault()}),[]);return x?v.jsx("div",{className:j.cAttachment,children:v.jsx(R,{size:e.size,openLightbox:function(){return c(!0)},attachmentFileName:e.fileName,setImageIsLoaded:function(){return r(!0)},imageIsLoaded:s,lightboxIsOpen:o,handleLightboxOpen:function(){g.isNativeDetected&&document.documentElement.addEventListener("touchmove",A,{passive:!1})},handleLightboxClose:function(){g.isNativeDetected&&document.documentElement.removeEventListener("touchmove",A),c(!1)},classes:e.classes})}):b&&y.default.canPlay(I)?v.jsx("div",{className:j.cAttachment,children:v.jsx(y.default,{"data-testid":"".concat("Attachment","_player"),className:j.cAttachmentReactPlayer,url:I,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===W.label?W.value:z.value,width:null})}):v.jsx("div",{className:j.cAttachment,children:v.jsx(U,{attachmentUrl:I,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return h(!0)},closePreview:function(e){e.stopPropagation(),h(!1)},previewIsOpen:m,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:w.default.string.isRequired,attachmentSize:w.default.number,displayName:w.default.string,fileName:w.default.string,size:w.default.oneOf([W.label,z.label]),classes:w.default.shape({}).isRequired,small:w.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var E=s.withStyles((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}}}))(O);module.exports=E;
1
+ "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),a=require("prop-types"),i=require("react-player"),r=require("@material-ui/core/styles"),s=require("@material-ui/core/Typography"),l=require("@material-ui/core"),n=require("@material-ui/icons/Image"),o=require("@material-ui/icons/SaveAlt"),c=require("@material-ui/icons/Fullscreen"),d=require("@material-ui/core/colors/grey"),u=require("../FileTypeIcon.js"),m=require("../ImageViewer/index.js"),h=require("../GoogleDocsViewer/index.js"),p=require("../IconButton/index.js"),g=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js");require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../GradientManager/configuration/constants.js");var q=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js");var x=require("../../utils/main.js"),j=require("./styles.css.js"),v=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=b(e),w=b(a),y=b(i),I=b(s),A=b(n),F=b(o),P=b(c),S=b(d),D=S.default[200],L=S.default[400],W={label:"small",value:135},z={label:"medium",value:300},C={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===W.label?W.value:z.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:D,borderRadius:3,marginTop:10,height:135,width:135}},U=function(e){var t=q(e.attachmentFileName)||e.attachmentUrl;return v.jsxs(v.Fragment,{children:[v.jsxs("div",{onClick:e.openLightbox,className:j.cAttachmentImg,children:[v.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:t,style:C.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),v.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:j.cAttachmentImgPreviwBtn,children:v.jsx(P.default,{})})]}),!e.imageIsLoaded&&v.jsx("div",{style:C.imagePlaceholder,children:v.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:L,fontSize:"large"})}),e.lightboxIsOpen&&v.jsx(m,{mainSrc:t,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},R=function(e){var t=q(e.attachmentFileName);return v.jsxs("div",{className:j.cAttachmentFileWrapper,children:[v.jsxs("div",{className:j.cAttachmentFileDownloadWrapper,style:C.fileDownloadWrapper,onClick:e.openPreview,children:[v.jsx(u,{fileName:e.displayName||e.attachmentUrl,className:j.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),v.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:j.cAttachmentFileDownloadWrapperFileName,children:v.jsx(I.default,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),v.jsx(l.Dialog,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:g.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},onClick:e.closePreview,children:v.jsx(h,{fileUrl:t,fileName:x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),v.jsx("a",{download:e.displayName,href:t,className:j.cAttachmentFileDownloadWrapperForm,children:v.jsx(p,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:v.jsx(F.default,{className:e.classes.downloadIcon})})})]})};function O(e){var a=t.useState(!1),i=N.default(a,2),r=i[0],s=i[1],l=t.useState(!1),n=N.default(l,2),o=n[0],c=n[1],d=t.useState(!1),u=N.default(d,2),m=u[0],h=u[1],p=e.displayName||e.attachmentUrl||e.fileName,x=f.getIsImage(p),b=f.getIsVideo(p),w=q(!e.attachmentUrl&&e.fileName),I=e.attachmentUrl||w,A=t.useCallback((function(e){return e.preventDefault()}),[]);return x?v.jsx("div",{className:j.cAttachment,children:v.jsx(U,{size:e.size,openLightbox:function(){return c(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return s(!0)},imageIsLoaded:r,lightboxIsOpen:o,handleLightboxOpen:function(){g.isNativeDetected&&document.documentElement.addEventListener("touchmove",A,{passive:!1})},handleLightboxClose:function(){g.isNativeDetected&&document.documentElement.removeEventListener("touchmove",A),c(!1)},classes:e.classes})}):b&&y.default.canPlay(I)?v.jsx("div",{className:j.cAttachment,children:v.jsx(y.default,{"data-testid":"".concat("Attachment","_player"),className:j.cAttachmentReactPlayer,url:I,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===W.label?W.value:z.value,width:null})}):v.jsx("div",{className:j.cAttachment,children:v.jsx(R,{attachmentUrl:I,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return h(!0)},closePreview:function(e){e.stopPropagation(),h(!1)},previewIsOpen:m,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:w.default.string.isRequired,attachmentSize:w.default.number,displayName:w.default.string,fileName:w.default.string,size:w.default.oneOf([W.label,z.label]),classes:w.default.shape({}).isRequired,small:w.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var E=r.withStyles((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}}}))(O);module.exports=E;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n,e=require('./../../../../../ext-esm/tslib/tslib.es6.js'),r=require("react/jsx-runtime"),t=require("react");!function(n){n.CLOSED="CLOSED",n.OPENNING="OPENNING",n.OPENED="OPENED",n.CLOSING="CLOSING"}(n||(n={}));var u=t.createContext(null);exports.DcFullscreenElemsCoordinatorProvider=function(i){var o=i.setIsFullscreenModalMode,s=i.children,c={name:n.CLOSED,currentElementInfo:null},a=t.useRef({}),l=t.useMemo((function(){function r(n){var r=n.transitionFn,t=n.plannedAfterTransitionFinishCb;return e.__awaiter(this,void 0,void 0,(function(){var n;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r()];case 1:return e.sent(),[3,3];case 2:return n=e.sent(),console.error("Transition error: ",n),[3,3];case 3:return t(),[2]}}))}))}function t(e){var r=e.id;a.current[r]={name:n.OPENED,currentElementInfo:e},a.current[r].currentElementInfo.setIsOpened(!0)}function u(e){var u=e.id;a.current[u]={name:n.OPENNING,currentElementInfo:null},r({transitionFn:function(){return o(!0)},plannedAfterTransitionFinishCb:function(){t(e)}})}function i(t){var u=this;a.current[t].name=n.CLOSING,r({transitionFn:function(){return e.__awaiter(u,void 0,void 0,(function(){var r;return e.__generator(this,(function(e){return null===(r=a.current[t].currentElementInfo)||void 0===r||r.setIsOpened(!1),a.current[t].currentElementInfo=null,Object.keys(a.current).some((function(e){var r=a.current[e].name;return r===n.OPENNING||r===n.OPENED}))?[2]:[2,o(!1)]}))}))},plannedAfterTransitionFinishCb:function(){a.current[t].name=n.CLOSED}})}return{requestOpen:function(e){var r,i=e.id;switch((null===(r=a.current)||void 0===r?void 0:r[i])||(a.current[i]=c),a.current[e.id].name){case n.CLOSED:u(e);break;case n.OPENNING:case n.OPENED:t(e);break;case n.CLOSING:u(e)}},requestClose:function(n,e){var r;void 0===e&&(e=!1);var t=n.id;if((null===(r=a.current)||void 0===r?void 0:r[t])||(a.current[t]=c),e)return o(!1);i(t)}}}),[o]);return r.jsx(u.Provider,e.__assign({value:l},{children:s}))},exports.useDcFullscreenElemsCoordinator=function(){return t.useContext(u)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require('./../../../../../ext-esm/tslib/tslib.es6.js'),r=require("react/jsx-runtime"),t=require("react");!function(e){e.CLOSED="CLOSED",e.OPENNING="OPENNING",e.OPENED="OPENED",e.CLOSING="CLOSING"}(e||(e={}));var u=t.createContext(null);exports.DcFullscreenElemsCoordinatorProvider=function(i){var o=i.setIsFullscreenModalMode,c=i.children,s={name:e.CLOSED,currentElementInfo:null},a=t.useRef({}),l=t.useMemo((function(){function r(e){var r=e.transitionFn,t=e.plannedAfterTransitionFinishCb;return n.__awaiter(this,void 0,void 0,(function(){var e;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r()];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),console.error("Transition error: ",e),[3,3];case 3:return t(),[2]}}))}))}function t(n){var r=n.id;a.current[r]={name:e.OPENED,currentElementInfo:n},a.current[r].currentElementInfo.setIsOpened(!0)}function u(n){var u=n.id;a.current[u]={name:e.OPENNING,currentElementInfo:null},r({transitionFn:function(){return o(!0)},plannedAfterTransitionFinishCb:function(){t(n)}})}function i(t){var u=this;a.current[t].name=e.CLOSING,r({transitionFn:function(){return n.__awaiter(u,void 0,void 0,(function(){var r;return n.__generator(this,(function(n){return null===(r=a.current[t].currentElementInfo)||void 0===r||r.setIsOpened(!1),a.current[t].currentElementInfo=null,Object.keys(a.current).some((function(n){var r=a.current[n].name;return r===e.OPENNING||r===e.OPENED}))?[2]:[2,o(!1)]}))}))},plannedAfterTransitionFinishCb:function(){a.current[t].name=e.CLOSED}})}return{requestOpen:function(n){var r,i=n.id;switch((null===(r=a.current)||void 0===r?void 0:r[i])||(a.current[i]=s),a.current[n.id].name){case e.CLOSED:u(n);break;case e.OPENNING:case e.OPENED:t(n);break;case e.CLOSING:u(n)}},requestClose:function(e,n){var r;void 0===n&&(n=!1);var t=e.id;if((null===(r=a.current)||void 0===r?void 0:r[t])||(a.current[t]=s),n)return delete a.current[t],o(!1);i(t)}}}),[o]);return r.jsx(u.Provider,n.__assign({value:l},{children:c}))},exports.useDcFullscreenElemsCoordinator=function(){return t.useContext(u)};
@@ -1 +1 @@
1
- "use strict";var t=require("@material-ui/core").makeStyles((function(t){var o=t.palette;return{searchInput:{"&::before":{borderColor:o.primary.text9},"&:hover .MuiInputAdornment-root svg":{fill:"".concat(o.primary.contrastText," !important")},"&:hover .MuiInput-underline:not(.Mui-disabled):before":{borderBottom:"2px solid ".concat(o.primary.contrastText," !important")},"& .Mui-focused .MuiInputAdornment-positionStart svg.MuiSvgIcon-root":{fill:"".concat(o.primary.main," !important")}},popper:{top:"8px !important"},popupIndicator:{color:o.primary.text6,"&:hover":{backgroundColor:"transparent"}},popupIndicatorOpen:{color:o.primary.main},label:{textAlign:"center",fontStyle:"italic",fontSize:12,fontWeight:400},listbox:{maxHeight:160,position:"relative"},textField:{paddingRight:"0px !important"},searchIcon:{fill:"".concat(o.primary.text6," !important"),width:"24px",height:"24px"},closeIcon:{fill:"".concat(o.primary.text6," !important"),"&:hover":{fill:"".concat(o.primary.contrastText," !important")}},iconButton:{"&:hover":{backgroundColor:"transparent"}},option:{"&.large":{padding:"9px 0"}},group:{padding:"4px 0"},groupChip:{margin:"0 16px 4px",color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),fontSize:14,"&:hover":{backgroundColor:"initial"}},selectedGroup:{padding:"4px 2px",marginRight:8,color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),height:20,fontSize:14,"& .MuiChip-label":{padding:"0px 0px 0px 8px"}},selectedGroupLabel:{display:"flex",alignItems:"center"},removeIcon:{fontSize:"16px",margin:"0 4px",cursor:"pointer"},removeIconWithDropdown:{marginRight:20,zIndex:1},checkbox:{padding:"0 8px 0 0","&:hover":{backgroundColor:"initial !important"}},selectAllCheckbox:{margin:0,padding:"6px 0",width:"100%",borderBottom:"1px solid ".concat(o.primary.text9),"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"20px !important"},"& .Mui-checked":{padding:"0 8px 0 16px"},"& .Mui-checked:hover":{backgroundColor:"initial !important"},"& .Mui-checked:active":{backgroundColor:"initial !important"}},selectedLabel:{padding:"0 4px"},menuItem:{padding:0,"&:hover":{backgroundColor:"initial"}}}}));module.exports=t;
1
+ "use strict";var t=require("@material-ui/core").makeStyles((function(t){var o=t.palette;return{searchInput:{"& .MuiAutocomplete-input":{padding:"5px !important"},"&::before":{borderColor:o.primary.text9},"&:hover .MuiInputAdornment-root svg":{fill:"".concat(o.primary.contrastText," !important")},"&:hover .MuiInput-underline:not(.Mui-disabled):before":{borderBottom:"2px solid ".concat(o.primary.contrastText," !important")},"& .Mui-focused .MuiInputAdornment-positionStart svg.MuiSvgIcon-root":{fill:"".concat(o.primary.main," !important")}},popper:{top:"8px !important"},popupIndicator:{color:o.primary.text6,"&:hover":{backgroundColor:"transparent"}},popupIndicatorOpen:{color:o.primary.main},label:{textAlign:"center",fontStyle:"italic",fontSize:12,fontWeight:400},listbox:{maxHeight:160,position:"relative"},textField:{paddingRight:"0px !important",paddingBottom:"0px !important"},searchIcon:{fill:"".concat(o.primary.text6," !important"),width:"24px",height:"24px"},closeIcon:{fill:"".concat(o.primary.text6," !important"),"&:hover":{fill:"".concat(o.primary.contrastText," !important")}},iconButton:{"&:hover":{backgroundColor:"transparent"}},option:{"&.large":{padding:"9px 0"}},group:{padding:"4px 0"},groupChip:{margin:"0 16px 4px",color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),fontSize:14,"&:hover":{backgroundColor:"initial"}},selectedGroup:{padding:"4px 2px",marginRight:8,color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),height:20,fontSize:14,"& .MuiChip-label":{padding:"0px 0px 0px 8px"}},selectedGroupLabel:{display:"flex",alignItems:"center"},removeIcon:{fontSize:"16px",margin:"0 4px",cursor:"pointer"},removeIconWithDropdown:{marginRight:20,zIndex:1},checkbox:{padding:"0 8px 0 0","&:hover":{backgroundColor:"initial !important"}},selectAllCheckbox:{margin:0,padding:"8px 0",height:54,width:"100%",borderBottom:"1px solid ".concat(o.primary.text9),"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"20px !important"},"& .Mui-checked":{padding:"0 8px 0 16px"},"& .Mui-checked:hover":{backgroundColor:"initial !important"},"& .Mui-checked:active":{backgroundColor:"initial !important"}},selectedLabel:{padding:"0 4px"},menuItem:{padding:0,"&:hover":{backgroundColor:"initial"}}}}));module.exports=t;
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import i from"@babel/runtime/regenerator";import{useState as r}from"react";import a from"classnames";import{shape as o,number as s,string as c,oneOf as m,node as d,func as l,arrayOf as u}from"prop-types";import{withStyles as p}from"@material-ui/core/styles";import{flowRight as h}from"lodash";import f,{isWidthUp as v}from"@material-ui/core/withWidth";import C from"moment";import{Paper as b,Typography as _,Divider as A,IconButton as y,Menu as g,MenuItem as R}from"@material-ui/core";import q from"@material-ui/core/colors/grey";import N from"@material-ui/icons/MoreVert";import x from"../../../../../Avatar/index.js";import M from"../../../../../UserCardPopover.js";import I from"../../../../../ConfirmationDialog.js";import j from"../../../../../CommentsInfo/index.js";import{formatMentionText as T}from"../../../../../UserMention/utils/index.js";import k from"../../../../../Attachment/index.js";import{isNativeDetected as w}from"../../../../../../utils/mobileDetect.js";import{deleteAnnotation as D,patchAnnotation as U}from"../../../../../../clients/jsonApi/index.js";import E from"../AnnotationComments/index.js";import{useAnnotationsDispatch as S}from"../../../../AnnotationsContext.js";import{DELETE_ANNOTATION as O,EDIT_ANNOTATION as z}from"../../../../constants.js";import B from"../AnnotationInput/index.js";import P from"./style.css.js";import{jsxs as L,jsx as W,Fragment as Y}from"react/jsx-runtime";var G="AppAnnotationItemPo",H=function(t){var e=t.user,n=t.currentUser,i=t.classes;return W("div",{className:P.cAnnotationUserAvatar,children:w?W(x,{displayName:"".concat(e.first_name," ").concat(e.last_name),imgSrc:e.profile_photo,size:38,className:i.avatar}):W(M,{user:e,currentUser:n,children:W(x,{displayName:"".concat(e.first_name," ").concat(e.last_name),imgSrc:e.profile_photo,size:38,className:i.avatar})})})},V=function(t){var e=t.actionsMenuAnchorEl,n=t.handleToggleActionsMenu,i=t.classes,r=t.handleEdit,a=t.handleDelete;return L(Y,{children:[W(y,{"data-testid":"".concat(G,"_menuButton"),"aria-label":"Actions","aria-owns":e?P.cAnnotationContainerActionsMenu:void 0,"aria-haspopup":"true",className:i.iconButtonRoot,onClick:n,children:W(N,{htmlColor:q[400]})}),L(g,{id:"cAnnotationContainerActionsMenu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:e,open:!!e,onClick:n,children:[W(R,{"data-testid":"".concat(G,"_editMenuItem"),onClick:r,children:"Edit"}),W(R,{"data-testid":"".concat(G,"_deleteMenuItem"),onClick:a,children:"Delete"})]})]})},F=function(o){var s,c,m=o.included,d=o.annotation,l=o.assetCompanyId,u=o.classes,p=o.showSuccessNotification,h=o.width,f=r(!1),y=n(f,2),g=y[0],R=y[1],q=r(null),N=n(q,2),x=N[0],M=N[1],F=r(!1),J=n(F,2),K=J[0],Q=J[1],X=r(!1),Z=n(X,2),$=Z[0],tt=Z[1],et=!v("sm",h),nt=d.attributes.comments_count||0,it=r(nt),rt=n(it,2),at=rt[0],ot=rt[1],st=S(),ct=d.relationships.comment_users.data.reduce((function(t,e){var n=e.id,i=m.find((function(t){return t.id===n}));return i&&t.push(i.attributes),t}),[]),mt=ct.map((function(t){var e=t.last_name,n=t.first_name;return"".concat(n," ").concat(e)})),dt=(s=e(i.mark((function t(){return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,D(d.id);case 3:t.sent&&st({type:O,id:d.id}),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])}))),function(){return s.apply(this,arguments)}),lt=(c=e(i.mark((function t(e,n,r){var a,o;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a={body:e,active_until:n,attachment:{file_name:r&&r.attachmentName,signed_url:r&&r.attachmentUrl}},t.next=4,U(d.id,a);case 4:o=t.sent,st({type:z,annotation:o,id:d.id}),t.next=12;break;case 8:return t.prev=8,t.t0=t.catch(0),console.error(t.t0),t.abrupt("return");case 12:p("Annotation has been changed"),Q(!1);case 14:case"end":return t.stop()}}),t,null,[[0,8]])}))),function(t,e,n){return c.apply(this,arguments)}),ut=d.relationships.user.data.id,pt=m.find((function(t){var e=t.type,n=t.id;return"user"===e&&n===ut})),ht=pt.attributes,ft=d.attributes.attachment;return L(b,{className:u.container,elevation:0,children:[L("div",{"data-testid":"".concat(G,"_annotation_").concat(d.attributes.body),className:P.cAnnotationContainer,children:[W(H,{user:ht,classes:u,isNative:w,currentUser:pt}),L("div",{className:P.cAnnotationContainerTop,children:[L("div",{className:P.cAnnotationContainerTopMainInfo,children:[W(_,{variant:"body2","data-testid":"".concat(G,"_userName"),children:"".concat(ht.first_name," ").concat(ht.last_name)}),W(_,{"data-testid":"".concat(G,"_addDate"),variant:"caption",className:u.createdAt,children:C(d.attributes.created_at).format("MM/DD/YY H:mm")})]}),W("div",{className:a(P.cAnnotationContainerTopMenu,t({},P.cAnnotationContainerTopMenuSmall,et)),children:W(V,{actionsMenuAnchorEl:x,handleToggleActionsMenu:function(t){var e=t.currentTarget;M(x?null:e)},handleEdit:function(){return Q(!0)},handleDelete:function(){return tt(!0)},classes:u})})]}),W(A,{className:u.headerDividerRoot}),W("div",{"data-testid":"".concat(G,"_message"),className:P.cAnnotationContainerContent,children:K?W(B,{initialText:d.attributes.body,assetCompanyId:l,initialPeriod:d.attributes.created_at,initialAttachment:ft,onSend:lt,onClose:function(){return Q(!1)},closeOnEsc:!0}):L(Y,{children:[T(d.attributes.body,d.relationships.mentioned_users.data,w,null,pt),ft&&ft.signed_url&&W(k,{attachmentUrl:ft.signed_url,size:"small"})]})})]}),L("div",{"data-testid":"".concat(G,"_comments_").concat(d.attributes.body),className:P.cAnnotationComments,children:[L("div",{className:P.cAnnotationCommentsInfo,children:[W(_,{"data-testid":"".concat(G,"_commentButton"),variant:"caption",color:"primary",className:u.link,onClick:function(){return R(!0)},children:"Comment"}),W(j,{commentsCount:at,usersWhoCommented:mt,activeUsersList:ct,currentUser:pt,small:!0})]}),W(E,{annotationId:d.id,commentInputIsOpen:g,setCommentInputIsOpen:R,commentsCount:at,initialCommentsCount:nt,assetCompanyId:l,setCommentsCount:ot,currentUser:pt})]}),$&&W(I,{open:$,text:"Do you really want to delete annotation?",handleClose:function(){return tt(!1)},handleOk:dt,okText:"Delete"})]})};H.propTypes={user:o({id:s.isRequired,first_name:c.isRequired,last_name:c.isRequired,profile_photo:c.isRequired}).isRequired,currentUser:o({}).isRequired,classes:o({}).isRequired},V.propTypes={actionsMenuAnchorEl:m([d,null]).isRequired,handleToggleActionsMenu:l.isRequired,classes:o({}).isRequired,handleDelete:l.isRequired,handleEdit:l.isRequired},F.propTypes={included:u(o({})).isRequired,annotation:o({relationships:o({user:o({data:o({id:c.isRequired}).isRequired}).isRequired,mentioned_users:o({data:u(o({})).isRequired}).isRequired}).isRequired,attributes:o({body:c.isRequired,created_at:c.isRequired})}).isRequired,classes:o({}).isRequired,showSuccessNotification:l,width:c.isRequired,assetCompanyId:s.isRequired},F.defaultProps={showSuccessNotification:function(){}};var J=h([p((function(t){return{container:{backgroundColor:"#3b3b3be6",marginBottom:16,marginLeft:26},headerDividerRoot:{margin:"10px 0"},createdAt:{color:t.palette.grey[700],marginLeft:5},link:{cursor:"pointer"},iconButtonRoot:{height:24,width:24,padding:0,margin:"0 -10px 0 5px"}}})),f()])(F);export{J as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import i from"@babel/runtime/regenerator";import{useState as r}from"react";import a from"classnames";import{shape as o,number as s,string as c,oneOf as m,node as d,func as l,arrayOf as u}from"prop-types";import{withStyles as p}from"@material-ui/core/styles";import{flowRight as h}from"lodash";import f,{isWidthUp as v}from"@material-ui/core/withWidth";import C from"moment";import{Paper as _,Typography as b,Divider as A,IconButton as y,Menu as g,MenuItem as R}from"@material-ui/core";import q from"@material-ui/core/colors/grey";import N from"@material-ui/icons/MoreVert";import x from"../../../../../Avatar/index.js";import M from"../../../../../UserCardPopover.js";import I from"../../../../../ConfirmationDialog.js";import j from"../../../../../CommentsInfo/index.js";import{formatMentionText as T}from"../../../../../UserMention/utils/index.js";import k from"../../../../../Attachment/index.js";import{isNativeDetected as w}from"../../../../../../utils/mobileDetect.js";import{deleteAnnotation as D,patchAnnotation as U}from"../../../../../../clients/jsonApi/index.js";import E from"../AnnotationComments/index.js";import{useAnnotationsDispatch as S}from"../../../../AnnotationsContext.js";import{DELETE_ANNOTATION as O,EDIT_ANNOTATION as z}from"../../../../constants.js";import B from"../AnnotationInput/index.js";import P from"./style.css.js";import{jsxs as L,jsx as W,Fragment as Y}from"react/jsx-runtime";var G="AppAnnotationItemPo",H=function(e){var t=e.user,n=e.currentUser,i=e.classes;return W("div",{className:P.cAnnotationUserAvatar,children:w?W(x,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:i.avatar}):W(M,{user:t,currentUser:n,children:W(x,{displayName:"".concat(t.first_name," ").concat(t.last_name),imgSrc:t.profile_photo,size:38,className:i.avatar})})})},V=function(e){var t=e.actionsMenuAnchorEl,n=e.handleToggleActionsMenu,i=e.classes,r=e.handleEdit,a=e.handleDelete;return L(Y,{children:[W(y,{"data-testid":"".concat(G,"_menuButton"),"aria-label":"Actions","aria-owns":t?P.cAnnotationContainerActionsMenu:void 0,"aria-haspopup":"true",className:i.iconButtonRoot,onClick:n,children:W(N,{htmlColor:q[400]})}),L(g,{id:"cAnnotationContainerActionsMenu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:t,open:!!t,onClick:n,children:[W(R,{"data-testid":"".concat(G,"_editMenuItem"),onClick:r,children:"Edit"}),W(R,{"data-testid":"".concat(G,"_deleteMenuItem"),onClick:a,children:"Delete"})]})]})},F=function(o){var s,c,m=o.included,d=o.annotation,l=o.assetCompanyId,u=o.classes,p=o.showSuccessNotification,h=o.width,f=r(!1),y=n(f,2),g=y[0],R=y[1],q=r(null),N=n(q,2),x=N[0],M=N[1],F=r(!1),J=n(F,2),K=J[0],Q=J[1],X=r(!1),Z=n(X,2),$=Z[0],ee=Z[1],te=!v("sm",h),ne=d.attributes.comments_count||0,ie=r(ne),re=n(ie,2),ae=re[0],oe=re[1],se=S(),ce=d.relationships.comment_users.data.reduce((function(e,t){var n=t.id,i=m.find((function(e){return e.id===n}));return i&&e.push(i.attributes),e}),[]),me=ce.map((function(e){var t=e.last_name,n=e.first_name;return"".concat(n," ").concat(t)})),de=(s=t(i.mark((function e(){return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,D(d.id);case 3:e.sent&&se({type:O,id:d.id}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),function(){return s.apply(this,arguments)}),le=(c=t(i.mark((function e(t,n,r){var a,o;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a={body:t,active_until:n,attachment:{file_name:r&&r.attachmentName,signed_url:r&&r.attachmentUrl}},e.next=4,U(d.id,a);case 4:o=e.sent,se({type:z,annotation:o,id:d.id}),e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return");case 12:p("Annotation has been changed"),Q(!1);case 14:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(e,t,n){return c.apply(this,arguments)}),ue=d.relationships.user.data.id,pe=m.find((function(e){var t=e.type,n=e.id;return"user"===t&&n===ue})),he=pe.attributes,fe=d.attributes.attachment;return L(_,{className:u.container,elevation:0,children:[L("div",{"data-testid":"".concat(G,"_annotation_").concat(d.attributes.body),className:P.cAnnotationContainer,children:[W(H,{user:he,classes:u,isNative:w,currentUser:pe}),L("div",{className:P.cAnnotationContainerTop,children:[L("div",{className:P.cAnnotationContainerTopMainInfo,children:[W(b,{variant:"body2","data-testid":"".concat(G,"_userName"),children:"".concat(he.first_name," ").concat(he.last_name)}),W(b,{"data-testid":"".concat(G,"_addDate"),variant:"caption",className:u.createdAt,children:C(d.attributes.created_at).format("MM/DD/YY H:mm")})]}),W("div",{className:a(P.cAnnotationContainerTopMenu,e({},P.cAnnotationContainerTopMenuSmall,te)),children:W(V,{actionsMenuAnchorEl:x,handleToggleActionsMenu:function(e){var t=e.currentTarget;M(x?null:t)},handleEdit:function(){return Q(!0)},handleDelete:function(){return ee(!0)},classes:u})})]}),W(A,{className:u.headerDividerRoot}),W("div",{"data-testid":"".concat(G,"_message"),className:P.cAnnotationContainerContent,children:K?W(B,{initialText:d.attributes.body,assetCompanyId:l,initialPeriod:d.attributes.created_at,initialAttachment:fe,onSend:le,onClose:function(){return Q(!1)},closeOnEsc:!0}):L(Y,{children:[T(d.attributes.body,d.relationships.mentioned_users.data,w,null,pe),fe&&fe.signed_url&&W(k,{attachmentUrl:fe.signed_url,fileName:fe.file_name,size:"small"})]})})]}),L("div",{"data-testid":"".concat(G,"_comments_").concat(d.attributes.body),className:P.cAnnotationComments,children:[L("div",{className:P.cAnnotationCommentsInfo,children:[W(b,{"data-testid":"".concat(G,"_commentButton"),variant:"caption",color:"primary",className:u.link,onClick:function(){return R(!0)},children:"Comment"}),W(j,{commentsCount:ae,usersWhoCommented:me,activeUsersList:ce,currentUser:pe,small:!0})]}),W(E,{annotationId:d.id,commentInputIsOpen:g,setCommentInputIsOpen:R,commentsCount:ae,initialCommentsCount:ne,assetCompanyId:l,setCommentsCount:oe,currentUser:pe})]}),$&&W(I,{open:$,text:"Do you really want to delete annotation?",handleClose:function(){return ee(!1)},handleOk:de,okText:"Delete"})]})};H.propTypes={user:o({id:s.isRequired,first_name:c.isRequired,last_name:c.isRequired,profile_photo:c.isRequired}).isRequired,currentUser:o({}).isRequired,classes:o({}).isRequired},V.propTypes={actionsMenuAnchorEl:m([d,null]).isRequired,handleToggleActionsMenu:l.isRequired,classes:o({}).isRequired,handleDelete:l.isRequired,handleEdit:l.isRequired},F.propTypes={included:u(o({})).isRequired,annotation:o({relationships:o({user:o({data:o({id:c.isRequired}).isRequired}).isRequired,mentioned_users:o({data:u(o({})).isRequired}).isRequired}).isRequired,attributes:o({body:c.isRequired,created_at:c.isRequired})}).isRequired,classes:o({}).isRequired,showSuccessNotification:l,width:c.isRequired,assetCompanyId:s.isRequired},F.defaultProps={showSuccessNotification:function(){}};var J=h([p((function(e){return{container:{backgroundColor:"#3b3b3be6",marginBottom:16,marginLeft:26},headerDividerRoot:{margin:"10px 0"},createdAt:{color:e.palette.grey[700],marginLeft:5},link:{cursor:"pointer"},iconButtonRoot:{height:24,width:24,padding:0,margin:"0 -10px 0 5px"}}})),f()])(F);export{J 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 s from"@material-ui/core/Typography";import{Dialog as n}from"@material-ui/core";import l 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"../../utils/env.js";import"../GradientManager/configuration/constants.js";import N from"../../effects/useSignedURL.js";import"../../utils/index.js";import"uuid";import"jsona";import"../StatusBadge/constants.js";import"@babel/runtime/helpers/toConsumableArray";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import w from"../../utils/main.js";import y from"./styles.css.js";import{jsx as x,jsxs as j,Fragment as I}from"react/jsx-runtime";var A=d[200],F=d[400],P={label:"small",value:135},L={label:"medium",value:300},W={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===P.label?P.value:L.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){var t=N(e.attachmentFileName);return j(I,{children:[j("div",{onClick:e.openLightbox,className:y.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:t,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(l,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:F,fontSize:"large"})}),e.lightboxIsOpen&&x(h,{mainSrc:t,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},C=function(e){var t=N(e.attachmentFileName);return j("div",{className:y.cAttachmentFileWrapper,children:[j("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(s,{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},onClick:e.closePreview,children:x(u,{fileUrl:t,fileName:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),x("a",{download:e.displayName,href:t,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),s=e(r,2),n=s[0],l=s[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],j=i.displayName||i.attachmentUrl||i.fileName,I=v(j),A=b(j),F=N(!i.attachmentUrl&&i.fileName),W=i.attachmentUrl||F,R=a((function(e){return e.preventDefault()}),[]);return I?x("div",{className:y.cAttachment,children:x(z,{size:i.size,openLightbox:function(){return p(!0)},attachmentFileName:i.fileName,setImageIsLoaded:function(){return l(!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===P.label?P.value:L.value,width:null})}):x("div",{className:y.cAttachment,children:x(C,{attachmentUrl:W,attachmentFileName:i.fileName,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([P.label,L.label]),classes:i.shape({}).isRequired,small:i.bool},R.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:L.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",fontWeight:400},downloadIcon:{color:e.palette.primary.text3}}}))(R);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 n from"@material-ui/core/Typography";import{Dialog as s}from"@material-ui/core";import l 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"../../utils/env.js";import"../GradientManager/configuration/constants.js";import N from"../../effects/useSignedURL.js";import"../../utils/index.js";import"uuid";import"jsona";import"../StatusBadge/constants.js";import"@babel/runtime/helpers/toConsumableArray";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import w from"../../utils/main.js";import y from"./styles.css.js";import{jsx as x,jsxs as j,Fragment as I}from"react/jsx-runtime";var A=d[200],F=d[400],P={label:"small",value:135},L={label:"medium",value:300},W={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===P.label?P.value:L.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){var t=N(e.attachmentFileName)||e.attachmentUrl;return j(I,{children:[j("div",{onClick:e.openLightbox,className:y.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:t,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(l,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:F,fontSize:"large"})}),e.lightboxIsOpen&&x(h,{mainSrc:t,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},C=function(e){var t=N(e.attachmentFileName);return j("div",{className:y.cAttachmentFileWrapper,children:[j("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(n,{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},onClick:e.closePreview,children:x(u,{fileUrl:t,fileName:w.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),x("a",{download:e.displayName,href:t,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 U(i){var r=t(!1),n=e(r,2),s=n[0],l=n[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],j=i.displayName||i.attachmentUrl||i.fileName,I=v(j),A=b(j),F=N(!i.attachmentUrl&&i.fileName),W=i.attachmentUrl||F,U=a((function(e){return e.preventDefault()}),[]);return I?x("div",{className:y.cAttachment,children:x(z,{size:i.size,openLightbox:function(){return p(!0)},attachmentFileName:i.fileName,attachmentUrl:i.attachmentUrl,setImageIsLoaded:function(){return l(!0)},imageIsLoaded:s,lightboxIsOpen:d,handleLightboxOpen:function(){g&&document.documentElement.addEventListener("touchmove",U,{passive:!1})},handleLightboxClose:function(){g&&document.documentElement.removeEventListener("touchmove",U),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===P.label?P.value:L.value,width:null})}):x("div",{className:y.cAttachment,children:x(C,{attachmentUrl:W,attachmentFileName:i.fileName,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})})}U.propTypes={attachmentUrl:i.string.isRequired,attachmentSize:i.number,displayName:i.string,fileName:i.string,size:i.oneOf([P.label,L.label]),classes:i.shape({}).isRequired,small:i.bool},U.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:L.label,small:!1};var R=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}}}))(U);export{R as default};
@@ -1 +1 @@
1
- {"version":3,"file":"DcFullscreenElemsCoordinatorProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,SAAS,EACV,MAAM,OAAO,CAAC;AASf,UAAU,KAAK;IACb,wBAAwB,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACnC;AAED,UAAU,WAAW;IACnB,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,GAAG;IACX,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE;AAgBD;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,oCAAoC,EAAE,EAAE,CAAC,KAAK,CAuH1D,CAAC;AAEF,wBAAgB,+BAA+B,QAE9C"}
1
+ {"version":3,"file":"DcFullscreenElemsCoordinatorProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,EAAE,EACF,cAAc,EACd,QAAQ,EACR,SAAS,EACV,MAAM,OAAO,CAAC;AASf,UAAU,KAAK;IACb,wBAAwB,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACnC;AAED,UAAU,WAAW;IACnB,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,GAAG;IACX,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE;AAgBD;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,oCAAoC,EAAE,EAAE,CAAC,KAAK,CAyH1D,CAAC;AAEF,wBAAgB,+BAA+B,QAE9C"}
@@ -1 +1 @@
1
- import{__assign as n,__awaiter as r,__generator as e}from'./../../../../../ext-esm/tslib/tslib.es6.js';import{jsx as t}from"react/jsx-runtime";import{createContext as i,useRef as u,useMemo as o,useContext as c}from"react";var s;!function(n){n.CLOSED="CLOSED",n.OPENNING="OPENNING",n.OPENED="OPENED",n.CLOSING="CLOSING"}(s||(s={}));var a=i(null),l=function(i){var c=i.setIsFullscreenModalMode,l=i.children,f={name:s.CLOSED,currentElementInfo:null},d=u({}),E=o((function(){function n(n){var t=n.transitionFn,i=n.plannedAfterTransitionFinishCb;return r(this,void 0,void 0,(function(){var n;return e(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t()];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),console.error("Transition error: ",n),[3,3];case 3:return i(),[2]}}))}))}function t(n){var r=n.id;d.current[r]={name:s.OPENED,currentElementInfo:n},d.current[r].currentElementInfo.setIsOpened(!0)}function i(r){var e=r.id;d.current[e]={name:s.OPENNING,currentElementInfo:null},n({transitionFn:function(){return c(!0)},plannedAfterTransitionFinishCb:function(){t(r)}})}function u(t){var i=this;d.current[t].name=s.CLOSING,n({transitionFn:function(){return r(i,void 0,void 0,(function(){var n;return e(this,(function(r){return null===(n=d.current[t].currentElementInfo)||void 0===n||n.setIsOpened(!1),d.current[t].currentElementInfo=null,Object.keys(d.current).some((function(n){var r=d.current[n].name;return r===s.OPENNING||r===s.OPENED}))?[2]:[2,c(!1)]}))}))},plannedAfterTransitionFinishCb:function(){d.current[t].name=s.CLOSED}})}return{requestOpen:function(n){var r,e=n.id;switch((null===(r=d.current)||void 0===r?void 0:r[e])||(d.current[e]=f),d.current[n.id].name){case s.CLOSED:i(n);break;case s.OPENNING:case s.OPENED:t(n);break;case s.CLOSING:i(n)}},requestClose:function(n,r){var e;void 0===r&&(r=!1);var t=n.id;if((null===(e=d.current)||void 0===e?void 0:e[t])||(d.current[t]=f),r)return c(!1);u(t)}}}),[c]);return t(a.Provider,n({value:E},{children:l}))};function f(){return c(a)}export{l as DcFullscreenElemsCoordinatorProvider,f as useDcFullscreenElemsCoordinator};
1
+ import{__assign as n,__awaiter as r,__generator as e}from'./../../../../../ext-esm/tslib/tslib.es6.js';import{jsx as t}from"react/jsx-runtime";import{createContext as i,useRef as u,useMemo as o,useContext as c}from"react";var s;!function(n){n.CLOSED="CLOSED",n.OPENNING="OPENNING",n.OPENED="OPENED",n.CLOSING="CLOSING"}(s||(s={}));var a=i(null),l=function(i){var c=i.setIsFullscreenModalMode,l=i.children,f={name:s.CLOSED,currentElementInfo:null},d=u({}),E=o((function(){function n(n){var t=n.transitionFn,i=n.plannedAfterTransitionFinishCb;return r(this,void 0,void 0,(function(){var n;return e(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t()];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),console.error("Transition error: ",n),[3,3];case 3:return i(),[2]}}))}))}function t(n){var r=n.id;d.current[r]={name:s.OPENED,currentElementInfo:n},d.current[r].currentElementInfo.setIsOpened(!0)}function i(r){var e=r.id;d.current[e]={name:s.OPENNING,currentElementInfo:null},n({transitionFn:function(){return c(!0)},plannedAfterTransitionFinishCb:function(){t(r)}})}function u(t){var i=this;d.current[t].name=s.CLOSING,n({transitionFn:function(){return r(i,void 0,void 0,(function(){var n;return e(this,(function(r){return null===(n=d.current[t].currentElementInfo)||void 0===n||n.setIsOpened(!1),d.current[t].currentElementInfo=null,Object.keys(d.current).some((function(n){var r=d.current[n].name;return r===s.OPENNING||r===s.OPENED}))?[2]:[2,c(!1)]}))}))},plannedAfterTransitionFinishCb:function(){d.current[t].name=s.CLOSED}})}return{requestOpen:function(n){var r,e=n.id;switch((null===(r=d.current)||void 0===r?void 0:r[e])||(d.current[e]=f),d.current[n.id].name){case s.CLOSED:i(n);break;case s.OPENNING:case s.OPENED:t(n);break;case s.CLOSING:i(n)}},requestClose:function(n,r){var e;void 0===r&&(r=!1);var t=n.id;if((null===(e=d.current)||void 0===e?void 0:e[t])||(d.current[t]=f),r)return delete d.current[t],c(!1);u(t)}}}),[c]);return t(a.Provider,n({value:E},{children:l}))};function f(){return c(a)}export{l as DcFullscreenElemsCoordinatorProvider,f as useDcFullscreenElemsCoordinator};
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Search/styles.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,yYA+HZ,CAAC;AAEJ,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Search/styles.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,yYAmIZ,CAAC;AAEJ,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- import{makeStyles as o}from"@material-ui/core";var t=o((function(o){var t=o.palette;return{searchInput:{"&::before":{borderColor:t.primary.text9},"&:hover .MuiInputAdornment-root svg":{fill:"".concat(t.primary.contrastText," !important")},"&:hover .MuiInput-underline:not(.Mui-disabled):before":{borderBottom:"2px solid ".concat(t.primary.contrastText," !important")},"& .Mui-focused .MuiInputAdornment-positionStart svg.MuiSvgIcon-root":{fill:"".concat(t.primary.main," !important")}},popper:{top:"8px !important"},popupIndicator:{color:t.primary.text6,"&:hover":{backgroundColor:"transparent"}},popupIndicatorOpen:{color:t.primary.main},label:{textAlign:"center",fontStyle:"italic",fontSize:12,fontWeight:400},listbox:{maxHeight:160,position:"relative"},textField:{paddingRight:"0px !important"},searchIcon:{fill:"".concat(t.primary.text6," !important"),width:"24px",height:"24px"},closeIcon:{fill:"".concat(t.primary.text6," !important"),"&:hover":{fill:"".concat(t.primary.contrastText," !important")}},iconButton:{"&:hover":{backgroundColor:"transparent"}},option:{"&.large":{padding:"9px 0"}},group:{padding:"4px 0"},groupChip:{margin:"0 16px 4px",color:t.primary.text6,border:"1px solid ".concat(t.primary.text9),fontSize:14,"&:hover":{backgroundColor:"initial"}},selectedGroup:{padding:"4px 2px",marginRight:8,color:t.primary.text6,border:"1px solid ".concat(t.primary.text9),height:20,fontSize:14,"& .MuiChip-label":{padding:"0px 0px 0px 8px"}},selectedGroupLabel:{display:"flex",alignItems:"center"},removeIcon:{fontSize:"16px",margin:"0 4px",cursor:"pointer"},removeIconWithDropdown:{marginRight:20,zIndex:1},checkbox:{padding:"0 8px 0 0","&:hover":{backgroundColor:"initial !important"}},selectAllCheckbox:{margin:0,padding:"6px 0",width:"100%",borderBottom:"1px solid ".concat(t.primary.text9),"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"20px !important"},"& .Mui-checked":{padding:"0 8px 0 16px"},"& .Mui-checked:hover":{backgroundColor:"initial !important"},"& .Mui-checked:active":{backgroundColor:"initial !important"}},selectedLabel:{padding:"0 4px"},menuItem:{padding:0,"&:hover":{backgroundColor:"initial"}}}}));export{t as default};
1
+ import{makeStyles as t}from"@material-ui/core";var o=t((function(t){var o=t.palette;return{searchInput:{"& .MuiAutocomplete-input":{padding:"5px !important"},"&::before":{borderColor:o.primary.text9},"&:hover .MuiInputAdornment-root svg":{fill:"".concat(o.primary.contrastText," !important")},"&:hover .MuiInput-underline:not(.Mui-disabled):before":{borderBottom:"2px solid ".concat(o.primary.contrastText," !important")},"& .Mui-focused .MuiInputAdornment-positionStart svg.MuiSvgIcon-root":{fill:"".concat(o.primary.main," !important")}},popper:{top:"8px !important"},popupIndicator:{color:o.primary.text6,"&:hover":{backgroundColor:"transparent"}},popupIndicatorOpen:{color:o.primary.main},label:{textAlign:"center",fontStyle:"italic",fontSize:12,fontWeight:400},listbox:{maxHeight:160,position:"relative"},textField:{paddingRight:"0px !important",paddingBottom:"0px !important"},searchIcon:{fill:"".concat(o.primary.text6," !important"),width:"24px",height:"24px"},closeIcon:{fill:"".concat(o.primary.text6," !important"),"&:hover":{fill:"".concat(o.primary.contrastText," !important")}},iconButton:{"&:hover":{backgroundColor:"transparent"}},option:{"&.large":{padding:"9px 0"}},group:{padding:"4px 0"},groupChip:{margin:"0 16px 4px",color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),fontSize:14,"&:hover":{backgroundColor:"initial"}},selectedGroup:{padding:"4px 2px",marginRight:8,color:o.primary.text6,border:"1px solid ".concat(o.primary.text9),height:20,fontSize:14,"& .MuiChip-label":{padding:"0px 0px 0px 8px"}},selectedGroupLabel:{display:"flex",alignItems:"center"},removeIcon:{fontSize:"16px",margin:"0 4px",cursor:"pointer"},removeIconWithDropdown:{marginRight:20,zIndex:1},checkbox:{padding:"0 8px 0 0","&:hover":{backgroundColor:"initial !important"}},selectAllCheckbox:{margin:0,padding:"8px 0",height:54,width:"100%",borderBottom:"1px solid ".concat(o.primary.text9),"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"20px !important"},"& .Mui-checked":{padding:"0 8px 0 16px"},"& .Mui-checked:hover":{backgroundColor:"initial !important"},"& .Mui-checked:active":{backgroundColor:"initial !important"}},selectedLabel:{padding:"0 4px"},menuItem:{padding:0,"&:hover":{backgroundColor:"initial"}}}}));export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.65.0-1",
3
+ "version": "0.65.0-2",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"