@corva/ui 3.22.3 → 3.22.5
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.
- package/cjs-bundle/components/Attachment/index.js +1 -1
- package/cjs-bundle/components/Attachment/index.js.map +1 -1
- package/cjs-bundle/components/Avatar/index.js +1 -1
- package/cjs-bundle/components/Comment/index.js +1 -1
- package/cjs-bundle/components/Comment/index.js.map +1 -1
- package/cjs-bundle/components/CommentInput/index.js +1 -1
- package/cjs-bundle/components/CommentInput/index.js.map +1 -1
- package/cjs-bundle/components/CopyToClipboard/CopyToClipboard.js +1 -1
- package/cjs-bundle/components/FeedItem/FeedItem.js +1 -1
- package/cjs-bundle/components/FeedItem/FeedItem.js.map +1 -1
- package/cjs-bundle/components/FeedItem/FeedItemEditProvider/FeedItemEditModal.js +1 -1
- package/cjs-bundle/components/FeedItem/FeedItemEditProvider/FeedItemEditModal.js.map +1 -1
- package/cjs-bundle/components/FeedItem/components/Reactions.js +1 -1
- package/cjs-bundle/components/FeedItem/components/Reactions.js.map +1 -1
- package/cjs-bundle/components/FilePreview/index.js +1 -1
- package/cjs-bundle/components/FilePreview/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellChips/Chip.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
- package/cjs-bundle/components/WellSummary/WellSummaryItemValue.js +1 -1
- package/cjs-bundle/components/WellSummary/WellSummaryItemValue.js.map +1 -1
- package/cjs-bundle/componentsV2/Avatar/Avatar.js +1 -1
- package/cjs-bundle/componentsV2/Avatar/constants.js +1 -1
- package/cjs-bundle/config/highcharts/highcharts.js +1 -1
- package/cjs-bundle/config/highcharts/highcharts.js.map +1 -1
- package/cjs-bundle/utils/index.js +1 -1
- package/cjs-bundle/utils/index.js.map +1 -1
- package/cjs-bundle/utils/lasParser.js +1 -1
- package/cjs-bundle/utils/lasParser.js.map +1 -1
- package/cjs-bundle/utils/main.js +1 -1
- package/cjs-bundle/utils/main.js.map +1 -1
- package/cjs-bundle/utils/mapUnits.js +1 -1
- package/cjs-bundle/utils/mapUnits.js.map +1 -1
- package/cjs-bundle/utils/permissions.js +1 -1
- package/cjs-bundle/utils/permissions.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/components/PinnableFilters/effects/index.js +1 -1
- package/components/PinnableFilters/effects/index.js.map +1 -1
- package/componentsV2/CopyToClipboard/CopyToClipboard.js +1 -1
- package/config/highcharts/highcharts.d.ts.map +1 -1
- package/config/highcharts/highcharts.js +1 -1
- package/config/highcharts/highcharts.js.map +1 -1
- package/package.json +3 -3
- package/utils/lasParser.d.ts +2 -1
- package/utils/lasParser.js +1 -1
- package/utils/lasParser.js.map +1 -1
- package/utils/main.d.ts +53 -112
- package/utils/main.d.ts.map +1 -1
- package/utils/main.js +1 -1
- package/utils/main.js.map +1 -1
- package/utils/mapUnits.d.ts +1 -10
- package/utils/mapUnits.d.ts.map +1 -1
- package/utils/mapUnits.js +1 -1
- package/utils/mapUnits.js.map +1 -1
- package/utils/permissions.d.ts +2 -1
- package/utils/permissions.d.ts.map +1 -1
- package/utils/permissions.js +1 -1
- package/utils/permissions.js.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),a=require("classnames"),n=require("@material-ui/core/styles"),r=require("@material-ui/core"),o=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.v1.js"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.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/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../constants/corvaCompanyId.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../../utils/env.js"),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"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var b=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var x=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(a),A=N(o),P=N(c),D=N(l),S=D.default[200],W=D.default[400],z={label:"small",value:135},R={label:"medium",value:300},U={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===z.label?z.value:R.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:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[b.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:U.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),b.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:b.jsx(P.default,{})})]}),!e.imageIsLoaded&&b.jsx("div",{style:U.imagePlaceholder,children:b.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&b.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName),t=g.getIsPreviewUnavailable(s);return b.jsxs("div",{className:d.cAttachmentFileWrapper,children:[b.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,t&&e.classes.disabledPreview),style:U.fileDownloadWrapper,onClick:function(){t||e.openPreview()},children:[t?b.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):b.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),b.jsxs("div",{className:e.classes.titleContainer,children:[t&&b.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),b.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,t&&e.classes.fileName),children:b.jsx(r.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),b.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),b.jsx("a",{download:e.displayName,href:i,className:d.cAttachmentFileDownloadWrapperForm,children:b.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:b.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),a=t[0],n=t[1],r=s.useState(!1),o=w.default(r,2),c=o[0],l=o[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),x=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||x,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?b.jsx("div",{className:d.cAttachment,children:b.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return n(!0)},imageIsLoaded:a,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?b.jsx("div",{className:d.cAttachment,children:b.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===z.label?z.value:R.value,width:null})}):b.jsx("div",{className:d.cAttachment,children:b.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([z.label,R.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:R.label,small:!1};var E=n.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},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),a=require("classnames"),n=require("@material-ui/core/styles"),r=require("@material-ui/core"),o=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.v1.js"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.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/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../constants/corvaCompanyId.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../../utils/env.js"),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"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var b=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var x=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(a),A=N(o),P=N(c),D=N(l),S=D.default[200],W=D.default[400],z={label:"small",value:135},R={label:"medium",value:300},U={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===z.label?z.value:R.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:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[b.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:U.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),b.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:b.jsx(P.default,{})})]}),!e.imageIsLoaded&&b.jsx("div",{style:U.imagePlaceholder,children:b.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&b.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=x.default.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName),t=g.getIsPreviewUnavailable(s);return b.jsxs("div",{className:d.cAttachmentFileWrapper,children:[b.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,t&&e.classes.disabledPreview),style:U.fileDownloadWrapper,onClick:function(){t||e.openPreview()},children:[t?b.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):b.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),b.jsxs("div",{className:e.classes.titleContainer,children:[t&&b.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),b.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,t&&e.classes.fileName),children:b.jsx(r.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),b.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),b.jsx("a",{download:e.displayName,href:i,className:d.cAttachmentFileDownloadWrapperForm,children:b.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:b.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),a=t[0],n=t[1],r=s.useState(!1),o=w.default(r,2),c=o[0],l=o[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),x=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||x,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?b.jsx("div",{className:d.cAttachment,children:b.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return n(!0)},imageIsLoaded:a,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?b.jsx("div",{className:d.cAttachment,children:b.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===z.label?z.value:R.value,width:null})}):b.jsx("div",{className:d.cAttachment,children:b.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([z.label,R.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:R.label,small:!1};var E=n.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},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6gJA2BMA,EAAUC,EAAAA,QAAK,KACfC,EAAUD,EAAAA,QAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO,MA6DLM,EAAkB,SAAAC,GACtB,IAAMC,EAAeC,EAAaF,EAAMG,qBAAuBH,EAAMI,cACrE,OACEC,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACE,CAAAF,EAAAG,KAAA,MAAA,CAAKC,QAAST,EAAMU,aAAcC,UAAWC,EAAOC,eAAeN,SACjE,CAAAO,EAAAC,IAAA,MAAA,CACE,cAAA,GAAAC,OArGQ,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SAAU,GACVgH,WAAY,KAEf,GAmOcR,CAAsBlD"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6gJA2BMA,EAAUC,EAAAA,QAAK,KACfC,EAAUD,EAAAA,QAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO,MA6DLM,EAAkB,SAAAC,GACtB,IAAMC,EAAeC,EAAaF,EAAMG,qBAAuBH,EAAMI,cACrE,OACEC,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACE,CAAAF,EAAAG,KAAA,MAAA,CAAKC,QAAST,EAAMU,aAAcC,UAA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AAO,QAET8D,QAAS,CACP5B,SAAU,GACVgH,WAAY,IACZlJ,MAAO,eAETmE,oBAAqB,CACnBjC,SAAU,GACVgH,WAAY,KAEf,GAmOcR,CAAsBlD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("classnames"),a=require("@material-ui/core/Avatar"),i=require("../Tooltip/Tooltip.js");require("../Tooltip/ScrollableTooltip.js");var o=require("../../utils/main.js"),s=require("@material-ui/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(r),u=n(a),c=function(e){switch(e){case 24:return 12;case 32:return 14;case 40:return 16;case 48:return 20;case 128:return 64;case 200:return 80;default:return Math.floor(e/2)}},d=function(e){return{minWidth:e,width:e,height:e,lineHeight:"".concat(e,"px"),fontSize:c(e)}},f=["#5F47A4","#9078C8","#DC74FD","#F695B5","#CB4F4F","#896F65","#F3AE96","#EE7850","#DDAE67","#A6CA72","#62893D","#91C9C4","#38818D","#77B5F1","#3F4C99","#919DA4"],h=function(e){return f[Math.abs(o.hashCode(e)%f.length)]},m=s.makeStyles((function(e){return{avatar:{color:e.palette.common.white,fontWeight:"bold"}}})),p=function(r){var a=r.className,s=r.imgSrc,n=r.alt,c=r.displayName,f=void 0===c?"":c,p=r.showTooltip,v=void 0!==p&&p,b=r.size,g=void 0===b?32:b,C=r["data-testid"],F=void 0===C?"generic_avatar":C,j=m();return t.jsx(i.Tooltip,{title:f,disableFocusListener:!v,disableHoverListener:!v,disableTouchListener:!v,children:t.jsx(u.default,{"data-testid":F,alt:n,src:s,className:l.default(j.avatar,a),style:e.__assign(e.__assign({},d(Number(g))),{backgroundColor:!!f&&h(f)}),children:f?o.getNameInitials(f):null})})};exports.AvatarComponent=p,exports.default=p;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("classnames"),a=require("@material-ui/core/Avatar"),i=require("../Tooltip/Tooltip.js");require("../Tooltip/ScrollableTooltip.js");var o=require("../../utils/main.js"),s=require("@material-ui/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(r),u=n(a),c=function(e){switch(e){case 24:return 12;case 32:return 14;case 40:return 16;case 48:return 20;case 128:return 64;case 200:return 80;default:return Math.floor(e/2)}},d=function(e){return{minWidth:e,width:e,height:e,lineHeight:"".concat(e,"px"),fontSize:c(e)}},f=["#5F47A4","#9078C8","#DC74FD","#F695B5","#CB4F4F","#896F65","#F3AE96","#EE7850","#DDAE67","#A6CA72","#62893D","#91C9C4","#38818D","#77B5F1","#3F4C99","#919DA4"],h=function(e){return f[Math.abs(o.default.hashCode(e)%f.length)]},m=s.makeStyles((function(e){return{avatar:{color:e.palette.common.white,fontWeight:"bold"}}})),p=function(r){var a=r.className,s=r.imgSrc,n=r.alt,c=r.displayName,f=void 0===c?"":c,p=r.showTooltip,v=void 0!==p&&p,b=r.size,g=void 0===b?32:b,C=r["data-testid"],F=void 0===C?"generic_avatar":C,j=m();return t.jsx(i.Tooltip,{title:f,disableFocusListener:!v,disableHoverListener:!v,disableTouchListener:!v,children:t.jsx(u.default,{"data-testid":F,alt:n,src:s,className:l.default(j.avatar,a),style:e.__assign(e.__assign({},d(Number(g))),{backgroundColor:!!f&&h(f)}),children:f?o.default.getNameInitials(f):null})})};exports.AvatarComponent=p,exports.default=p;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),a=require("@babel/runtime/helpers/possibleConstructorReturn"),o=require("@babel/runtime/helpers/getPrototypeOf"),s=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),d=require("moment"),m=require("lodash"),p=require("classnames"),h=require("@material-ui/core/styles"),f=require("@material-ui/core/Typography"),v=require("@material-ui/core/Menu"),y=require("@material-ui/core/MenuItem"),g=require("@material-ui/icons/MoreVert"),b=require("../../clients/jsonApi/index.js"),C=require("./styles.css.js"),j=require("../CommentWrapper.js"),x=require("../CommentLoader.js"),M=require("../CommentInput/index.js"),q=require("../Avatar/index.js"),D=require("../Attachment/index.js"),w=require("../IconButton/index.js"),E=require("../ConfirmationDialog.js"),O=require("../UserCardPopover.js"),I=require("../UserMention/utils/index.js"),A=require("../../utils/mobileDetect.js"),k=require("../../utils/main.js"),N=require("react/jsx-runtime");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=_(e),R=_(t),P=_(n),U=_(r),z=_(i),L=_(a),T=_(o),W=_(s),B=_(l),F=_(c),H=_(d),V=_(p),K=_(f),Y=_(v),G=_(y),J=_(g);function Q(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 X(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=T.default(e);if(t){var i=T.default(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return L.default(this,n)}}var Z={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}},$=function(e){z.default(n,e);var t=X(n);function n(e){var r,i;return R.default(this,n),r=t.call(this,e),W.default(U.default(r),"deleteComment",(i=S.default(B.default.mark((function e(t,n){var r;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,b.deleteFeedItemComment(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)})),W.default(U.default(r),"showIntoView",(function(){r.props.handleShowOnMount(),r.commentEl.current.scrollIntoView({block:"end"})})),W.default(U.default(r),"handleOpenActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:e.currentTarget})})),W.default(U.default(r),"handleCloseActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:null})})),W.default(U.default(r),"handleKeyDown",(function(e){27===e.keyCode&&r.setState({isEditing:!1}),document.removeEventListener("keydown",r.handleKeyDown,!1)})),W.default(U.default(r),"handleEditMenuItem",(function(){document.addEventListener("keydown",r.handleKeyDown,!1),r.setState({isEditing:!0},(function(){r.inputEl.current&&r.inputEl.current.focus()}))})),W.default(U.default(r),"getEditCommentProps",(function(){var e=r.props.comment,t=e.id,n=e.body,i=e.attachment;return{editFeedItemId:e.feed_activity_id,editCommentId:t,editComment:n,editAttachment:i}})),W.default(U.default(r),"onEditFinish",(function(){r.setState({isEditing:!1,isLoading:!1})})),W.default(U.default(r),"handleDeleteMenuItem",(function(){r.setState({openDeleteDialog:!0})})),W.default(U.default(r),"handleDelete",S.default(B.default.mark((function e(){var t,n,i;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.props.comment.id,n=r.props.comment.feed_activity_id,r.setState({isLoading:!0}),e.next=5,r.deleteComment(n,t);case 5:i=e.sent,r.setState({isLoading:!1,openDeleteDialog:!1}),i&&r.props.handleDeleteCallback(t);case 8:case"end":return e.stop()}}),e)})))),r.state={actionsMenuAnchorEl:null,isLoading:!1,isEditing:!1,openDeleteDialog:!1},r.inputEl=u.createRef(),r.commentEl=u.createRef(),r}return P.default(n,[{key:"componentDidMount",value:function(){this.props.showOnMount&&this.showIntoView()}},{key:"isCurrentUserCommentCreator",get:function(){return Number(m.get(this.props.comment,["user","id"]))===Number(this.props.currentUser.id)}},{key:"renderMenuIcon",value:function(){var e=this.isCurrentUserCommentCreator,t=this.isCurrentUserCommentCreator||m.includes(this.props.comment.allowed_actions,"destroy");return t||e?N.jsxs("div",{className:C.cCommentMenu,children:[N.jsx(w,{"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.handleOpenActionsMenu,children:N.jsx(J.default,{})}),N.jsxs(Y.default,{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.handleCloseActionsMenu,onClose:this.handleCloseActionsMenu,children:[e&&N.jsx(G.default,{"data-testid":"".concat("comment","_editMenuItem"),onClick:this.handleEditMenuItem,children:"Edit"}),t&&N.jsx(G.default,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:this.handleDeleteMenuItem,children:"Delete"})]})]}):null}},{key:"render",value:function(){var e,t,n=this,r=this.state,i=r.isLoading,a=r.isEditing;if(i){var o=this.props.spaceAround;return N.jsx(x,{spaceAround:o})}var s=this.props,l=s.comment,u=s.classes,c=s.spaceAround,d=s.isNative,p=s.patchCommentCallback,h=s.companyId;if(a)return N.jsx(M,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){W.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({inputRef:this.inputEl,postComment:m.noop,exitEditMode:this.onEditFinish,setIsEditting:function(){return n.setState({isLoading:!0})},patchCommentCallback:p,companyId:h,currentUser:this.props.currentUser},this.getEditCommentProps()));var f=k.getUserFullName(l.user),v=d?"MM/DD HH:mm":"MM/DD/YY HH:mm",y=H.default(l.created_at).format(v),g=(null==l||null===(e=l.attachment)||void 0===e?void 0:e.signed_url)||(null==l||null===(t=l.attachment)||void 0===t?void 0:t.url),b=m.get(l,["attachment","size"]),w=m.get(l,["attachment","file_name"]);return N.jsxs("div",{"data-testid":"".concat("comment","_commentItem_").concat(l.body),className:V.default(C.cComment,W.default({},C.cCommentNative,d)),ref:this.commentEl,children:[N.jsxs(j,{spaceAround:c,className:this.props.classes.commentWrapper,children:[N.jsx("div",{style:Z.chatAvatarWrapper,children:d?N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar}):N.jsx(O,{user:l.user,currentUser:this.props.currentUser,children:N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar})})}),N.jsxs("div",{style:Z.infoContainer,children:[N.jsx("div",{children:N.jsxs("div",{style:Z.commentInfoContainer,children:[N.jsx("div",{style:Z.userNameWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:u.userName,children:f})}),N.jsx("div",{style:Z.timeWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:u.timeRoot},children:y})})]})}),N.jsxs("div",{className:C.cCommentBody,children:[this.renderMenuIcon(),N.jsx(K.default,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:u.textRoot},children:I.formatMentionText(l.body,l.mentioned_users,d,"#00bcd4",this.props.currentUser)}),g&&N.jsx(D,{attachmentUrl:g,attachmentSize:b,size:"small",fileName:w})]})]})]}),this.state.openDeleteDialog&&N.jsx(E,{open:this.state.openDeleteDialog,text:"Do you really want to delete comment?",handleClose:function(){return n.setState({openDeleteDialog:!1})},handleOk:this.handleDelete,okText:"Delete"})]})}}]),n}(u.PureComponent);$.propTypes={comment:F.default.shape({}).isRequired,showOnMount:F.default.bool,spaceAround:F.default.bool,handleShowOnMount:F.default.func,handleEdit:F.default.func,handleDeleteCallback:F.default.func.isRequired,patchCommentCallback:F.default.func.isRequired,companyId:F.default.number,currentUser:F.default.shape(),classes:F.default.shape({}).isRequired,isNative:F.default.bool},$.defaultProps={showOnMount:!1,spaceAround:!1,handleShowOnMount:m.noop,handleEdit:m.noop,companyId:null,isNative:A.isNativeDetected,currentUser:{}};var ee=h.withStyles((function(e){return{commentWrapper:{width:"100%"},timeRoot:{color:e.palette.primary.text7,float:"right",marginRight:5,marginLeft:8,fontSize:"12px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",visibility:"hidden",color:e.palette.primary.text7},userName:{fontSize:"12px",fontWeight:"bold"}}}))($);module.exports=ee;
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),a=require("@babel/runtime/helpers/possibleConstructorReturn"),o=require("@babel/runtime/helpers/getPrototypeOf"),s=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),d=require("moment"),m=require("lodash"),p=require("classnames"),h=require("@material-ui/core/styles"),f=require("@material-ui/core/Typography"),v=require("@material-ui/core/Menu"),y=require("@material-ui/core/MenuItem"),g=require("@material-ui/icons/MoreVert"),b=require("../../clients/jsonApi/index.js"),C=require("./styles.css.js"),j=require("../CommentWrapper.js"),x=require("../CommentLoader.js"),M=require("../CommentInput/index.js"),q=require("../Avatar/index.js"),D=require("../Attachment/index.js"),w=require("../IconButton/index.js"),E=require("../ConfirmationDialog.js"),O=require("../UserCardPopover.js"),I=require("../UserMention/utils/index.js"),A=require("../../utils/mobileDetect.js"),k=require("../../utils/main.js"),N=require("react/jsx-runtime");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=_(e),R=_(t),P=_(n),U=_(r),z=_(i),L=_(a),T=_(o),W=_(s),B=_(l),F=_(c),H=_(d),V=_(p),K=_(f),Y=_(v),G=_(y),J=_(g);function Q(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 X(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=T.default(e);if(t){var i=T.default(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return L.default(this,n)}}var Z={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}},$=function(e){z.default(n,e);var t=X(n);function n(e){var r,i;return R.default(this,n),r=t.call(this,e),W.default(U.default(r),"deleteComment",(i=S.default(B.default.mark((function e(t,n){var r;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,b.deleteFeedItemComment(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)})),W.default(U.default(r),"showIntoView",(function(){r.props.handleShowOnMount(),r.commentEl.current.scrollIntoView({block:"end"})})),W.default(U.default(r),"handleOpenActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:e.currentTarget})})),W.default(U.default(r),"handleCloseActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:null})})),W.default(U.default(r),"handleKeyDown",(function(e){27===e.keyCode&&r.setState({isEditing:!1}),document.removeEventListener("keydown",r.handleKeyDown,!1)})),W.default(U.default(r),"handleEditMenuItem",(function(){document.addEventListener("keydown",r.handleKeyDown,!1),r.setState({isEditing:!0},(function(){r.inputEl.current&&r.inputEl.current.focus()}))})),W.default(U.default(r),"getEditCommentProps",(function(){var e=r.props.comment,t=e.id,n=e.body,i=e.attachment;return{editFeedItemId:e.feed_activity_id,editCommentId:t,editComment:n,editAttachment:i}})),W.default(U.default(r),"onEditFinish",(function(){r.setState({isEditing:!1,isLoading:!1})})),W.default(U.default(r),"handleDeleteMenuItem",(function(){r.setState({openDeleteDialog:!0})})),W.default(U.default(r),"handleDelete",S.default(B.default.mark((function e(){var t,n,i;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.props.comment.id,n=r.props.comment.feed_activity_id,r.setState({isLoading:!0}),e.next=5,r.deleteComment(n,t);case 5:i=e.sent,r.setState({isLoading:!1,openDeleteDialog:!1}),i&&r.props.handleDeleteCallback(t);case 8:case"end":return e.stop()}}),e)})))),r.state={actionsMenuAnchorEl:null,isLoading:!1,isEditing:!1,openDeleteDialog:!1},r.inputEl=u.createRef(),r.commentEl=u.createRef(),r}return P.default(n,[{key:"componentDidMount",value:function(){this.props.showOnMount&&this.showIntoView()}},{key:"isCurrentUserCommentCreator",get:function(){return Number(m.get(this.props.comment,["user","id"]))===Number(this.props.currentUser.id)}},{key:"renderMenuIcon",value:function(){var e=this.isCurrentUserCommentCreator,t=this.isCurrentUserCommentCreator||m.includes(this.props.comment.allowed_actions,"destroy");return t||e?N.jsxs("div",{className:C.cCommentMenu,children:[N.jsx(w,{"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.handleOpenActionsMenu,children:N.jsx(J.default,{})}),N.jsxs(Y.default,{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.handleCloseActionsMenu,onClose:this.handleCloseActionsMenu,children:[e&&N.jsx(G.default,{"data-testid":"".concat("comment","_editMenuItem"),onClick:this.handleEditMenuItem,children:"Edit"}),t&&N.jsx(G.default,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:this.handleDeleteMenuItem,children:"Delete"})]})]}):null}},{key:"render",value:function(){var e,t,n=this,r=this.state,i=r.isLoading,a=r.isEditing;if(i){var o=this.props.spaceAround;return N.jsx(x,{spaceAround:o})}var s=this.props,l=s.comment,u=s.classes,c=s.spaceAround,d=s.isNative,p=s.patchCommentCallback,h=s.companyId;if(a)return N.jsx(M,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){W.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({inputRef:this.inputEl,postComment:m.noop,exitEditMode:this.onEditFinish,setIsEditting:function(){return n.setState({isLoading:!0})},patchCommentCallback:p,companyId:h,currentUser:this.props.currentUser},this.getEditCommentProps()));var f=k.default.getUserFullName(l.user),v=d?"MM/DD HH:mm":"MM/DD/YY HH:mm",y=H.default(l.created_at).format(v),g=(null==l||null===(e=l.attachment)||void 0===e?void 0:e.signed_url)||(null==l||null===(t=l.attachment)||void 0===t?void 0:t.url),b=m.get(l,["attachment","size"]),w=m.get(l,["attachment","file_name"]);return N.jsxs("div",{"data-testid":"".concat("comment","_commentItem_").concat(l.body),className:V.default(C.cComment,W.default({},C.cCommentNative,d)),ref:this.commentEl,children:[N.jsxs(j,{spaceAround:c,className:this.props.classes.commentWrapper,children:[N.jsx("div",{style:Z.chatAvatarWrapper,children:d?N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar}):N.jsx(O,{user:l.user,currentUser:this.props.currentUser,children:N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar})})}),N.jsxs("div",{style:Z.infoContainer,children:[N.jsx("div",{children:N.jsxs("div",{style:Z.commentInfoContainer,children:[N.jsx("div",{style:Z.userNameWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:u.userName,children:f})}),N.jsx("div",{style:Z.timeWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:u.timeRoot},children:y})})]})}),N.jsxs("div",{className:C.cCommentBody,children:[this.renderMenuIcon(),N.jsx(K.default,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:u.textRoot},children:I.formatMentionText(l.body,l.mentioned_users,d,"#00bcd4",this.props.currentUser)}),g&&N.jsx(D,{attachmentUrl:g,attachmentSize:b,size:"small",fileName:w})]})]})]}),this.state.openDeleteDialog&&N.jsx(E,{open:this.state.openDeleteDialog,text:"Do you really want to delete comment?",handleClose:function(){return n.setState({openDeleteDialog:!1})},handleOk:this.handleDelete,okText:"Delete"})]})}}]),n}(u.PureComponent);$.propTypes={comment:F.default.shape({}).isRequired,showOnMount:F.default.bool,spaceAround:F.default.bool,handleShowOnMount:F.default.func,handleEdit:F.default.func,handleDeleteCallback:F.default.func.isRequired,patchCommentCallback:F.default.func.isRequired,companyId:F.default.number,currentUser:F.default.shape(),classes:F.default.shape({}).isRequired,isNative:F.default.bool},$.defaultProps={showOnMount:!1,spaceAround:!1,handleShowOnMount:m.noop,handleEdit:m.noop,companyId:null,isNative:A.isNativeDetected,currentUser:{}};var ee=h.withStyles((function(e){return{commentWrapper:{width:"100%"},timeRoot:{color:e.palette.primary.text7,float:"right",marginRight:5,marginLeft:8,fontSize:"12px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",visibility:"hidden",color:e.palette.primary.text7},userName:{fontSize:"12px",fontWeight:"bold"}}}))($);module.exports=ee;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Comment/index.js"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { get, noop, includes } from 'lodash';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\n\nimport { deleteFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport CommentWrapper from '~components/CommentWrapper';\nimport CommentLoader from '~components/CommentLoader';\nimport CommentInput from '~components/CommentInput';\nimport Avatar from '~components/Avatar';\nimport Attachment from '~components/Attachment';\nimport IconButton from '~components/IconButton';\nimport ConfirmationDialog from '~components/ConfirmationDialog';\nimport UserCardPopover from '~components/UserCardPopover';\nimport { formatMentionText } from '~components/UserMention/utils';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport utils from '~utils/main';\n\nconst PAGE_NAME = 'comment';\n\nconst CREATED_AT_FORMAT = 'MM/DD/YY HH:mm';\nconst CREATED_AT_FORMAT_NATIVE = 'MM/DD HH:mm';\n\nconst style = {\n chatAvatarWrapper: {\n paddingTop: 2,\n position: 'absolute',\n top: 6,\n left: 0,\n },\n commentInfoContainer: {\n display: 'inline-flex',\n alignItems: 'center',\n width: '100%',\n paddingTop: 5,\n },\n userNameWrapper: { overflow: 'hidden' },\n infoContainer: {\n display: 'inline-block',\n verticalAlign: 'top',\n width: '100%',\n paddingLeft: 33,\n },\n};\n\nconst muiStyles = theme => ({\n commentWrapper: { width: '100%' },\n timeRoot: {\n color: theme.palette.primary.text7,\n float: 'right',\n marginRight: 5,\n marginLeft: 8,\n fontSize: '12px',\n },\n textRoot: {\n marginTop: 5,\n color: '#CCC',\n fontWeight: 'normal',\n fontSize: '14px',\n },\n iconButtonRoot: {\n float: 'right',\n visibility: 'hidden',\n color: theme.palette.primary.text7,\n },\n userName: {\n fontSize: '12px',\n fontWeight: 'bold',\n },\n});\n\nclass Comment extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n actionsMenuAnchorEl: null,\n isLoading: false,\n isEditing: false,\n openDeleteDialog: false,\n };\n this.inputEl = createRef();\n this.commentEl = createRef();\n }\n\n componentDidMount() {\n if (this.props.showOnMount) {\n this.showIntoView();\n }\n }\n\n get isCurrentUserCommentCreator() {\n return Number(get(this.props.comment, ['user', 'id'])) === Number(this.props.currentUser.id);\n }\n\n deleteComment = async (feedItemId, commentId) => {\n let commentResponse;\n\n try {\n commentResponse = await deleteFeedItemComment(feedItemId, commentId);\n } catch (e) {\n console.error(e);\n }\n\n return commentResponse;\n };\n\n showIntoView = () => {\n this.props.handleShowOnMount();\n this.commentEl.current.scrollIntoView({ block: 'end' });\n };\n\n handleOpenActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: event.currentTarget });\n };\n\n handleCloseActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: null });\n };\n\n handleKeyDown = event => {\n if (event.keyCode === 27) {\n this.setState({\n isEditing: false,\n });\n }\n document.removeEventListener('keydown', this.handleKeyDown, false);\n };\n\n handleEditMenuItem = () => {\n document.addEventListener('keydown', this.handleKeyDown, false);\n this.setState(\n {\n isEditing: true,\n },\n () => {\n if (this.inputEl.current) this.inputEl.current.focus();\n }\n );\n };\n\n // TODO: move to one prop, not multiple\n getEditCommentProps = () => {\n const { comment } = this.props;\n const editCommentId = comment.id;\n const editComment = comment.body;\n const editAttachment = comment.attachment;\n const editFeedItemId = comment.feed_activity_id;\n return {\n editFeedItemId,\n editCommentId,\n editComment,\n editAttachment,\n };\n };\n\n onEditFinish = () => {\n this.setState({ isEditing: false, isLoading: false });\n };\n\n handleDeleteMenuItem = () => {\n this.setState({ openDeleteDialog: true });\n };\n\n handleDelete = async () => {\n const { id } = this.props.comment;\n const feedItemId = this.props.comment.feed_activity_id;\n\n this.setState({ isLoading: true });\n\n const response = await this.deleteComment(feedItemId, id);\n\n this.setState({ isLoading: false, openDeleteDialog: false });\n if (response) this.props.handleDeleteCallback(id);\n };\n\n renderMenuIcon() {\n const showEdit = this.isCurrentUserCommentCreator;\n\n const showDelete =\n this.isCurrentUserCommentCreator || includes(this.props.comment.allowed_actions, 'destroy');\n\n if (!(showDelete || showEdit)) return null;\n\n return (\n <div className={styles.cCommentMenu}>\n <IconButton\n data-testid={`${PAGE_NAME}_menuButton`}\n aria-label=\"Actions\"\n aria-owns={this.state.actionsMenuAnchorEl ? 'c-comment__actions-menu' : undefined}\n aria-haspopup=\"true\"\n className={this.props.classes.iconButtonRoot}\n size=\"small\"\n onClick={this.handleOpenActionsMenu}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu\n id=\"c-comment__actions-menu\"\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n anchorEl={this.state.actionsMenuAnchorEl}\n open={!!this.state.actionsMenuAnchorEl}\n onClick={this.handleCloseActionsMenu}\n onClose={this.handleCloseActionsMenu}\n >\n {showEdit && (\n <MenuItem data-testid={`${PAGE_NAME}_editMenuItem`} onClick={this.handleEditMenuItem}>\n Edit\n </MenuItem>\n )}\n\n {showDelete && (\n <MenuItem\n data-testid={`${PAGE_NAME}_deleteMenuItem`}\n onClick={this.handleDeleteMenuItem}\n >\n Delete\n </MenuItem>\n )}\n </Menu>\n </div>\n );\n }\n\n render() {\n const { isLoading, isEditing } = this.state;\n\n if (isLoading) {\n const { spaceAround } = this.props;\n return <CommentLoader spaceAround={spaceAround} />;\n }\n\n const { comment, classes, spaceAround, isNative, patchCommentCallback, companyId } = this.props;\n\n if (isEditing) {\n return (\n <CommentInput\n inputRef={this.inputEl}\n postComment={noop}\n exitEditMode={this.onEditFinish}\n setIsEditting={() => this.setState({ isLoading: true })}\n patchCommentCallback={patchCommentCallback}\n companyId={companyId}\n currentUser={this.props.currentUser}\n {...this.getEditCommentProps()}\n />\n );\n }\n\n const userFullName = utils.getUserFullName(comment.user);\n\n const format = isNative ? CREATED_AT_FORMAT_NATIVE : CREATED_AT_FORMAT;\n const time = moment(comment.created_at).format(format);\n\n const attachmentUrl = comment?.attachment?.signed_url || comment?.attachment?.url;\n const attachmentSize = get(comment, ['attachment', 'size']);\n const attachmentFileName = get(comment, ['attachment', 'file_name']);\n\n return (\n <div\n data-testid={`${PAGE_NAME}_commentItem_${comment.body}`}\n className={classNames(styles.cComment, { [styles.cCommentNative]: isNative })}\n ref={this.commentEl}\n >\n <CommentWrapper spaceAround={spaceAround} className={this.props.classes.commentWrapper}>\n <div style={style.chatAvatarWrapper}>\n {isNative ? (\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n ) : (\n <UserCardPopover user={comment.user} currentUser={this.props.currentUser}>\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n </UserCardPopover>\n )}\n </div>\n\n <div style={style.infoContainer}>\n <div>\n <div style={style.commentInfoContainer}>\n <div style={style.userNameWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_userName`}\n variant=\"subtitle2\"\n noWrap\n className={classes.userName}\n >\n {userFullName}\n </Typography>\n </div>\n\n <div style={style.timeWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_addTime`}\n variant=\"caption\"\n classes={{ root: classes.timeRoot }}\n >\n {time}\n </Typography>\n </div>\n </div>\n </div>\n\n <div className={styles.cCommentBody}>\n {this.renderMenuIcon()}\n <Typography\n data-testid={`${PAGE_NAME}_commentMessage`}\n variant=\"body1\"\n classes={{ root: classes.textRoot }}\n >\n {formatMentionText(\n comment.body,\n comment.mentioned_users,\n isNative,\n '#00bcd4',\n this.props.currentUser\n )}\n </Typography>\n\n {attachmentUrl && (\n <Attachment\n attachmentUrl={attachmentUrl}\n attachmentSize={attachmentSize}\n size=\"small\"\n fileName={attachmentFileName}\n />\n )}\n </div>\n </div>\n </CommentWrapper>\n\n {this.state.openDeleteDialog && (\n <ConfirmationDialog\n open={this.state.openDeleteDialog}\n text=\"Do you really want to delete comment?\"\n handleClose={() => this.setState({ openDeleteDialog: false })}\n handleOk={this.handleDelete}\n okText=\"Delete\"\n />\n )}\n </div>\n );\n }\n}\n\nComment.propTypes = {\n comment: PropTypes.shape({}).isRequired,\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n handleShowOnMount: PropTypes.func,\n handleEdit: PropTypes.func,\n handleDeleteCallback: PropTypes.func.isRequired,\n patchCommentCallback: PropTypes.func.isRequired,\n companyId: PropTypes.number,\n currentUser: PropTypes.shape(),\n\n classes: PropTypes.shape({}).isRequired,\n isNative: PropTypes.bool,\n};\n\nComment.defaultProps = {\n showOnMount: false,\n spaceAround: false,\n handleShowOnMount: noop,\n handleEdit: noop,\n companyId: null,\n\n isNative: isNativeDetected,\n\n currentUser: {},\n};\n\nexport default withStyles(muiStyles)(Comment);\n"],"names":["style","chatAvatarWrapper","paddingTop","position","top","left","commentInfoContainer","display","alignItems","width","userNameWrapper","overflow","infoContainer","verticalAlign","paddingLeft","Comment","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","feedItemId","commentId","commentResponse","wrap","_context","prev","next","deleteFeedItemComment","sent","t0","console","error","abrupt","stop","_x","_x2","apply","arguments","handleShowOnMount","commentEl","current","scrollIntoView","block","event","stopPropagation","setState","actionsMenuAnchorEl","currentTarget","keyCode","isEditing","document","removeEventListener","handleKeyDown","addEventListener","inputEl","focus","comment","editCommentId","id","editComment","body","editAttachment","attachment","editFeedItemId","feed_activity_id","isLoading","openDeleteDialog","_callee2","response","_context2","deleteComment","handleDeleteCallback","state","createRef","_createClass","key","value","showOnMount","showIntoView","get","Number","currentUser","showEdit","isCurrentUserCommentCreator","showDelete","includes","allowed_actions","_jsxs","className","styles","cCommentMenu","children","_jsx","IconButton","concat","undefined","classes","iconButtonRoot","size","onClick","handleOpenActionsMenu","MoreVertIcon","Menu","anchorOrigin","vertical","horizontal","transformOrigin","anchorEl","open","handleCloseActionsMenu","onClose","jsx","MenuItem","handleEditMenuItem","handleDeleteMenuItem","_comment$attachment","_comment$attachment2","_this2","_this$state","spaceAround","CommentLoader","_this$props","isNative","patchCommentCallback","companyId","CommentInput","_objectSpread","inputRef","postComment","noop","exitEditMode","onEditFinish","setIsEditting","getEditCommentProps","userFullName","utils","getUserFullName","user","format","time","moment","created_at","attachmentUrl","signed_url","url","attachmentSize","attachmentFileName","classNames","cComment","cCommentNative","ref","CommentWrapper","commentWrapper","Avatar","displayName","imgSrc","avatar","UserCardPopover","jsxs","Typography","variant","noWrap","userName","timeWrapper","root","timeRoot","cCommentBody","renderMenuIcon","textRoot","formatMentionText","mentioned_users","Attachment","fileName","ConfirmationDialog","text","handleClose","handleOk","handleDelete","okText","PureComponent","propTypes","PropTypes","shape","isRequired","bool","func","handleEdit","number","defaultProps","isNativeDetected","Comment$1","withStyles","theme","color","palette","primary","text7","float","marginRight","marginLeft","fontSize","marginTop","fontWeight","visibility"],"mappings":"4lEA4BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,WAAY,EACZC,SAAU,WACVC,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EAAAA,QAAUI,KAAKF,WACrC3D,UAAWyD,EAAS,QAACM,OACrB1G,YAAaoG,EAAS,QAACC,QAEvBtF,QAASqF,EAAS,QAACC,MAAM,CAAA,GAAIC,WAC7B7D,SAAU2D,EAAS,QAACG,MAGtBrL,EAAQyL,aAAe,CACrB/G,aAAa,EACb0C,aAAa,EACbjF,kBAAmB2F,EAAIA,KACvByD,WAAYzD,EAAIA,KAChBL,UAAW,KAEXF,SAAUmE,EAAgBA,iBAE1B5G,YAAa,CAAC,GAGhB,IAAA6G,GAAeC,cAnVG,SAAAC,GAAK,MAAK,CAC1BxC,eAAgB,CAAE3J,MAAO,QACzBwK,SAAU,CACR4B,MAAOD,EAAME,QAAQC,QAAQC,MAC7BC,MAAO,QACPC,YAAa,EACbC,WAAY,EACZC,SAAU,QAEZhC,SAAU,CACRiC,UAAW,EACXR,MAAO,OACPS,WAAY,SACZF,SAAU,QAEZvG,eAAgB,CACdoG,MAAO,QACPM,WAAY,SACZV,MAAOD,EAAME,QAAQC,QAAQC,OAE/BlC,SAAU,CACRsC,SAAU,OACVE,WAAY,QAEf,GA2TcX,CAAsB5L"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Comment/index.js"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { get, noop, includes } from 'lodash';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\n\nimport { deleteFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport CommentWrapper from '~components/CommentWrapper';\nimport CommentLoader from '~components/CommentLoader';\nimport CommentInput from '~components/CommentInput';\nimport Avatar from '~components/Avatar';\nimport Attachment from '~components/Attachment';\nimport IconButton from '~components/IconButton';\nimport ConfirmationDialog from '~components/ConfirmationDialog';\nimport UserCardPopover from '~components/UserCardPopover';\nimport { formatMentionText } from '~components/UserMention/utils';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport utils from '~utils/main';\n\nconst PAGE_NAME = 'comment';\n\nconst CREATED_AT_FORMAT = 'MM/DD/YY HH:mm';\nconst CREATED_AT_FORMAT_NATIVE = 'MM/DD HH:mm';\n\nconst style = {\n chatAvatarWrapper: {\n paddingTop: 2,\n position: 'absolute',\n top: 6,\n left: 0,\n },\n commentInfoContainer: {\n display: 'inline-flex',\n alignItems: 'center',\n width: '100%',\n paddingTop: 5,\n },\n userNameWrapper: { overflow: 'hidden' },\n infoContainer: {\n display: 'inline-block',\n verticalAlign: 'top',\n width: '100%',\n paddingLeft: 33,\n },\n};\n\nconst muiStyles = theme => ({\n commentWrapper: { width: '100%' },\n timeRoot: {\n color: theme.palette.primary.text7,\n float: 'right',\n marginRight: 5,\n marginLeft: 8,\n fontSize: '12px',\n },\n textRoot: {\n marginTop: 5,\n color: '#CCC',\n fontWeight: 'normal',\n fontSize: '14px',\n },\n iconButtonRoot: {\n float: 'right',\n visibility: 'hidden',\n color: theme.palette.primary.text7,\n },\n userName: {\n fontSize: '12px',\n fontWeight: 'bold',\n },\n});\n\nclass Comment extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n actionsMenuAnchorEl: null,\n isLoading: false,\n isEditing: false,\n openDeleteDialog: false,\n };\n this.inputEl = createRef();\n this.commentEl = createRef();\n }\n\n componentDidMount() {\n if (this.props.showOnMount) {\n this.showIntoView();\n }\n }\n\n get isCurrentUserCommentCreator() {\n return Number(get(this.props.comment, ['user', 'id'])) === Number(this.props.currentUser.id);\n }\n\n deleteComment = async (feedItemId, commentId) => {\n let commentResponse;\n\n try {\n commentResponse = await deleteFeedItemComment(feedItemId, commentId);\n } catch (e) {\n console.error(e);\n }\n\n return commentResponse;\n };\n\n showIntoView = () => {\n this.props.handleShowOnMount();\n this.commentEl.current.scrollIntoView({ block: 'end' });\n };\n\n handleOpenActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: event.currentTarget });\n };\n\n handleCloseActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: null });\n };\n\n handleKeyDown = event => {\n if (event.keyCode === 27) {\n this.setState({\n isEditing: false,\n });\n }\n document.removeEventListener('keydown', this.handleKeyDown, false);\n };\n\n handleEditMenuItem = () => {\n document.addEventListener('keydown', this.handleKeyDown, false);\n this.setState(\n {\n isEditing: true,\n },\n () => {\n if (this.inputEl.current) this.inputEl.current.focus();\n }\n );\n };\n\n // TODO: move to one prop, not multiple\n getEditCommentProps = () => {\n const { comment } = this.props;\n const editCommentId = comment.id;\n const editComment = comment.body;\n const editAttachment = comment.attachment;\n const editFeedItemId = comment.feed_activity_id;\n return {\n editFeedItemId,\n editCommentId,\n editComment,\n editAttachment,\n };\n };\n\n onEditFinish = () => {\n this.setState({ isEditing: false, isLoading: false });\n };\n\n handleDeleteMenuItem = () => {\n this.setState({ openDeleteDialog: true });\n };\n\n handleDelete = async () => {\n const { id } = this.props.comment;\n const feedItemId = this.props.comment.feed_activity_id;\n\n this.setState({ isLoading: true });\n\n const response = await this.deleteComment(feedItemId, id);\n\n this.setState({ isLoading: false, openDeleteDialog: false });\n if (response) this.props.handleDeleteCallback(id);\n };\n\n renderMenuIcon() {\n const showEdit = this.isCurrentUserCommentCreator;\n\n const showDelete =\n this.isCurrentUserCommentCreator || includes(this.props.comment.allowed_actions, 'destroy');\n\n if (!(showDelete || showEdit)) return null;\n\n return (\n <div className={styles.cCommentMenu}>\n <IconButton\n data-testid={`${PAGE_NAME}_menuButton`}\n aria-label=\"Actions\"\n aria-owns={this.state.actionsMenuAnchorEl ? 'c-comment__actions-menu' : undefined}\n aria-haspopup=\"true\"\n className={this.props.classes.iconButtonRoot}\n size=\"small\"\n onClick={this.handleOpenActionsMenu}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu\n id=\"c-comment__actions-menu\"\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n anchorEl={this.state.actionsMenuAnchorEl}\n open={!!this.state.actionsMenuAnchorEl}\n onClick={this.handleCloseActionsMenu}\n onClose={this.handleCloseActionsMenu}\n >\n {showEdit && (\n <MenuItem data-testid={`${PAGE_NAME}_editMenuItem`} onClick={this.handleEditMenuItem}>\n Edit\n </MenuItem>\n )}\n\n {showDelete && (\n <MenuItem\n data-testid={`${PAGE_NAME}_deleteMenuItem`}\n onClick={this.handleDeleteMenuItem}\n >\n Delete\n </MenuItem>\n )}\n </Menu>\n </div>\n );\n }\n\n render() {\n const { isLoading, isEditing } = this.state;\n\n if (isLoading) {\n const { spaceAround } = this.props;\n return <CommentLoader spaceAround={spaceAround} />;\n }\n\n const { comment, classes, spaceAround, isNative, patchCommentCallback, companyId } = this.props;\n\n if (isEditing) {\n return (\n <CommentInput\n inputRef={this.inputEl}\n postComment={noop}\n exitEditMode={this.onEditFinish}\n setIsEditting={() => this.setState({ isLoading: true })}\n patchCommentCallback={patchCommentCallback}\n companyId={companyId}\n currentUser={this.props.currentUser}\n {...this.getEditCommentProps()}\n />\n );\n }\n\n const userFullName = utils.getUserFullName(comment.user);\n\n const format = isNative ? CREATED_AT_FORMAT_NATIVE : CREATED_AT_FORMAT;\n const time = moment(comment.created_at).format(format);\n\n const attachmentUrl = comment?.attachment?.signed_url || comment?.attachment?.url;\n const attachmentSize = get(comment, ['attachment', 'size']);\n const attachmentFileName = get(comment, ['attachment', 'file_name']);\n\n return (\n <div\n data-testid={`${PAGE_NAME}_commentItem_${comment.body}`}\n className={classNames(styles.cComment, { [styles.cCommentNative]: isNative })}\n ref={this.commentEl}\n >\n <CommentWrapper spaceAround={spaceAround} className={this.props.classes.commentWrapper}>\n <div style={style.chatAvatarWrapper}>\n {isNative ? (\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n ) : (\n <UserCardPopover user={comment.user} currentUser={this.props.currentUser}>\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n </UserCardPopover>\n )}\n </div>\n\n <div style={style.infoContainer}>\n <div>\n <div style={style.commentInfoContainer}>\n <div style={style.userNameWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_userName`}\n variant=\"subtitle2\"\n noWrap\n className={classes.userName}\n >\n {userFullName}\n </Typography>\n </div>\n\n <div style={style.timeWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_addTime`}\n variant=\"caption\"\n classes={{ root: classes.timeRoot }}\n >\n {time}\n </Typography>\n </div>\n </div>\n </div>\n\n <div className={styles.cCommentBody}>\n {this.renderMenuIcon()}\n <Typography\n data-testid={`${PAGE_NAME}_commentMessage`}\n variant=\"body1\"\n classes={{ root: classes.textRoot }}\n >\n {formatMentionText(\n comment.body,\n comment.mentioned_users,\n isNative,\n '#00bcd4',\n this.props.currentUser\n )}\n </Typography>\n\n {attachmentUrl && (\n <Attachment\n attachmentUrl={attachmentUrl}\n attachmentSize={attachmentSize}\n size=\"small\"\n fileName={attachmentFileName}\n />\n )}\n </div>\n </div>\n </CommentWrapper>\n\n {this.state.openDeleteDialog && (\n <ConfirmationDialog\n open={this.state.openDeleteDialog}\n text=\"Do you really want to delete comment?\"\n handleClose={() => this.setState({ openDeleteDialog: false })}\n handleOk={this.handleDelete}\n okText=\"Delete\"\n />\n )}\n </div>\n );\n }\n}\n\nComment.propTypes = {\n comment: PropTypes.shape({}).isRequired,\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n handleShowOnMount: PropTypes.func,\n handleEdit: PropTypes.func,\n handleDeleteCallback: PropTypes.func.isRequired,\n patchCommentCallback: PropTypes.func.isRequired,\n companyId: PropTypes.number,\n currentUser: PropTypes.shape(),\n\n classes: PropTypes.shape({}).isRequired,\n isNative: PropTypes.bool,\n};\n\nComment.defaultProps = {\n showOnMount: false,\n spaceAround: false,\n handleShowOnMount: noop,\n handleEdit: noop,\n companyId: null,\n\n isNative: isNativeDetected,\n\n currentUser: {},\n};\n\nexport default withStyles(muiStyles)(Comment);\n"],"names":["style","chatAvatarWrapper","paddingTop","position","top","left","commentInfoContainer","display","alignItems","width","userNameWrapper","overflow","infoContainer","verticalAlign","paddingLeft","Comment","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","feedItemId","commentId","commentResponse","wrap","_context","prev","next","deleteFeedItemComment","sent","t0","console","error","abrupt","stop","_x","_x2","apply","arguments","handleShowOnMount","commentEl","current","scrollIntoView","block","event","stopPropagation","setState","actionsMenuAnchorEl","currentTarget","keyCode","isEditing","document","removeEventListener","handleKeyDown","addEventListener","inputEl","focus","comment","editCommentId","id","editComment","body","editAttachment","attachment","editFeedItemId","feed_activity_id","isLoading","openDeleteDialog","_callee2","response","_context2","deleteComment","handleDeleteCallback","state","createRef","_createClass","key","value","showOnMount","showIntoView","get","Number","currentUser","showEdit","isCurrentUserCommentCreator","showDelete","includes","allowed_actions","_jsxs","className","styles","cCommentMenu","children","_jsx","IconButton","concat","undefined","classes","iconButtonRoot","size","onClick","handleOpenActionsMenu","MoreVertIcon","Menu","anchorOrigin","vertical","horizontal","transformOrigin","anchorEl","open","handleCloseActionsMenu","onClose","jsx","MenuItem","handleEditMenuItem","handleDeleteMenuItem","_comment$attachment","_comment$attachment2","_this2","_this$state","spaceAround","CommentLoader","_this$props","isNative","patchCommentCallback","companyId","CommentInput","_objectSpread","inputRef","postComment","noop","exitEditMode","onEditFinish","setIsEditting","getEditCommentProps","userFullName","utils","getUserFullName","user","format","time","moment","created_at","attachmentUrl","signed_url","url","attachmentSize","attachmentFileName","classNames","cComment","cCommentNative","ref","CommentWrapper","commentWrapper","Avatar","displayName","imgSrc","avatar","UserCardPopover","jsxs","Typography","variant","noWrap","userName","timeWrapper","root","timeRoot","cCommentBody","renderMenuIcon","textRoot","formatMentionText","mentioned_users","Attachment","fileName","ConfirmationDialog","text","handleClose","handleOk","handleDelete","okText","PureComponent","propTypes","PropTypes","shape","isRequired","bool","func","handleEdit","number","defaultProps","isNativeDetected","Comment$1","withStyles","theme","color","palette","primary","text7","float","marginRight","marginLeft","fontSize","marginTop","fontWeight","visibility"],"mappings":"4lEA4BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,WAAY,EACZC,SAAU,WACVC,IAAK,EACLC,KAAM,GAERC,qBAAsB,CACpBC,QAAS,cACTC,WAAY,SACZC,MAAO,OACPP,WAAY,GAEdQ,gBAAiB,CAAEC,SAAU,UAC7BC,cAAe,CACbL,QAAS,eACTM,cAAe,MACfJ,MAAO,OACPK,YAAa,KA8BXC,EAAO,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GACX,SAAAA,EAAYK,GAAO,IAAAC,EAuBHC,EAbe,OAVZC,UAAAC,KAAAT,GACjBM,EAAAH,EAAAO,KAAAD,KAAMJ,GAAOM,EAAAA,QAAAC,EAAA,QAAAN,GAAA,iBAsBCC,EAAAM,EAAAA,QAAAC,EAAA,QAAAC,MAAA,SAAAC,EAAOC,EAAYC,GAAS,IAAAC,EAAA,OAAAL,UAAAM,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,OAAAF,EAAAC,KAAA,EAAAD,EAAAE,KAAA,EAIhBC,EAAqBA,sBAACP,EAAYC,GAAU,KAAA,EAApEC,EAAeE,EAAAI,KAAAJ,EAAAE,KAAA,EAAA,MAAA,KAAA,EAAAF,EAAAC,KAAA,EAAAD,EAAAK,GAAAL,EAAA,MAAA,GAEfM,QAAQC,MAAQP,EAAAK,IAAC,KAAA,EAAA,OAAAL,EAAAQ,OAAA,SAGZV,GAAe,KAAA,GAAA,IAAA,MAAA,OAAAE,EAAAS,OAAA,G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AAS,EAC9D8G,SAAUpK,KAAKqK,aACfC,OAAO,aAKjB,KAAC/K,CAAA,CA3RU,CAASgL,EAAaA,eA8RnChL,EAAQiL,UAAY,CAClB5H,QAAS6H,EAAS,QAACC,MAAM,CAAA,GAAIC,WAC7B1G,YAAawG,EAAS,QAACG,KACvBjE,YAAa8D,EAAS,QAACG,KACvBlJ,kBAAmB+I,EAAS,QAACI,KAC7BC,WAAYL,EAAS,QAACI,KACtBlH,qBAAsB8G,EAAAA,QAAUI,KAAKF,WACrC5D,qBAAsB0D,EAAAA,QAAUI,KAAKF,WACrC3D,UAAWyD,EAAS,QAACM,OACrB1G,YAAaoG,EAAS,QAACC,QAEvBtF,QAASqF,EAAS,QAACC,MAAM,CAAA,GAAIC,WAC7B7D,SAAU2D,EAAS,QAACG,MAGtBrL,EAAQyL,aAAe,CACrB/G,aAAa,EACb0C,aAAa,EACbjF,kBAAmB2F,EAAIA,KACvByD,WAAYzD,EAAIA,KAChBL,UAAW,KAEXF,SAAUmE,EAAgBA,iBAE1B5G,YAAa,CAAC,GAGhB,IAAA6G,GAAeC,cAnVG,SAAAC,GAAK,MAAK,CAC1BxC,eAAgB,CAAE3J,MAAO,QACzBwK,SAAU,CACR4B,MAAOD,EAAME,QAAQC,QAAQC,MAC7BC,MAAO,QACPC,YAAa,EACbC,WAAY,EACZC,SAAU,QAEZhC,SAAU,CACRiC,UAAW,EACXR,MAAO,OACPS,WAAY,SACZF,SAAU,QAEZvG,eAAgB,CACdoG,MAAO,QACPM,WAAY,SACZV,MAAOD,EAAME,QAAQC,QAAQC,OAE/BlC,SAAU,CACRsC,SAAU,OACVE,WAAY,QAEf,GA2TcX,CAAsB5L"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@babel/runtime/helpers/asyncToGenerator"),e=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),s=require("@babel/runtime/helpers/possibleConstructorReturn"),r=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),p=require("lodash/noop"),d=require("@material-ui/core/styles"),m=require("@material-ui/core"),h=require("classnames"),f=require("lodash"),g=require("@material-ui/core/colors/grey"),C=require("../../clients/jsonApi/index.js"),x=require("./styles.css.js"),v=require("../Avatar/index.js"),b=require("../FileUploadIconButton.js"),I=require("../EmojiIconButton.js"),y=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),F=require("../FilePreview/index.js"),E=require("../IconButton/index.js"),S=require("../Icons/SendIcon.js"),q=require("../UserMention/utils/index.js"),U=require("../../utils/main.js"),A=require("../../utils/mobileDetect.js"),N=require("../../utils/nativeMessages.js"),k=require("react/jsx-runtime");function M(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var R=M(t),P=M(e),T=M(n),B=M(a),w=M(i),L=M(s),z=M(r),D=M(o),_=M(l),O=M(c),H=M(p),K=M(h),V=M(g);function W(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,a=z.default(t);if(e){var i=z.default(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return L.default(this,n)}}var G={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},J=function(t){w.default(n,t);var e=W(n);function n(t){var a,i,s;return P.default(this,n),a=e.call(this,t),D.default(B.default(a),"handleSelectEmoji",(function(t){return a.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),D.default(B.default(a),"postComment",(i=R.default(_.default.mark((function t(e){var n;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,a.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 i.apply(this,arguments)})),D.default(B.default(a),"patchComment",(s=R.default(_.default.mark((function t(e){var n,i,s,r;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.props,i=n.editFeedItemId,s=n.editCommentId,t.prev=1,t.next=4,C.patchFeedItemComment(i,s,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 s.apply(this,arguments)})),D.default(B.default(a),"clearCommentField",(function(t){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){a.focusOnRef(),t&&"function"==typeof t&&t()}))})),D.default(B.default(a),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&a.props.exitEditMode(),"Enter"===e&&(q.isSuggestionsListOpened()||(t.preventDefault(),a.handleSendComment()))})),D.default(B.default(a),"handleAttachmentLoadingError",(function(t){a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),D.default(B.default(a),"handleFileUpload",(function(t,e,n){a.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),D.default(B.default(a),"handleNativeFileUpload",(function(){var t=a.state.comment;a.isEditMode?(N.notifyCommentEdit(t),a.clearCommentField(a.props.exitEditMode)):(N.notifyCommentPost(t),a.clearCommentField())})),D.default(B.default(a),"handleFileDelete",(function(){return a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),D.default(B.default(a),"handleSendComment",R.default(_.default.mark((function t(){var e,n,i;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=a.state.comment?a.state.comment.trim():null)||a.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:a.state.attachmentUrl,size:a.state.attachmentSize,file_name:a.state.attachmentName}}},!a.isEditMode){t.next=16;break}return a.props.setIsEditting(!0),t.next=8,a.patchComment(n);case 8:return i=t.sent,t.next=11,a.props.patchCommentCallback(i);case 11:a.props.setIsEditting(!1),a.clearCommentField(),a.props.exitEditMode(),t.next=24;break;case 16:return a.props.setIsPosting(!0),t.next=19,a.postComment(n);case 19:return i=t.sent,t.next=22,a.props.postCommentCallback(i);case 22:a.props.setIsPosting(!1),a.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),D.default(B.default(a),"handleCancelClick",(function(){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},a.props.exitEditMode())})),a.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},a}return T.default(n,[{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?this.props.editAttachment.file_name||U.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t,e=this,n=this.props,a=n.classes,i=n.currentUser,s="".concat(f.get(i,["attributes","first_name"])||f.get(i,"first_name")," ").concat(f.get(i,["attributes","last_name"])||f.get(i,"last_name")),r=this.state.isInputFocused||this.state.attachmentUrl||this.state.comment||this.props.editComment||(null===(t=this.props.editAttachment)||void 0===t?void 0:t.url);return k.jsxs("div",{style:this.props.spaceAround?G.commentTextFieldContainerSpaceAround:G.commentTextFieldContainer,children:[k.jsx("div",{style:G.chatAvatarWrapper,children:k.jsx(v.AvatarComponent,{displayName:s,size:32,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),k.jsx(m.Paper,{className:this.props.classes.paperRoot,children:k.jsx(m.TextField,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:j,inputProps:{onChange:function(t){return e.setState({comment:t})},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 e.setState({isInputFocused:!0})},onBlur:function(){return e.setState({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!this.props.isNative&&k.jsxs(m.InputAdornment,{position:"end",className:this.props.classes.inputAdornment,children:[!this.state.attachmentUrl&&k.jsx("div",{className:K.default(x.cCommentInputIconContainer,x.cCommentInputIconUpload),children:k.jsx(b.default,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId),tooltipProps:{title:"Attach File",classes:{tooltip:a.iconTooltip},placement:"top"}})}),k.jsx("div",{className:x.cCommentInputIconContainer,children:k.jsx(I,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:a.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&k.jsx(y,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&k.jsx(F,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),k.jsx(m.Collapse,{in:r,mountOnEnter:!0,unmountOnExit:!0,children:k.jsxs("div",{className:x.cCommentInputSendContainer,children:[k.jsx("div",{className:x.cCommentInputSendContainerCancel,children:k.jsx(m.Typography,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),k.jsxs("div",{className:x.cCommentInputSendContainerSend,children:[k.jsxs(m.Typography,{variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",k.jsx(m.Typography,{variant:"caption",color:"primary",className:K.default(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),k.jsx(E,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:k.jsx(S,{})})]})]})})]})}}]),n}(u.PureComponent);J.propTypes={inputRef:O.default.shape({current:O.default.shape({focus:O.default.shape({})})}),editFeedItemId:O.default.number,editCommentId:O.default.number,editComment:O.default.string,editAttachment:O.default.shape({url:O.default.string,size:O.default.number,file_name:O.default.string}),spaceAround:O.default.bool,postComment:O.default.func.isRequired,postCommentCallback:O.default.func,patchCommentCallback:O.default.func,exitEditMode:O.default.func,setIsPosting:O.default.func,setIsEditting:O.default.func,onMount:O.default.func,autoFocus:O.default.bool,disabled:O.default.bool,classes:O.default.shape({}).isRequired,currentUser:O.default.shape(),isNative:O.default.bool,companyId:O.default.number,parentId:O.default.string},J.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:H.default,setIsEditting:H.default,onMount:H.default,autoFocus:void 0,disabled:!1,patchCommentCallback:H.default,postCommentCallback:H.default,exitEditMode:H.default,companyId:null,currentUser:{},isNative:A.isNativeDetected};var Q=d.withStyles((function(t){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},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},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(J);module.exports=Q;
|
|
1
|
+
"use strict";var t=require("@babel/runtime/helpers/asyncToGenerator"),e=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),s=require("@babel/runtime/helpers/possibleConstructorReturn"),r=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),d=require("lodash/noop"),p=require("@material-ui/core/styles"),m=require("@material-ui/core"),h=require("classnames"),f=require("lodash"),g=require("@material-ui/core/colors/grey"),C=require("../../clients/jsonApi/index.js"),x=require("./styles.css.js"),v=require("../Avatar/index.js"),b=require("../FileUploadIconButton.js"),I=require("../EmojiIconButton.js"),y=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),F=require("../FilePreview/index.js"),E=require("../IconButton/index.js"),S=require("../Icons/SendIcon.js"),q=require("../UserMention/utils/index.js"),U=require("../../utils/main.js"),A=require("../../utils/mobileDetect.js"),N=require("../../utils/nativeMessages.js"),k=require("react/jsx-runtime");function M(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var R=M(t),P=M(e),T=M(n),B=M(a),w=M(i),L=M(s),z=M(r),D=M(o),_=M(l),O=M(c),H=M(d),K=M(h),V=M(g);function W(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,a=z.default(t);if(e){var i=z.default(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return L.default(this,n)}}var G={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},J=function(t){w.default(n,t);var e=W(n);function n(t){var a,i,s;return P.default(this,n),a=e.call(this,t),D.default(B.default(a),"handleSelectEmoji",(function(t){return a.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),D.default(B.default(a),"postComment",(i=R.default(_.default.mark((function t(e){var n;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,a.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 i.apply(this,arguments)})),D.default(B.default(a),"patchComment",(s=R.default(_.default.mark((function t(e){var n,i,s,r;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.props,i=n.editFeedItemId,s=n.editCommentId,t.prev=1,t.next=4,C.patchFeedItemComment(i,s,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 s.apply(this,arguments)})),D.default(B.default(a),"clearCommentField",(function(t){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){a.focusOnRef(),t&&"function"==typeof t&&t()}))})),D.default(B.default(a),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&a.props.exitEditMode(),"Enter"===e&&(q.isSuggestionsListOpened()||(t.preventDefault(),a.handleSendComment()))})),D.default(B.default(a),"handleAttachmentLoadingError",(function(t){a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),D.default(B.default(a),"handleFileUpload",(function(t,e,n){a.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),D.default(B.default(a),"handleNativeFileUpload",(function(){var t=a.state.comment;a.isEditMode?(N.notifyCommentEdit(t),a.clearCommentField(a.props.exitEditMode)):(N.notifyCommentPost(t),a.clearCommentField())})),D.default(B.default(a),"handleFileDelete",(function(){return a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),D.default(B.default(a),"handleSendComment",R.default(_.default.mark((function t(){var e,n,i;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=a.state.comment?a.state.comment.trim():null)||a.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:a.state.attachmentUrl,size:a.state.attachmentSize,file_name:a.state.attachmentName}}},!a.isEditMode){t.next=16;break}return a.props.setIsEditting(!0),t.next=8,a.patchComment(n);case 8:return i=t.sent,t.next=11,a.props.patchCommentCallback(i);case 11:a.props.setIsEditting(!1),a.clearCommentField(),a.props.exitEditMode(),t.next=24;break;case 16:return a.props.setIsPosting(!0),t.next=19,a.postComment(n);case 19:return i=t.sent,t.next=22,a.props.postCommentCallback(i);case 22:a.props.setIsPosting(!1),a.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),D.default(B.default(a),"handleCancelClick",(function(){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},a.props.exitEditMode())})),a.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},a}return T.default(n,[{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?this.props.editAttachment.file_name||U.default.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t,e=this,n=this.props,a=n.classes,i=n.currentUser,s="".concat(f.get(i,["attributes","first_name"])||f.get(i,"first_name")," ").concat(f.get(i,["attributes","last_name"])||f.get(i,"last_name")),r=this.state.isInputFocused||this.state.attachmentUrl||this.state.comment||this.props.editComment||(null===(t=this.props.editAttachment)||void 0===t?void 0:t.url);return k.jsxs("div",{style:this.props.spaceAround?G.commentTextFieldContainerSpaceAround:G.commentTextFieldContainer,children:[k.jsx("div",{style:G.chatAvatarWrapper,children:k.jsx(v.AvatarComponent,{displayName:s,size:32,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),k.jsx(m.Paper,{className:this.props.classes.paperRoot,children:k.jsx(m.TextField,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:j,inputProps:{onChange:function(t){return e.setState({comment:t})},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 e.setState({isInputFocused:!0})},onBlur:function(){return e.setState({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!this.props.isNative&&k.jsxs(m.InputAdornment,{position:"end",className:this.props.classes.inputAdornment,children:[!this.state.attachmentUrl&&k.jsx("div",{className:K.default(x.cCommentInputIconContainer,x.cCommentInputIconUpload),children:k.jsx(b.default,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId),tooltipProps:{title:"Attach File",classes:{tooltip:a.iconTooltip},placement:"top"}})}),k.jsx("div",{className:x.cCommentInputIconContainer,children:k.jsx(I,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:a.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&k.jsx(y,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&k.jsx(F,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),k.jsx(m.Collapse,{in:r,mountOnEnter:!0,unmountOnExit:!0,children:k.jsxs("div",{className:x.cCommentInputSendContainer,children:[k.jsx("div",{className:x.cCommentInputSendContainerCancel,children:k.jsx(m.Typography,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),k.jsxs("div",{className:x.cCommentInputSendContainerSend,children:[k.jsxs(m.Typography,{variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",k.jsx(m.Typography,{variant:"caption",color:"primary",className:K.default(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),k.jsx(E,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:k.jsx(S,{})})]})]})})]})}}]),n}(u.PureComponent);J.propTypes={inputRef:O.default.shape({current:O.default.shape({focus:O.default.shape({})})}),editFeedItemId:O.default.number,editCommentId:O.default.number,editComment:O.default.string,editAttachment:O.default.shape({url:O.default.string,size:O.default.number,file_name:O.default.string}),spaceAround:O.default.bool,postComment:O.default.func.isRequired,postCommentCallback:O.default.func,patchCommentCallback:O.default.func,exitEditMode:O.default.func,setIsPosting:O.default.func,setIsEditting:O.default.func,onMount:O.default.func,autoFocus:O.default.bool,disabled:O.default.bool,classes:O.default.shape({}).isRequired,currentUser:O.default.shape(),isNative:O.default.bool,companyId:O.default.number,parentId:O.default.string},J.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:H.default,setIsEditting:H.default,onMount:H.default,autoFocus:void 0,disabled:!1,patchCommentCallback:H.default,postCommentCallback:H.default,exitEditMode:H.default,companyId:null,currentUser:{},isNative:A.isNativeDetected};var Q=p.withStyles((function(t){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},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},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(J);module.exports=Q;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/CommentInput/index.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { patchFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages'; // question here\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nclass CommentInput extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n\n attachmentLoadingError: null,\n isInputFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.isEditMode) {\n this.setInitialCommentValue();\n }\n }\n\n componentDidUpdate(prevProps) {\n const enteredEditMode = this.isEditMode && !prevProps.editFeedItemId;\n if (\n enteredEditMode ||\n (this.props.editCommentId && this.props.editCommentId !== prevProps.editCommentId)\n ) {\n this.setInitialCommentValue();\n }\n }\n\n get isEditMode() {\n return !!this.props.editFeedItemId;\n }\n\n setInitialCommentValue() {\n const attachmentUrl = this.props.editAttachment ? this.props.editAttachment.url : null;\n\n this.setState({\n comment: this.props.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? this.props.editAttachment.file_name ||\n utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: this.props.editAttachment ? this.props.editAttachment.size : null,\n });\n }\n\n handleSelectEmoji = emoji =>\n this.setState(({ comment }) => ({ comment: `${comment}${emoji.native}` }));\n\n postComment = async comment => {\n let commentResponse;\n try {\n commentResponse = await this.props.postComment(comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n patchComment = async comment => {\n const { editFeedItemId, editCommentId } = this.props;\n\n let commentResponse;\n\n try {\n commentResponse = await patchFeedItemComment(editFeedItemId, editCommentId, comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n focusOnRef() {\n if (this.props.inputRef) this.props.inputRef.current.focus();\n }\n\n clearCommentField = callback => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n () => {\n this.focusOnRef();\n if (callback && typeof callback === 'function') callback();\n }\n );\n };\n\n handleKeyDown = event => {\n const { key } = event;\n\n if (key === 'Escape') this.props.exitEditMode();\n\n if (key === 'Enter') {\n if (!isSuggestionsListOpened()) {\n event.preventDefault();\n this.handleSendComment();\n }\n }\n };\n\n handleAttachmentLoadingError = attachmentLoadingError => {\n this.setState({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n });\n };\n\n handleFileUpload = (attachmentUrl, attachmentName, attachmentSize) => {\n this.setState({\n attachmentUrl,\n attachmentName,\n attachmentSize,\n attachmentLoadingError: null,\n });\n };\n\n handleNativeFileUpload = () => {\n const { comment } = this.state;\n\n if (this.isEditMode) {\n notifyCommentEdit(comment);\n this.clearCommentField(this.props.exitEditMode);\n } else {\n notifyCommentPost(comment);\n this.clearCommentField();\n }\n };\n\n handleFileDelete = () =>\n this.setState({ attachmentUrl: null, attachmentName: null, attachmentSize: null });\n\n handleSendComment = async () => {\n const textComment = this.state.comment ? this.state.comment.trim() : null;\n if (!textComment && !this.state.attachmentUrl) return;\n\n const comment = {\n comment: {\n body: textComment,\n attachment: {\n url: this.state.attachmentUrl,\n size: this.state.attachmentSize,\n file_name: this.state.attachmentName,\n },\n },\n };\n\n let commentResponse;\n\n if (this.isEditMode) {\n this.props.setIsEditting(true);\n\n commentResponse = await this.patchComment(comment);\n await this.props.patchCommentCallback(commentResponse);\n\n this.props.setIsEditting(false);\n this.clearCommentField();\n this.props.exitEditMode();\n } else {\n this.props.setIsPosting(true);\n\n commentResponse = await this.postComment(comment);\n await this.props.postCommentCallback(commentResponse);\n\n this.props.setIsPosting(false);\n this.clearCommentField();\n }\n };\n\n handleCancelClick = () => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n this.props.exitEditMode()\n );\n };\n\n render() {\n const { classes, currentUser } = this.props;\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n this.state.isInputFocused ||\n this.state.attachmentUrl ||\n this.state.comment ||\n this.props.editComment ||\n this.props.editAttachment?.url;\n\n return (\n <div\n style={\n this.props.spaceAround\n ? style.commentTextFieldContainerSpaceAround\n : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={this.props.currentUser && this.props.currentUser.profile_photo}\n />\n </div>\n <Paper className={this.props.classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => this.setState({ comment }),\n singleLine: true,\n value: this.state.comment || '',\n inputRef: this.props.inputRef,\n withLightTheme: false,\n onMount: this.props.onMount,\n companyId: this.props.companyId,\n autoFocus: this.props.autoFocus,\n disabled: this.props.disabled,\n onFocus: () => this.setState({ isInputFocused: true }),\n onBlur: () => this.setState({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !this.props.isNative && (\n <InputAdornment position=\"end\" className={this.props.classes.inputAdornment}>\n {!this.state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={this.handleFileUpload}\n onError={this.handleAttachmentLoadingError}\n fileUploadIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${\n this.props.editCommentId || this.props.parentId\n }`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={this.handleSelectEmoji}\n emojiIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: this.props.classes.inputRoot,\n input: this.props.classes.inputEl,\n },\n }}\n className={this.props.classes.input}\n onKeyDown={this.handleKeyDown}\n />\n </Paper>\n\n {this.state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={this.state.attachmentLoadingError}\n className={this.props.classes.fileUploadingError}\n />\n )}\n\n {this.state.attachmentUrl && (\n <FilePreview\n fileName={this.state.attachmentName}\n fileUrl={this.state.attachmentUrl}\n handleFileDelete={this.handleFileDelete}\n classes={this.props.classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.cancelText,\n this.props.classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={this.handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(this.props.classes.inputMain, this.props.classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press \n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.highlightedLabel\n )}\n >\n Enter\n </Typography>\n to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={this.handleSendComment}\n classes={{ root: this.props.classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n}\n\nCommentInput.propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.defaultProps = {\n inputRef: null,\n editFeedItemId: null,\n editCommentId: null,\n parentId: null,\n editComment: null,\n editAttachment: {},\n spaceAround: false,\n setIsPosting: noop,\n setIsEditting: noop,\n onMount: noop,\n autoFocus: undefined,\n disabled: false,\n patchCommentCallback: noop,\n postCommentCallback: noop,\n exitEditMode: noop,\n companyId: null,\n currentUser: {},\n\n isNative: isNativeDetected,\n};\n\nexport default withStyles(muiStyles)(CommentInput);\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","CommentInput","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref2","_ref3","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","emoji","setState","_ref","comment","native","_asyncToGenerator","_regeneratorRuntime","mark","commentResponse","wrap","_context","prev","next","postComment","sent","t0","console","error","message","abrupt","stop","_callee","_x","apply","arguments","_this$props","editFeedItemId","editCommentId","_context2","patchFeedItemComment","_callee2","_x2","callback","attachmentUrl","attachmentName","attachmentSize","focusOnRef","event","key","exitEditMode","isSuggestionsListOpened","preventDefault","handleSendComment","attachmentLoadingError","state","isEditMode","notifyCommentEdit","clearCommentField","notifyCommentPost","_callee3","textComment","_context3","trim","body","attachment","url","size","file_name","setIsEditting","patchComment","patchCommentCallback","setIsPosting","postCommentCallback","isInputFocused","_createClass","value","setInitialCommentValue","prevProps","get","editAttachment","editComment","utils","getFileNameWithExtensionFromPath","inputRef","current","focus","_this$props$editAttac","_this2","_this$props2","classes","currentUser","currentUserFullName","concat","isVisibleActionBar","_jsxs","spaceAround","children","_jsx","jsx","Avatar","displayName","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","withLightTheme","onMount","companyId","autoFocus","disabled","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","isNative","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","handleFileUpload","onError","handleAttachmentLoadingError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","parentId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","handleSelectEmoji","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","handleKeyDown","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","fileUrl","handleFileDelete","Collapse","in","mountOnEnter","unmountOnExit","jsxs","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","handleCancelClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","PureComponent","propTypes","PropTypes","shape","number","string","bool","func","isRequired","defaultProps","noop","undefined","isNativeDetected","CommentInput$1","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor"],"mappings":"40DA0BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC,KAAM,EACNC,OATiB,IAWnBC,0BAA2B,CAAEH,SAAU,WAAYI,OAAQ,KAC3DC,qCAAsC,CAAEL,SAAU,WAAYI,OAAQ,cAsElEE,EAAY,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GAChB,SAAAA,EAAYK,GAAO,IAAAC,EAiDyDC,EAW3EC,EAjDG,OAXeC,UAAAC,KAAAV,GACjBM,EAAAH,EAAAQ,KAAAD,KAAML,GAAOO,EAAAA,QAAAC,EAAAA,QAAAP,GAAA,qBA+CK,SAAAQ,GAAK,OACvBR,EAAKS,UAAS,SAAAC,GAAA,IAAGC,IAAAA,QAAO,MAAQ,CAAEA,QAAYA,GAAAA,OAAAA,GAAUH,OAAAA,EAAMI,QAAU,GAAE,IAAAN,EAAAA,QAAAC,EAAA,QAAAP,GAAA,eAAAC,EAAAY,EAAAA,QAA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,QAAQC,QAAQC,OAEtDH,UAAW,OACXI,WAAY,WAEdxD,MAAO,CACLyD,YAAa,EACbT,MAAO,QAETjD,UAAW,CACTnK,OAjCiB,GAkCjB8N,aAAc,MACdC,WAAY,OACZF,YAAa,OAEfxD,QAAS,CAAE2D,QAAS,YAAahO,OAAQ,QACzCoJ,uBAAwB,CACtB4E,QAAS,OAEXC,mBAAoB,CAClB/N,OAAQ,WACRgO,OAAQ,WAEVxD,mBAAoB,CAClByD,UAAW,GACXd,WAAY,IAEd7B,UAAW,CACT4C,aAAc,EACdC,SAAU,OACVrC,MAAOmB,EAAMM,QAAQC,QAAQY,OAE/BvC,YAAa,CACXnM,QAAS,OACTkO,aAAc,GAEhBrC,WAAY,CACVyC,OAAQ,WAEVxC,iBAAkB,CAChBM,MAAOmB,EAAMM,QAAQC,QAAQC,MAE/B/D,YAAa,CACXuE,UAAW,OAEbjC,WAAY,CACV,UAAW,CACTqC,gBAAiB,wBAEnB,uBAAwB,CACtBP,QAAS,IAGbzF,eAAgB,CACd6F,aAAc,cACdpO,OAAQ,QAEX,GAqackN,CAAsB9M"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/CommentInput/index.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { patchFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages'; // question here\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nclass CommentInput extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n\n attachmentLoadingError: null,\n isInputFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.isEditMode) {\n this.setInitialCommentValue();\n }\n }\n\n componentDidUpdate(prevProps) {\n const enteredEditMode = this.isEditMode && !prevProps.editFeedItemId;\n if (\n enteredEditMode ||\n (this.props.editCommentId && this.props.editCommentId !== prevProps.editCommentId)\n ) {\n this.setInitialCommentValue();\n }\n }\n\n get isEditMode() {\n return !!this.props.editFeedItemId;\n }\n\n setInitialCommentValue() {\n const attachmentUrl = this.props.editAttachment ? this.props.editAttachment.url : null;\n\n this.setState({\n comment: this.props.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? this.props.editAttachment.file_name ||\n utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: this.props.editAttachment ? this.props.editAttachment.size : null,\n });\n }\n\n handleSelectEmoji = emoji =>\n this.setState(({ comment }) => ({ comment: `${comment}${emoji.native}` }));\n\n postComment = async comment => {\n let commentResponse;\n try {\n commentResponse = await this.props.postComment(comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n patchComment = async comment => {\n const { editFeedItemId, editCommentId } = this.props;\n\n let commentResponse;\n\n try {\n commentResponse = await patchFeedItemComment(editFeedItemId, editCommentId, comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n focusOnRef() {\n if (this.props.inputRef) this.props.inputRef.current.focus();\n }\n\n clearCommentField = callback => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n () => {\n this.focusOnRef();\n if (callback && typeof callback === 'function') callback();\n }\n );\n };\n\n handleKeyDown = event => {\n const { key } = event;\n\n if (key === 'Escape') this.props.exitEditMode();\n\n if (key === 'Enter') {\n if (!isSuggestionsListOpened()) {\n event.preventDefault();\n this.handleSendComment();\n }\n }\n };\n\n handleAttachmentLoadingError = attachmentLoadingError => {\n this.setState({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n });\n };\n\n handleFileUpload = (attachmentUrl, attachmentName, attachmentSize) => {\n this.setState({\n attachmentUrl,\n attachmentName,\n attachmentSize,\n attachmentLoadingError: null,\n });\n };\n\n handleNativeFileUpload = () => {\n const { comment } = this.state;\n\n if (this.isEditMode) {\n notifyCommentEdit(comment);\n this.clearCommentField(this.props.exitEditMode);\n } else {\n notifyCommentPost(comment);\n this.clearCommentField();\n }\n };\n\n handleFileDelete = () =>\n this.setState({ attachmentUrl: null, attachmentName: null, attachmentSize: null });\n\n handleSendComment = async () => {\n const textComment = this.state.comment ? this.state.comment.trim() : null;\n if (!textComment && !this.state.attachmentUrl) return;\n\n const comment = {\n comment: {\n body: textComment,\n attachment: {\n url: this.state.attachmentUrl,\n size: this.state.attachmentSize,\n file_name: this.state.attachmentName,\n },\n },\n };\n\n let commentResponse;\n\n if (this.isEditMode) {\n this.props.setIsEditting(true);\n\n commentResponse = await this.patchComment(comment);\n await this.props.patchCommentCallback(commentResponse);\n\n this.props.setIsEditting(false);\n this.clearCommentField();\n this.props.exitEditMode();\n } else {\n this.props.setIsPosting(true);\n\n commentResponse = await this.postComment(comment);\n await this.props.postCommentCallback(commentResponse);\n\n this.props.setIsPosting(false);\n this.clearCommentField();\n }\n };\n\n handleCancelClick = () => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n this.props.exitEditMode()\n );\n };\n\n render() {\n const { classes, currentUser } = this.props;\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n this.state.isInputFocused ||\n this.state.attachmentUrl ||\n this.state.comment ||\n this.props.editComment ||\n this.props.editAttachment?.url;\n\n return (\n <div\n style={\n this.props.spaceAround\n ? style.commentTextFieldContainerSpaceAround\n : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={this.props.currentUser && this.props.currentUser.profile_photo}\n />\n </div>\n <Paper className={this.props.classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => this.setState({ comment }),\n singleLine: true,\n value: this.state.comment || '',\n inputRef: this.props.inputRef,\n withLightTheme: false,\n onMount: this.props.onMount,\n companyId: this.props.companyId,\n autoFocus: this.props.autoFocus,\n disabled: this.props.disabled,\n onFocus: () => this.setState({ isInputFocused: true }),\n onBlur: () => this.setState({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !this.props.isNative && (\n <InputAdornment position=\"end\" className={this.props.classes.inputAdornment}>\n {!this.state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={this.handleFileUpload}\n onError={this.handleAttachmentLoadingError}\n fileUploadIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${\n this.props.editCommentId || this.props.parentId\n }`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={this.handleSelectEmoji}\n emojiIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: this.props.classes.inputRoot,\n input: this.props.classes.inputEl,\n },\n }}\n className={this.props.classes.input}\n onKeyDown={this.handleKeyDown}\n />\n </Paper>\n\n {this.state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={this.state.attachmentLoadingError}\n className={this.props.classes.fileUploadingError}\n />\n )}\n\n {this.state.attachmentUrl && (\n <FilePreview\n fileName={this.state.attachmentName}\n fileUrl={this.state.attachmentUrl}\n handleFileDelete={this.handleFileDelete}\n classes={this.props.classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.cancelText,\n this.props.classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={this.handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(this.props.classes.inputMain, this.props.classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press \n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.highlightedLabel\n )}\n >\n Enter\n </Typography>\n to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={this.handleSendComment}\n classes={{ root: this.props.classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n}\n\nCommentInput.propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.defaultProps = {\n inputRef: null,\n editFeedItemId: null,\n editCommentId: null,\n parentId: null,\n editComment: null,\n editAttachment: {},\n spaceAround: false,\n setIsPosting: noop,\n setIsEditting: noop,\n onMount: noop,\n autoFocus: undefined,\n disabled: false,\n patchCommentCallback: noop,\n postCommentCallback: noop,\n exitEditMode: noop,\n companyId: null,\n currentUser: {},\n\n isNative: isNativeDetected,\n};\n\nexport default withStyles(muiStyles)(CommentInput);\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","CommentInput","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref2","_ref3","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","emoji","setState","_ref","comment","native","_asyncToGenerator","_regeneratorRuntime","mark","commentResponse","wrap","_context","prev","next","postComment","sent","t0","console","error","message","abrupt","stop","_callee","_x","apply","arguments","_this$props","editFeedItemId","editCommentId","_context2","patchFeedItemComment","_callee2","_x2","callback","attachmentUrl","attachmentName","attachmentSize","focusOnRef","event","key","exitEditMode","isSuggestionsListOpened","preventDefault","handleSendComment","attachmentLoadingError","state","isEditMode","notifyCommentEdit","clearCommentField","notifyCommentPost","_callee3","textComment","_context3","trim","body","attachment","url","size","file_name","setIsEditting","patchComment","patchCommentCallback","setIsPosting","postCommentCallback","isInputFocused","_createClass","value","setInitialCommentValue","prevProps","get","editAttachment","editComment","utils","getFileNameWithExtensionFromPath","inputRef","current","focus","_this$props$editAttac","_this2","_this$props2","classes","currentUser","currentUserFullName","concat","isVisibleActionBar","_jsxs","spaceAround","children","_jsx","jsx","Avatar","displayName","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","withLightTheme","onMount","companyId","autoFocus","disabled","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","isNative","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","handleFileUpload","onError","handleAttachmentLoadingError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","parentId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","handleSelectEmoji","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","handleKeyDown","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","fileUrl","handleFileDelete","Collapse","in","mountOnEnter","unmountOnExit","jsxs","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","handleCancelClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","PureComponent","propTypes","PropTypes","shape","number","string","bool","func","isRequired","defaultProps","noop","undefined","isNativeDetected","CommentInput$1","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor"],"mappings":"40DA0BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC,KAAM,EACNC,OATiB,IAWnBC,0BAA2B,CAAEH,SAAU,WAAYI,OAAQ,KAC3DC,qCAAsC,CAAEL,SAAU,WAAYI,OAAQ,cAsElEE,EAAY,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GAChB,SAAAA,EAAYK,GAAO,IAAAC,EAiDyDC,EAW3EC,EAjDG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