@livetiles/reach-components-react 0.3.72 → 0.3.73
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/index.esm2.js +35 -52
- package/index.umd.js +35 -52
- package/package.json +1 -1
package/index.esm2.js
CHANGED
|
@@ -87976,9 +87976,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
|
|
|
87976
87976
|
}), void 0);
|
|
87977
87977
|
};
|
|
87978
87978
|
|
|
87979
|
-
var version$1 = "0.3.
|
|
87980
|
-
var buildId = "
|
|
87981
|
-
var commitId = "
|
|
87979
|
+
var version$1 = "0.3.73";
|
|
87980
|
+
var buildId = "101767";
|
|
87981
|
+
var commitId = "2638cc78f2e66e1ce832748f58ede8cfa483600d";
|
|
87982
87982
|
var isCustomerBuild = false;
|
|
87983
87983
|
var buildInfo = {
|
|
87984
87984
|
version: version$1,
|
|
@@ -132286,7 +132286,7 @@ var handleAttachmentCallback=useCallback(handleAttachmentsAdded,[attachments,set
|
|
|
132286
132286
|
// => we should display a retry button on the attachment preview
|
|
132287
132287
|
.then(function(){if(ignoreRef.current){return;}setAttachments(function(attachments){return attachments.map(function(a){return a.id!==newAttachment.id?a:__assign(__assign({},a),{isUploadInProgress:false});});});},function(error){logger.error(error);if(!warningToastHandle.current){warningToastHandle.current=showToastWarning('Attachments.uploadError',undefined,function(){return warningToastHandle.current=null;});}if(ignoreRef.current){return;}setAttachments(function(attachments){return attachments.map(function(a){return a.id!==newAttachment.id?a:__assign(__assign({},a),{hasError:true,isUploadInProgress:false});});});});};for(_i=0,newAttachments_1=newAttachments;_i<newAttachments_1.length;_i++){newAttachment=newAttachments_1[_i];_loop_1(newAttachment);}return [2/*return*/];});});}function clearAttachments(){if(!ignoreRef.current){setAttachments([]);setDeletedAttachmentUrls([]);}}function deleteAttachment(attachment){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,handleAttachmentsAdded(attachments.filter(function(f){return f.id!==attachment.id;}))];case 1:_a.sent();setDeletedAttachmentUrls(__spreadArray(__spreadArray([],deletedAttachmentUrls),[attachment.url]));return [2/*return*/];}});});}function uploadAttachment(basePath,attachment){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){if(attachment.type===AttachmentType.Image){return [2/*return*/,uploadImage(basePath,user.subscription.id,attachment.id,containerId,attachment.file)];}else {return [2/*return*/,uploadFile(basePath,user.subscription.id,attachment.id,containerId,attachment.file)];}});});}}var EditCommentWithAttachments=function EditCommentWithAttachments(props){var user=useCurrentUser();var getImageUrl=useAttachmentsApi().getImageUrl;var _a=useAttachmentUploader(props.item.attachments,props.item.attachmentContainerId,props.basePath),attachments=_a[0],handleAttachmentsAdded=_a[1],deletedAttachmentUrls=_a[3],onDeleteAttachment=_a[4];return jsx$1(EditComment,__assign({},props,{allowSaveWithoutContent:props.allowSaveWithoutContent,saveOnEnter:props.saveOnEnter,saveOnCtrlEnter:props.saveOnCtrlEnter,files:attachments.map(function(a){return __assign(__assign({},a),!isClientAttachment(a)&&{previewUrl:getImageUrl(props.basePath,user.subscription.id,props.item,a.id)});}),allowAttachments:!!props.basePath,onSave:handlePost,onAttachmentAdded:handleAttachmentsAdded,allowKeywords:props.allowKeywords,availableKeywords:props.availableKeywords,mandatoryKeywords:props.mandatoryKeywords,keywords:props.keywords,deletedFileUrls:deletedAttachmentUrls,onDeleteAttachment:onDeleteAttachment}),void 0);function handlePost(newContent,keywords){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,props.onSave(newContent,attachments,keywords)];case 1:_a.sent();return [2/*return*/];}});});}};function isClientAttachment(value){return value.file!=null;}var CommentDisplay=function CommentDisplay(_a){var _b;var type=_a.type,baseAttachmentPath=_a.baseAttachmentPath,message=_a.message,onDelete=_a.onDelete,showDelete=_a.showDelete,showAutoTranslate=_a.showAutoTranslate,showEdit=_a.showEdit,scope=_a.scope,mentionSearchHandler=_a.mentionSearchHandler,getHashtagFilterRoute=_a.getHashtagFilterRoute,highlight=_a.highlight,isInitialLiked=_a.isInitialLiked,onReplyIconClick=_a.onReplyIconClick,onReply=_a.onReply,replyCount=_a.replyCount,readOnly=_a.readOnly,className=_a.className;var _c=useCommentApi(),toggleCommentLike=_c.toggleCommentLike,translateComment=_c.translateComment,updateComment=_c.updateComment;var formatMessage=useIntl().formatMessage;var _d=useNotificationContext(),showToast=_d.showToast,showError=_d.showError;var _e=useState$2(false),isEditMode=_e[0],setIsEditMode=_e[1];var _f=useState$2(message.content),content=_f[0],setContent=_f[1];var _g=useState$2(message.attachments),attachments=_g[0],setAttachments=_g[1];var _h=useState$2(message.modified),modifiedTime=_h[0],setModifiedTime=_h[1];var _j=useState$2(message.content),originalContent=_j[0],setOriginalContent=_j[1];var _k=useState$2(isInitialLiked),isLiked=_k[0],setIsLiked=_k[1];var _l=useState$2(((_b=message.statistics)===null||_b===void 0?void 0:_b.likeCount)||0),likeCounter=_l[0],setLikeCounter=_l[1];var features=useFeatures();var palette=useContext(ThemeContext$1).theme.palette;var hasContent=content.length>0;message=__assign(__assign({},message),{attachments:attachments});return jsxs(Container$1,__assign({className:className,"data-comment-id":message.id,"data-has-auto-translate":showAutoTranslate,"data-can-edit":showEdit,"data-can-delete":showDelete,"data-show-highlight":highlight,highlight:highlight,id:"Comment-"+message.id},{children:[jsxs(Header$1,{children:[jsx$1(CommentUser,__assign({upn:message.sender.userPrincipalName,domIdentifier:"avatar"},{children:jsx$1(Avatar,{upn:message.sender.userPrincipalName,text:message.sender.displayName,size:PersonaSize.small,hidePersonaDetails:true},void 0)}),void 0),jsxs(HeaderMetadata$1,{children:[jsx$1(CommentDisplayName,{children:jsx$1(StyledPersonaCard$1,__assign({upn:message.sender.userPrincipalName},{children:message.sender.displayName}),void 0)},void 0),jsx$1(CommentDateTime,{className:"ms-fontColor-neutralTertiary",value:message.receivedDateTime},void 0),jsx$1(Modified,{modified:modifiedTime},void 0)]},void 0),message.id&&jsxs(Buttons$1,{children:[features.replyToComments&&replyCount>0&&jsx$1(ReplyCountButton,{tooltipResourceKey:"Comment.numberOfReplies",tooltipResourceKeyValues:{count:replyCount},ariaLabel:formatMessage({id:onReplyIconClick?'AriaLabel.commentsButton':'AriaLabel.repliesButton'}),iconName:"Chat",count:replyCount,feedbackType:"comment",onClick:onReplyIconClick!==null&&onReplyIconClick!==void 0?onReplyIconClick:onReply?function(){return onReply(message.id);}:null,highlight:message.hasUnreadReplies,readOnly:readOnly},void 0),jsx$1(StyledLikeButton$1,{itemId:message.id,itemType:ItemResourceTypes.Comments,count:likeCounter,isActive:isLiked,onClick:function(){return handleLike(!isLiked);},doNotRenderZeroCount:true,isDemoContent:message.isDemoContent,readOnly:readOnly},void 0),jsx$1(CommentActionMenu,{comment:message,showEdit:showEdit,onDelete:onDelete,showDelete:showDelete,isEditMode:isEditMode,toggleEditMode:setIsEditMode,originalContent:originalContent,currentContent:content,setContent:setContent,handleTranslate:handleTranslate,showAutoTranslate:showAutoTranslate,onReply:onReply,disabled:readOnly},void 0)]},void 0)]},void 0),jsxs(Body,{children:[isEditMode&&jsx$1(StyledEditCommentWithAttachments,{content:content,mentionSearchHandler:mentionSearchHandler,onSave:handleSaveComment,onCancel:function(){return setIsEditMode(false);},basePath:baseAttachmentPath,item:message,allowSaveWithoutContent:true,saveOnCtrlEnter:true},void 0),!isEditMode&&hasContent&&jsx$1(Fragment,{children:jsx$1(Content$4,__assign({"data-comment-content":message.id},{children:jsx$1(ContentDisplay,{content:content,handlers:[ContentDisplayHandler.LineBreak,ContentDisplayHandler.Link,ContentDisplayHandler.Mention,ContentDisplayHandler.Hashtag],getHashtagRoute:getHashtagFilterRoute},void 0)}),void 0)},void 0)]},void 0),!isEditMode&&(attachments===null||attachments===void 0?void 0:attachments.length)>0&&jsxs("div",__assign({"data-mixed-attachment-list":true},{children:[jsx$1(GifList,{attachments:message.attachments},void 0),jsx$1(StyledImagesAndFilesList$1,{item:message,basePath:baseAttachmentPath,imagesGridBackgroundColor:palette.white},void 0),jsx$1(VideoList,{attachments:message.attachments},void 0),jsx$1(EmbeddedObjectList,{attachments:message.attachments},void 0)]}),void 0)]}),void 0);function handleLike(newIsLiked){return __awaiter(this,void 0,void 0,function(){var oldCounter,error_1;return __generator(this,function(_a){switch(_a.label){case 0:oldCounter=likeCounter;_a.label=1;case 1:_a.trys.push([1,3,,4]);setIsLiked(newIsLiked);setLikeCounter(newIsLiked?oldCounter+1:oldCounter-1);return [4/*yield*/,toggleCommentLike(message.id,newIsLiked)];case 2:_a.sent();return [3/*break*/,4];case 3:error_1=_a.sent();setIsLiked(!newIsLiked);setLikeCounter(oldCounter);logger.error(error_1);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}function handleSaveComment(newContent,newAttachments){return __awaiter(this,void 0,void 0,function(){var error_2;return __generator(this,function(_a){switch(_a.label){case 0:setContent(newContent);setAttachments(newAttachments);setIsEditMode(false);setModifiedTime(new Date().toISOString());setOriginalContent(newContent);_a.label=1;case 1:_a.trys.push([1,3,,4]);return [4/*yield*/,updateComment(scope,message.parentItemId,message.id,newContent,newAttachments,type)];case 2:_a.sent();showToast('Comment.successfullyUpdated');return [3/*break*/,4];case 3:error_2=_a.sent();logger.error(error_2);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}function handleTranslate(preferredContentLanguageCode){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_b){switch(_b.label){case 0:_b.trys.push([0,2,,3]);return [4/*yield*/,translateComment(type,scope,message.parentItemId,message.id,preferredContentLanguageCode)];case 1:return [2/*return*/,_b.sent()];case 2:_b.sent();showError('Generic.error');return [2/*return*/,null];case 3:return [2/*return*/];}});});}};var Header$1=_styled.div.withConfig({displayName:"CommentDisplay__Header",componentId:"sc-el7c23-0"})(templateObject_1$1I||(templateObject_1$1I=__makeTemplateObject(["\n display: flex;\n align-items: center;\n"],["\n display: flex;\n align-items: center;\n"])));var avatarWidth$1=40;var maxButtonsWidth$1=125;// max 3 buttons (menu button, replies, like)
|
|
132288
132288
|
var paddingLeft$1=spacingS;var HeaderMetadata$1=_styled.div.withConfig({displayName:"CommentDisplay__HeaderMetadata",componentId:"sc-el7c23-1"})(templateObject_2$11||(templateObject_2$11=__makeTemplateObject(["\n flex: 1;\n box-sizing: border-box;\n font-size: ","px;\n padding-left: ","px;\n max-width: calc(100% - ","px - ","px);\n"],["\n flex: 1;\n box-sizing: border-box;\n font-size: ","px;\n padding-left: ","px;\n max-width: calc(100% - ","px - ","px);\n"])),fontSizeSmall,paddingLeft$1,avatarWidth$1,maxButtonsWidth$1);var CommentDisplayName=_styled.div.withConfig({displayName:"CommentDisplay__CommentDisplayName",componentId:"sc-el7c23-2"})(templateObject_3$I||(templateObject_3$I=__makeTemplateObject(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"])));var StyledPersonaCard$1=_styled(PersonaCard).withConfig({displayName:"CommentDisplay__StyledPersonaCard",componentId:"sc-el7c23-3"})(templateObject_4$t||(templateObject_4$t=__makeTemplateObject(["\n && {\n max-width: 100%;\n .ms-Button {\n width: 100%;\n }\n .ms-Button-textContainer {\n width: 100%;\n }\n\n .ms-Button-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"],["\n && {\n max-width: 100%;\n .ms-Button {\n width: 100%;\n }\n .ms-Button-textContainer {\n width: 100%;\n }\n\n .ms-Button-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"])));var CommentDateTime=_styled(DateTime).withConfig({displayName:"CommentDisplay__CommentDateTime",componentId:"sc-el7c23-4"})(templateObject_5$q||(templateObject_5$q=__makeTemplateObject(["\n font-size: 12px;\n"],["\n font-size: 12px;\n"])));var Buttons$1=_styled.div.withConfig({displayName:"CommentDisplay__Buttons",componentId:"sc-el7c23-5"})(templateObject_6$g||(templateObject_6$g=__makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: auto;\n\n button {\n height: auto;\n min-height: ","px; /* icons have a font-size of 20px */\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: auto;\n\n button {\n height: auto;\n min-height: ","px; /* icons have a font-size of 20px */\n }\n"])),fontSizeLarge);var Body=_styled.div.withConfig({displayName:"CommentDisplay__Body",componentId:"sc-el7c23-6"})(templateObject_7$b||(templateObject_7$b=__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n"],["\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n"])));var Content$4=_styled.div.withConfig({displayName:"CommentDisplay__Content",componentId:"sc-el7c23-7"})(templateObject_8$a||(templateObject_8$a=__makeTemplateObject(["\n padding-top: ","px;\n flex: 1 1 auto;\n a {\n font-weight: bold;\n &:hover,\n &:active {\n text-decoration: underline;\n }\n }\n"],["\n padding-top: ","px;\n flex: 1 1 auto;\n a {\n font-weight: bold;\n &:hover,\n &:active {\n text-decoration: underline;\n }\n }\n"])),spacingXs);var Container$1=_styled.div.withConfig({displayName:"CommentDisplay__Container",componentId:"sc-el7c23-8"})(templateObject_10$7||(templateObject_10$7=__makeTemplateObject(["\n padding-bottom: 15px;\n font-size: ","px;\n line-height: ","px;\n\n ","\n"],["\n padding-bottom: 15px;\n font-size: ","px;\n line-height: ","px;\n\n ","\n"])),fontSizeSmall,spacingM,function(p){return p.highlight&&css$2(templateObject_9$8||(templateObject_9$8=__makeTemplateObject(["\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n top: -","px;\n bottom: 0;\n right: -","px;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "],["\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n top: -","px;\n bottom: 0;\n right: -","px;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "])),postsSectionPadding,postsSectionPadding,spacingXs,function(p){return p.theme.palette.accent;});});var CommentUser=_styled(PersonaCard).withConfig({displayName:"CommentDisplay__CommentUser",componentId:"sc-el7c23-9"})(templateObject_11$3||(templateObject_11$3=__makeTemplateObject(["\n align-self: flex-start;\n"],["\n align-self: flex-start;\n"])));var StyledEditCommentWithAttachments=_styled(EditCommentWithAttachments).withConfig({displayName:"CommentDisplay__StyledEditCommentWithAttachments",componentId:"sc-el7c23-10"})(templateObject_12$2$1||(templateObject_12$2$1=__makeTemplateObject(["\n width: 100%;\n position: relative;\n"],["\n width: 100%;\n position: relative;\n"])));var StyledImagesAndFilesList$1=_styled(ImagesAndFilesList).withConfig({displayName:"CommentDisplay__StyledImagesAndFilesList",componentId:"sc-el7c23-11"})(templateObject_13$2$1||(templateObject_13$2$1=__makeTemplateObject(["\n margin-top: ","px;\n\n && [data-preload-video='true'] video {\n background-color: ",";\n }\n"],["\n margin-top: ","px;\n\n && [data-preload-video='true'] video {\n background-color: ",";\n }\n"])),spacingM,function(p){return p.theme.palette.white;});var FeedbackButtonStyle=css$2(templateObject_14$2$1||(templateObject_14$2$1=__makeTemplateObject(["\n min-width: auto;\n padding: 0 4px;\n\n && {\n margin-right: 0;\n }\n\n i {\n font-size: ","px;\n height: ","px;\n line-height: ","px;\n }\n"],["\n min-width: auto;\n padding: 0 4px;\n\n && {\n margin-right: 0;\n }\n\n i {\n font-size: ","px;\n height: ","px;\n line-height: ","px;\n }\n"])),fontSizeMedium+2,fontSizeMedium+2,fontSizeMedium+2);var StyledLikeButton$1=_styled(LikeButton).withConfig({displayName:"CommentDisplay__StyledLikeButton",componentId:"sc-el7c23-12"})(templateObject_15$2$1||(templateObject_15$2$1=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),FeedbackButtonStyle);var ReplyCountButton=_styled(FeedbackCountButton).withConfig({displayName:"CommentDisplay__ReplyCountButton",componentId:"sc-el7c23-13"})(templateObject_16$2||(templateObject_16$2=__makeTemplateObject(["\n &&& {\n margin-right: ","px;\n }\n ","\n"],["\n &&& {\n margin-right: ","px;\n }\n ","\n"])),spacingS,FeedbackButtonStyle);var templateObject_1$1I,templateObject_2$11,templateObject_3$I,templateObject_4$t,templateObject_5$q,templateObject_6$g,templateObject_7$b,templateObject_8$a,templateObject_9$8,templateObject_10$7,templateObject_11$3,templateObject_12$2$1,templateObject_13$2$1,templateObject_14$2$1,templateObject_15$2$1,templateObject_16$2;var CardStatisticItem=function CardStatisticItem(_a){var count=_a.count,tooltipResourceKey=_a.tooltipResourceKey,icon=_a.icon,ariaLabel=_a.ariaLabel,targetRoute=_a.targetRoute,highlight=_a.highlight,onClick=_a.onClick,className=_a.className,domIdentifier=_a.domIdentifier;var formatMessage=useIntl().formatMessage;return jsx$1(Tooltip,__assign({resourceKey:tooltipResourceKey,values:{count:count},className:className},{children:onClick?jsx$1(StatisticButton,__assign({"data-statistic-button":domIdentifier,iconProps:{iconName:icon},onClick:onClick,"aria-label":formatMessage({id:ariaLabel})},{children:count>0&&jsx$1(StatisticCount,__assign({"aria-hidden":"true"},{children:count}),void 0)}),void 0):jsxs(StatisticLink,__assign({to:targetRoute,"aria-label":formatMessage({id:ariaLabel})},{children:[jsx$1(StatisticIcon,{iconName:icon,highlight:highlight},void 0),count>0&&jsx$1(StatisticCount,__assign({"aria-hidden":"true"},{children:count}),void 0)]}),void 0)}),void 0);};var StatisticLink=_styled(NavLink).withConfig({displayName:"CardStatisticItem__StatisticLink",componentId:"sc-1ll8iv5-0"})(templateObject_1$1H||(templateObject_1$1H=__makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n color: ",";\n height: ","px;\n"],["\n display: inline-flex;\n align-items: center;\n color: ",";\n height: ","px;\n"])),function(p){return p.theme.textColors.default;},feedbackButtonHeight);var StatisticButton=_styled(IconButton).withConfig({displayName:"CardStatisticItem__StatisticButton",componentId:"sc-1ll8iv5-1"})(templateObject_2$10||(templateObject_2$10=__makeTemplateObject(["\n && {\n width: auto;\n margin: 0;\n padding: 0;\n\n i {\n font-size: ","px;\n }\n }\n"],["\n && {\n width: auto;\n margin: 0;\n padding: 0;\n\n i {\n font-size: ","px;\n }\n }\n"])),fontSizeLarge-3);var StatisticIcon=_styled(Icon).withConfig({displayName:"CardStatisticItem__StatisticIcon",componentId:"sc-1ll8iv5-2"})(templateObject_3$H||(templateObject_3$H=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),function(p){return p.highlight&&unreadCommentHighlight;});var StatisticCount=_styled.span.withConfig({displayName:"CardStatisticItem__StatisticCount",componentId:"sc-1ll8iv5-3"})(templateObject_4$s||(templateObject_4$s=__makeTemplateObject(["\n flex: 1 0 auto;\n padding-left: 5px;\n font-size: 0.9rem;\n"],["\n flex: 1 0 auto;\n padding-left: 5px;\n font-size: 0.9rem;\n"])));var templateObject_1$1H,templateObject_2$10,templateObject_3$H,templateObject_4$s;var BookmarkButton=function BookmarkButton(_a){var item=_a.item,isReadOnly=_a.isReadOnly,className=_a.className;var formatMessage=useIntl().formatMessage;var refreshStatistics=useNewsApi().refreshStatistics;var toggleBookmark=useManageCurrentUserApi().toggleBookmark;var user=useCurrentUser();var showError=useNotificationContext().showError;var _b=useState$2(isUserBookmarked),isBookmarked=_b[0],setIsBookmarked=_b[1];var _c=useState$2(false),isSaving=_c[0],setIsSaving=_c[1];var itemId=item===null||item===void 0?void 0:item.id;var resourceKey="BookmarkButton."+(isBookmarked?'remove':'add')+"Tooltip";useEffect$1(function(){setIsBookmarked(isUserBookmarked());// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132289
|
-
},[itemId]);return jsx$1(Tooltip,__assign({className:className,resourceKey:resourceKey},{children:jsx$1(StyledIconButton$5,{iconProps:{iconName:isBookmarked?'SingleBookmarkSolid':'SingleBookmark'},"data-bookmark-button":itemId,onClick:toggle,"aria-label":formatMessage({id:resourceKey}),disabled:isReadOnly},void 0)}),void 0);function isUserBookmarked(){var _a;return (_a=user.bookmarks)===null||_a===void 0?void 0:_a.some(function(id){return id===(item===null||item===void 0?void 0:item.id);});}function toggle(e){return __awaiter(this,void 0,void 0,function(){var isNowBookmarked;return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();e.stopPropagation();if(isSaving){return [2/*return*/];}setIsSaving(true);isNowBookmarked=!isBookmarked;setIsBookmarked(isNowBookmarked);_a.label=1;case 1:_a.trys.push([1,4,5,6]);return [4/*yield*/,toggleBookmark(itemId,user)];case 2:_a.sent();return [4/*yield*/,refreshStatistics(itemId,{bookmarkCount:isNowBookmarked?1:-1})];case 3:_a.sent();return [3/*break*/,6];case 4:_a.sent();setIsBookmarked(!isNowBookmarked);showError('Profile.bookmarkError');return [3/*break*/,6];case 5:setIsSaving(false);return [7/*endfinally*/];case 6:return [2/*return*/];}});});}};var StyledIconButton$5=_styled(IconButton).withConfig({displayName:"BookmarkButton__StyledIconButton",componentId:"sc-1ni4s3y-0"})(templateObject_1$1G||(templateObject_1$1G=__makeTemplateObject(["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"],["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"])));var templateObject_1$1G;var CardFooter=function CardFooter(_a){var item=_a.item,showComments=_a.showComments,targetRoute=_a.targetRoute;var metadata=item.metadata||{};var user=useCurrentUser();var showCommentsIcon=showComments&&item.statistics&&item.statistics.commentCount>0&&hasFeedbackType(metadata.feedbackSettings,'comment');return jsx$1(CardFooterHost,{children:jsxs(FooterRightSection,{children:[
|
|
132289
|
+
},[itemId]);return jsx$1(Tooltip,__assign({className:className,resourceKey:resourceKey},{children:jsx$1(StyledIconButton$5,{iconProps:{iconName:isBookmarked?'SingleBookmarkSolid':'SingleBookmark'},"data-bookmark-button":itemId,onClick:toggle,"aria-label":formatMessage({id:resourceKey}),disabled:isReadOnly},void 0)}),void 0);function isUserBookmarked(){var _a;return (_a=user.bookmarks)===null||_a===void 0?void 0:_a.some(function(id){return id===(item===null||item===void 0?void 0:item.id);});}function toggle(e){return __awaiter(this,void 0,void 0,function(){var isNowBookmarked;return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();e.stopPropagation();if(isSaving){return [2/*return*/];}setIsSaving(true);isNowBookmarked=!isBookmarked;setIsBookmarked(isNowBookmarked);_a.label=1;case 1:_a.trys.push([1,4,5,6]);return [4/*yield*/,toggleBookmark(itemId,user)];case 2:_a.sent();return [4/*yield*/,refreshStatistics(itemId,{bookmarkCount:isNowBookmarked?1:-1})];case 3:_a.sent();return [3/*break*/,6];case 4:_a.sent();setIsBookmarked(!isNowBookmarked);showError('Profile.bookmarkError');return [3/*break*/,6];case 5:setIsSaving(false);return [7/*endfinally*/];case 6:return [2/*return*/];}});});}};var StyledIconButton$5=_styled(IconButton).withConfig({displayName:"BookmarkButton__StyledIconButton",componentId:"sc-1ni4s3y-0"})(templateObject_1$1G||(templateObject_1$1G=__makeTemplateObject(["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"],["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"])));var templateObject_1$1G;var CardFooter=function CardFooter(_a){var item=_a.item,showComments=_a.showComments,targetRoute=_a.targetRoute;var metadata=item.metadata||{};var user=useCurrentUser();var showCommentsIcon=showComments&&item.statistics&&item.statistics.commentCount>0&&hasFeedbackType(metadata.feedbackSettings,'comment');return jsx$1(CardFooterHost,{children:jsxs(FooterRightSection,{children:[jsx$1(CardLikeButton,{item:item,itemResourceType:ItemResourceTypes.News},void 0),!user.isPublicUser&&showCommentsIcon&&jsx$1(CardStatisticItem,{count:item.statistics.commentCount,tooltipResourceKey:"NewsArticle.numberOfComments",icon:"Chat",targetRoute:targetRoute+"#comments",highlight:item.hasNewComments,ariaLabel:"AriaLabel.commentsButton"},void 0),jsx$1(BookmarkButton,{item:item},void 0)]},void 0)},void 0);};var CardFooterHost=_styled.footer.withConfig({displayName:"CardFooter__CardFooterHost",componentId:"sc-8sbpem-0"})(templateObject_1$1F||(templateObject_1$1F=__makeTemplateObject(["\n display: flex;\n margin-top: auto;\n margin-bottom: -4px;\n flex-direction: row;\n justify-content: space-between;\n\n padding-top: ","px;\n\n font-size: ","px;\n\n > div {\n display: flex;\n }\n\n a,\n button {\n position: relative;\n z-index: 1;\n }\n"],["\n display: flex;\n margin-top: auto;\n margin-bottom: -4px;\n flex-direction: row;\n justify-content: space-between;\n\n padding-top: ","px;\n\n font-size: ","px;\n\n > div {\n display: flex;\n }\n\n a,\n button {\n position: relative;\n z-index: 1;\n }\n"])),spacingM,fontSizeMedium+4);var FooterRightSection=_styled.div.withConfig({displayName:"CardFooter__FooterRightSection",componentId:"sc-8sbpem-1"})(templateObject_2$$||(templateObject_2$$=__makeTemplateObject(["\n .ms-TooltipHost {\n display: flex;\n align-items: center;\n }\n\n flex: 1 0 ","px;\n justify-content: flex-end;\n > * {\n margin-left: ","px;\n }\n"],["\n .ms-TooltipHost {\n display: flex;\n align-items: center;\n }\n\n flex: 1 0 ","px;\n justify-content: flex-end;\n > * {\n margin-left: ","px;\n }\n"])),spacingXl,spacingS+5);var templateObject_1$1F,templateObject_2$$;var DetailViewContextProvider=function DetailViewContextProvider(_a){var itemId=_a.itemId,type=_a.type,loadItemFunc=_a.loadItemFunc,isEditorPreview=_a.isEditorPreview,children=_a.children;var user=useCurrentUserContext().user;var handleFatalError=useContext(ErrorContext).handleFatalError;var translateContents=useTranslateApi().translateContents;var _b=useState$2(),item=_b[0],setItem=_b[1];var _c=useState$2(),originalItem=_c[0],setOriginalItem=_c[1];var _d=useState$2(),selectedLanguage=_d[0],setSelectedLanguage=_d[1];var _e=useState$2(false),hasError=_e[0],setHasError=_e[1];var _f=useState$2(true),isLoading=_f[0],setIsLoading=_f[1];var _g=useState$2(false),showAccessDenied=_g[0],setShowAccessDenied=_g[1];var handleAccessDeniedError=useContext(ErrorContext).handleAccessDeniedError;var isValid=true;useEffect$1(function(){refreshItem();return function(){// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132290
132290
|
isValid=false;};},[itemId]);if(showAccessDenied){handleAccessDeniedError({});return null;}var activeLanguages=NewsService.getItemContentLanguages(originalItem,user.subscription.languages);return jsx$1(DetailViewContext.Provider,__assign({value:getContextValues()},{children:children}),void 0);function getContextValues(){return {isLoading:isLoading,hasError:hasError,resourceType:type,item:item,itemId:itemId,contentLanguage:selectedLanguage===null||selectedLanguage===void 0?void 0:selectedLanguage.lang,userPreferredLanguage:(selectedLanguage===null||selectedLanguage===void 0?void 0:selectedLanguage.isUserSet)?selectedLanguage.lang:getPreferredContentLanguage(user),activeLanguages:activeLanguages,content:item&&selectedLanguage?item.contents[selectedLanguage.lang]:null,updateSelectedLanguage:function(l){return setSelectedLanguage({lang:l,isUserSet:true});},handleRefresh:handleRefresh,handleLanguageChange:handleLanguageChange,isEditorPreview:isEditorPreview};}function handleRefresh(onFinished){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,refreshItem()];case 1:_a.sent();onFinished&&onFinished();return [2/*return*/];}});});}function refreshItem(){return __awaiter(this,void 0,void 0,function(){var p,selectedLanguage_1,err_1;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,2,3,4]);return [4/*yield*/,loadItemFunc(itemId)];case 1:p=_a.sent();selectedLanguage_1=NewsService.getLanguageForPublishableItem(p,user);if(isValid){setItem(p);setOriginalItem(p);setSelectedLanguage({isUserSet:false,lang:selectedLanguage_1});setHasError(false);}return [3/*break*/,4];case 2:err_1=_a.sent();if(err_1&&err_1.response&&err_1.response.statusCode===404){if(isValid){setItem(null);setSelectedLanguage(null);setHasError(true);}}else if(err_1&&err_1.response&&err_1.response.statusCode===403){setShowAccessDenied(true);}else {logger.error(err_1);handleFatalError({error:err_1,messageId:'Generic.error'});}return [3/*break*/,4];case 3:isValid&&setIsLoading(false);return [7/*endfinally*/];case 4:return [2/*return*/];}});});}function handleLanguageChange(language){return __awaiter(this,void 0,void 0,function(){var content;var _a;return __generator(this,function(_b){switch(_b.label){case 0:if(item.contents[language]){setSelectedLanguage({isUserSet:true,lang:language});return [2/*return*/];}return [4/*yield*/,translateContents(type,itemId,language)];case 1:content=_b.sent();setItem(__assign(__assign({},item),{contents:__assign(__assign({},item.contents),(_a={},_a[language]=content,_a))}));setSelectedLanguage({isUserSet:true,lang:language});return [2/*return*/];}});});}};var EntityType;(function(EntityType){EntityType["Video"]="video";EntityType["Image"]="image";EntityType["File"]="file";EntityType["Quote"]="quote";EntityType["InlineCode"]="inline-code";EntityType["Gallery"]="gallery";EntityType["Table"]="table";EntityType["Contact"]="contact";EntityType["InlinePageList"]="inline-page-list";EntityType["UrlPreview"]="url-preview";})(EntityType||(EntityType={}));var TextViewer=function TextViewer(_a){var html=_a.html,componentMappers=_a.componentMappers;var _b=useState$2(null),editorState=_b[0],setEditorState=_b[1];useEffect$1(function(){setEditorState(getInitialEditorState());// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132291
132291
|
},[html]);if(!editorState){return null;}var currentContent=editorState.getCurrentContent();return jsx$1(Draft$1.Editor,{readOnly:true,editorState:editorState,onChange:function(){return null;},blockRendererFn:blockRenderer,blockStyleFn:blockStyle,blockRenderMap:headingRenderMap},void 0);function blockStyle(block){var type=block.getType();if(type==='unstyled'){return 'paragraph';}return null;}function blockRenderer(block){if(block.getType()!=='atomic'){return null;}var entityKey=block.getEntityAt(0);if(entityKey==null){return null;}var entity=currentContent.getEntity(entityKey);var handler=componentMappers.find(function(h){return h.type===entity.getType();});if(handler!=null){return {component:handler.component,editable:false,props:__assign({},entity.getData())};}return null;}function getInitialEditorState(){var contentState=convertFromHTML$1({htmlToEntity:convertHtmlToEntity,htmlToBlock:createHtmlToBlockConverter(componentMappers)})(html||'');return Draft$1.EditorState.createWithContent(contentState,decorator);}function convertHtmlToEntity(nodeName,node,createEntity){for(var _i=0,componentMappers_1=componentMappers;_i<componentMappers_1.length;_i++){var handler=componentMappers_1[_i];var match=handler.getPropsFromHtml(nodeName,node);if(match){return createEntity(handler.type,'IMMUTABLE',match);}}if(nodeName==='a'){return createEntity('LINK','MUTABLE',{url:node.getAttribute('href')});}return null;}};var Link$2=function Link(_a){var contentState=_a.contentState,entityKey=_a.entityKey,children=_a.children;var url=contentState.getEntity(entityKey).getData().url;return jsx$1(TextLink,__assign({url:url},{children:children}),void 0);};function findLinkEntities(contentBlock,callback,contentState){contentBlock.findEntityRanges(function(character){var entityKey=character.getEntity();return entityKey!==null&&contentState.getEntity(entityKey).getType()==='LINK';},callback);}var decorator=new Draft$1.CompositeDecorator([{strategy:findLinkEntities,component:Link$2}]);function createHtmlToBlockConverter(componentMappers){var componentMapperParentNodes=[];return function(nodeName,node){// note (sl): draftJS does call this for all root elements AND
|
|
132292
132292
|
// their children. We only want to handle an element,
|
|
@@ -132522,18 +132522,11 @@ var NewsDetailMainContent = function NewsDetailMainContent(_a) {
|
|
|
132522
132522
|
var hideComments = _a.hideComments,
|
|
132523
132523
|
hideLikes = _a.hideLikes;
|
|
132524
132524
|
var item = useDetailViewContext().item;
|
|
132525
|
-
|
|
132526
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132527
|
-
return jsxs(DetailMainSection, {
|
|
132528
|
-
children: [jsx$1(DetailViewHeadline, {}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(NewsDetailViewMetaInfo, {}, void 0), jsx$1(DetailViewBodyExternalContent, {
|
|
132529
|
-
itemType: ItemResourceTypes.News
|
|
132530
|
-
}, void 0)]
|
|
132531
|
-
}, void 0);
|
|
132532
|
-
}
|
|
132533
|
-
|
|
132534
132525
|
return jsxs(Fragment, {
|
|
132535
132526
|
children: [jsxs(DetailMainSection, {
|
|
132536
|
-
children: [jsx$1(DetailViewHeadline, {}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(NewsDetailViewMetaInfo, {}, void 0),
|
|
132527
|
+
children: [jsx$1(DetailViewHeadline, {}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(NewsDetailViewMetaInfo, {}, void 0), (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsx$1(DetailViewBodyExternalContent, {
|
|
132528
|
+
itemType: ItemResourceTypes.News
|
|
132529
|
+
}, void 0) : jsx$1(DetailViewBody, {}, void 0), jsx$1(DetailViewKeywords, {
|
|
132537
132530
|
filterBaseUrl: null
|
|
132538
132531
|
}, void 0)]
|
|
132539
132532
|
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0), jsx$1(NewsDetailViewFeedbackSection, {
|
|
@@ -133019,20 +133012,12 @@ var PageDetailInternal = function PageDetailInternal(_a) {
|
|
|
133019
133012
|
}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(PageDetailViewMetaInfo, {}, void 0)]
|
|
133020
133013
|
}, void 0);
|
|
133021
133014
|
|
|
133022
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
133023
|
-
return jsxs(Fragment, {
|
|
133024
|
-
children: [jsxs(DetailMainSection, {
|
|
133025
|
-
children: [Header, jsx$1(DetailViewBodyExternalContent, {
|
|
133026
|
-
itemType: ItemResourceTypes.Pages
|
|
133027
|
-
}, void 0), jsx$1(PagesDetailViewNavigationWrapper, {}, void 0)]
|
|
133028
|
-
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0)]
|
|
133029
|
-
}, void 0);
|
|
133030
|
-
}
|
|
133031
|
-
|
|
133032
133015
|
var isDocument = (item === null || item === void 0 ? void 0 : item.pageType) === PageType.Document;
|
|
133033
133016
|
return jsxs(Fragment, {
|
|
133034
133017
|
children: [jsxs(DetailMainSection, {
|
|
133035
|
-
children: [Header,
|
|
133018
|
+
children: [Header, isDocument ? jsx$1(DetailViewPageDocumentDownload, {}, void 0) : (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsx$1(DetailViewBodyExternalContent, {
|
|
133019
|
+
itemType: ItemResourceTypes.Pages
|
|
133020
|
+
}, void 0) : jsx$1(DetailViewBody, {}, void 0), jsx$1(InlinePageListWrapper, {}, void 0), jsx$1(PagesDetailViewNavigationWrapper, {}, void 0), jsx$1(DetailViewKeywords, {
|
|
133036
133021
|
filterBaseUrl: null
|
|
133037
133022
|
}, void 0)]
|
|
133038
133023
|
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0), jsx$1(PageDetailViewFeedbackSection, {
|
|
@@ -133681,34 +133666,32 @@ var NewsListInternal = function NewsListInternal(_a) {
|
|
|
133681
133666
|
onChannelClick: onChannelClick,
|
|
133682
133667
|
onKeywordClick: onKeywordClick,
|
|
133683
133668
|
buttons: jsxs(Fragment, {
|
|
133684
|
-
children: [
|
|
133685
|
-
|
|
133686
|
-
|
|
133687
|
-
|
|
133688
|
-
|
|
133689
|
-
|
|
133690
|
-
|
|
133691
|
-
|
|
133692
|
-
|
|
133693
|
-
|
|
133669
|
+
children: [jsx$1(CardLikeButton, {
|
|
133670
|
+
item: item,
|
|
133671
|
+
itemResourceType: ItemResourceTypes.News
|
|
133672
|
+
}, void 0), showComments && jsx$1(Tooltip, __assign$g({
|
|
133673
|
+
resourceKey: "NewsArticle.numberOfComments",
|
|
133674
|
+
values: {
|
|
133675
|
+
count: commentsCount
|
|
133676
|
+
},
|
|
133677
|
+
className: className
|
|
133678
|
+
}, {
|
|
133679
|
+
children: jsxs(Comments, __assign$g({
|
|
133680
|
+
href: "" + webAppUrl + targetRoute,
|
|
133681
|
+
target: "_blank",
|
|
133682
|
+
rel: "noopener noreferrer",
|
|
133683
|
+
onClick: function (e) {
|
|
133684
|
+
return handleClick(e, item, false, onItemClick, true);
|
|
133685
|
+
}
|
|
133694
133686
|
}, {
|
|
133695
|
-
children:
|
|
133696
|
-
|
|
133697
|
-
|
|
133698
|
-
|
|
133699
|
-
|
|
133700
|
-
|
|
133701
|
-
|
|
133702
|
-
|
|
133703
|
-
children: [jsx$1(StyledIcon$2, {
|
|
133704
|
-
iconName: "Chat",
|
|
133705
|
-
highlight: item.hasNewComments
|
|
133706
|
-
}, void 0), commentsCount > 0 && jsx$1(CommentsCount, {
|
|
133707
|
-
children: commentsCount
|
|
133708
|
-
}, void 0)]
|
|
133709
|
-
}), void 0)
|
|
133710
|
-
}), void 0)]
|
|
133711
|
-
}, void 0), jsx$1(BookmarkButton, {
|
|
133687
|
+
children: [jsx$1(StyledIcon$2, {
|
|
133688
|
+
iconName: "Chat",
|
|
133689
|
+
highlight: item.hasNewComments
|
|
133690
|
+
}, void 0), commentsCount > 0 && jsx$1(CommentsCount, {
|
|
133691
|
+
children: commentsCount
|
|
133692
|
+
}, void 0)]
|
|
133693
|
+
}), void 0)
|
|
133694
|
+
}), void 0), jsx$1(BookmarkButton, {
|
|
133712
133695
|
item: item
|
|
133713
133696
|
}, void 0)]
|
|
133714
133697
|
}, void 0)
|
package/index.umd.js
CHANGED
|
@@ -87834,9 +87834,9 @@
|
|
|
87834
87834
|
}), void 0);
|
|
87835
87835
|
};
|
|
87836
87836
|
|
|
87837
|
-
var version$1 = "0.3.
|
|
87838
|
-
var buildId = "
|
|
87839
|
-
var commitId = "
|
|
87837
|
+
var version$1 = "0.3.73";
|
|
87838
|
+
var buildId = "101767";
|
|
87839
|
+
var commitId = "2638cc78f2e66e1ce832748f58ede8cfa483600d";
|
|
87840
87840
|
var isCustomerBuild = false;
|
|
87841
87841
|
var buildInfo = {
|
|
87842
87842
|
version: version$1,
|
|
@@ -132160,7 +132160,7 @@
|
|
|
132160
132160
|
// => we should display a retry button on the attachment preview
|
|
132161
132161
|
.then(function(){if(ignoreRef.current){return;}setAttachments(function(attachments){return attachments.map(function(a){return a.id!==newAttachment.id?a:__assign(__assign({},a),{isUploadInProgress:false});});});},function(error){logger.error(error);if(!warningToastHandle.current){warningToastHandle.current=showToastWarning('Attachments.uploadError',undefined,function(){return warningToastHandle.current=null;});}if(ignoreRef.current){return;}setAttachments(function(attachments){return attachments.map(function(a){return a.id!==newAttachment.id?a:__assign(__assign({},a),{hasError:true,isUploadInProgress:false});});});});};for(_i=0,newAttachments_1=newAttachments;_i<newAttachments_1.length;_i++){newAttachment=newAttachments_1[_i];_loop_1(newAttachment);}return [2/*return*/];});});}function clearAttachments(){if(!ignoreRef.current){setAttachments([]);setDeletedAttachmentUrls([]);}}function deleteAttachment(attachment){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,handleAttachmentsAdded(attachments.filter(function(f){return f.id!==attachment.id;}))];case 1:_a.sent();setDeletedAttachmentUrls(__spreadArray(__spreadArray([],deletedAttachmentUrls),[attachment.url]));return [2/*return*/];}});});}function uploadAttachment(basePath,attachment){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){if(attachment.type===AttachmentType.Image){return [2/*return*/,uploadImage(basePath,user.subscription.id,attachment.id,containerId,attachment.file)];}else {return [2/*return*/,uploadFile(basePath,user.subscription.id,attachment.id,containerId,attachment.file)];}});});}}var EditCommentWithAttachments=function EditCommentWithAttachments(props){var user=useCurrentUser();var getImageUrl=useAttachmentsApi().getImageUrl;var _a=useAttachmentUploader(props.item.attachments,props.item.attachmentContainerId,props.basePath),attachments=_a[0],handleAttachmentsAdded=_a[1],deletedAttachmentUrls=_a[3],onDeleteAttachment=_a[4];return jsxRuntime.jsx(EditComment,__assign({},props,{allowSaveWithoutContent:props.allowSaveWithoutContent,saveOnEnter:props.saveOnEnter,saveOnCtrlEnter:props.saveOnCtrlEnter,files:attachments.map(function(a){return __assign(__assign({},a),!isClientAttachment(a)&&{previewUrl:getImageUrl(props.basePath,user.subscription.id,props.item,a.id)});}),allowAttachments:!!props.basePath,onSave:handlePost,onAttachmentAdded:handleAttachmentsAdded,allowKeywords:props.allowKeywords,availableKeywords:props.availableKeywords,mandatoryKeywords:props.mandatoryKeywords,keywords:props.keywords,deletedFileUrls:deletedAttachmentUrls,onDeleteAttachment:onDeleteAttachment}),void 0);function handlePost(newContent,keywords){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,props.onSave(newContent,attachments,keywords)];case 1:_a.sent();return [2/*return*/];}});});}};function isClientAttachment(value){return value.file!=null;}var CommentDisplay=function CommentDisplay(_a){var _b;var type=_a.type,baseAttachmentPath=_a.baseAttachmentPath,message=_a.message,onDelete=_a.onDelete,showDelete=_a.showDelete,showAutoTranslate=_a.showAutoTranslate,showEdit=_a.showEdit,scope=_a.scope,mentionSearchHandler=_a.mentionSearchHandler,getHashtagFilterRoute=_a.getHashtagFilterRoute,highlight=_a.highlight,isInitialLiked=_a.isInitialLiked,onReplyIconClick=_a.onReplyIconClick,onReply=_a.onReply,replyCount=_a.replyCount,readOnly=_a.readOnly,className=_a.className;var _c=useCommentApi(),toggleCommentLike=_c.toggleCommentLike,translateComment=_c.translateComment,updateComment=_c.updateComment;var formatMessage=useIntl().formatMessage;var _d=useNotificationContext(),showToast=_d.showToast,showError=_d.showError;var _e=React$d.useState(false),isEditMode=_e[0],setIsEditMode=_e[1];var _f=React$d.useState(message.content),content=_f[0],setContent=_f[1];var _g=React$d.useState(message.attachments),attachments=_g[0],setAttachments=_g[1];var _h=React$d.useState(message.modified),modifiedTime=_h[0],setModifiedTime=_h[1];var _j=React$d.useState(message.content),originalContent=_j[0],setOriginalContent=_j[1];var _k=React$d.useState(isInitialLiked),isLiked=_k[0],setIsLiked=_k[1];var _l=React$d.useState(((_b=message.statistics)===null||_b===void 0?void 0:_b.likeCount)||0),likeCounter=_l[0],setLikeCounter=_l[1];var features=useFeatures();var palette=React$d.useContext(ThemeContext$1).theme.palette;var hasContent=content.length>0;message=__assign(__assign({},message),{attachments:attachments});return jsxRuntime.jsxs(Container$1,__assign({className:className,"data-comment-id":message.id,"data-has-auto-translate":showAutoTranslate,"data-can-edit":showEdit,"data-can-delete":showDelete,"data-show-highlight":highlight,highlight:highlight,id:"Comment-"+message.id},{children:[jsxRuntime.jsxs(Header$1,{children:[jsxRuntime.jsx(CommentUser,__assign({upn:message.sender.userPrincipalName,domIdentifier:"avatar"},{children:jsxRuntime.jsx(Avatar,{upn:message.sender.userPrincipalName,text:message.sender.displayName,size:officeUiFabricReact.PersonaSize.small,hidePersonaDetails:true},void 0)}),void 0),jsxRuntime.jsxs(HeaderMetadata$1,{children:[jsxRuntime.jsx(CommentDisplayName,{children:jsxRuntime.jsx(StyledPersonaCard$1,__assign({upn:message.sender.userPrincipalName},{children:message.sender.displayName}),void 0)},void 0),jsxRuntime.jsx(CommentDateTime,{className:"ms-fontColor-neutralTertiary",value:message.receivedDateTime},void 0),jsxRuntime.jsx(Modified,{modified:modifiedTime},void 0)]},void 0),message.id&&jsxRuntime.jsxs(Buttons$1,{children:[features.replyToComments&&replyCount>0&&jsxRuntime.jsx(ReplyCountButton,{tooltipResourceKey:"Comment.numberOfReplies",tooltipResourceKeyValues:{count:replyCount},ariaLabel:formatMessage({id:onReplyIconClick?'AriaLabel.commentsButton':'AriaLabel.repliesButton'}),iconName:"Chat",count:replyCount,feedbackType:"comment",onClick:onReplyIconClick!==null&&onReplyIconClick!==void 0?onReplyIconClick:onReply?function(){return onReply(message.id);}:null,highlight:message.hasUnreadReplies,readOnly:readOnly},void 0),jsxRuntime.jsx(StyledLikeButton$1,{itemId:message.id,itemType:ItemResourceTypes.Comments,count:likeCounter,isActive:isLiked,onClick:function(){return handleLike(!isLiked);},doNotRenderZeroCount:true,isDemoContent:message.isDemoContent,readOnly:readOnly},void 0),jsxRuntime.jsx(CommentActionMenu,{comment:message,showEdit:showEdit,onDelete:onDelete,showDelete:showDelete,isEditMode:isEditMode,toggleEditMode:setIsEditMode,originalContent:originalContent,currentContent:content,setContent:setContent,handleTranslate:handleTranslate,showAutoTranslate:showAutoTranslate,onReply:onReply,disabled:readOnly},void 0)]},void 0)]},void 0),jsxRuntime.jsxs(Body,{children:[isEditMode&&jsxRuntime.jsx(StyledEditCommentWithAttachments,{content:content,mentionSearchHandler:mentionSearchHandler,onSave:handleSaveComment,onCancel:function(){return setIsEditMode(false);},basePath:baseAttachmentPath,item:message,allowSaveWithoutContent:true,saveOnCtrlEnter:true},void 0),!isEditMode&&hasContent&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Content$4,__assign({"data-comment-content":message.id},{children:jsxRuntime.jsx(ContentDisplay,{content:content,handlers:[ContentDisplayHandler.LineBreak,ContentDisplayHandler.Link,ContentDisplayHandler.Mention,ContentDisplayHandler.Hashtag],getHashtagRoute:getHashtagFilterRoute},void 0)}),void 0)},void 0)]},void 0),!isEditMode&&(attachments===null||attachments===void 0?void 0:attachments.length)>0&&jsxRuntime.jsxs("div",__assign({"data-mixed-attachment-list":true},{children:[jsxRuntime.jsx(GifList,{attachments:message.attachments},void 0),jsxRuntime.jsx(StyledImagesAndFilesList$1,{item:message,basePath:baseAttachmentPath,imagesGridBackgroundColor:palette.white},void 0),jsxRuntime.jsx(VideoList,{attachments:message.attachments},void 0),jsxRuntime.jsx(EmbeddedObjectList,{attachments:message.attachments},void 0)]}),void 0)]}),void 0);function handleLike(newIsLiked){return __awaiter(this,void 0,void 0,function(){var oldCounter,error_1;return __generator(this,function(_a){switch(_a.label){case 0:oldCounter=likeCounter;_a.label=1;case 1:_a.trys.push([1,3,,4]);setIsLiked(newIsLiked);setLikeCounter(newIsLiked?oldCounter+1:oldCounter-1);return [4/*yield*/,toggleCommentLike(message.id,newIsLiked)];case 2:_a.sent();return [3/*break*/,4];case 3:error_1=_a.sent();setIsLiked(!newIsLiked);setLikeCounter(oldCounter);logger.error(error_1);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}function handleSaveComment(newContent,newAttachments){return __awaiter(this,void 0,void 0,function(){var error_2;return __generator(this,function(_a){switch(_a.label){case 0:setContent(newContent);setAttachments(newAttachments);setIsEditMode(false);setModifiedTime(new Date().toISOString());setOriginalContent(newContent);_a.label=1;case 1:_a.trys.push([1,3,,4]);return [4/*yield*/,updateComment(scope,message.parentItemId,message.id,newContent,newAttachments,type)];case 2:_a.sent();showToast('Comment.successfullyUpdated');return [3/*break*/,4];case 3:error_2=_a.sent();logger.error(error_2);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}function handleTranslate(preferredContentLanguageCode){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_b){switch(_b.label){case 0:_b.trys.push([0,2,,3]);return [4/*yield*/,translateComment(type,scope,message.parentItemId,message.id,preferredContentLanguageCode)];case 1:return [2/*return*/,_b.sent()];case 2:_b.sent();showError('Generic.error');return [2/*return*/,null];case 3:return [2/*return*/];}});});}};var Header$1=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__Header",componentId:"sc-el7c23-0"})(templateObject_1$1I||(templateObject_1$1I=__makeTemplateObject(["\n display: flex;\n align-items: center;\n"],["\n display: flex;\n align-items: center;\n"])));var avatarWidth$1=40;var maxButtonsWidth$1=125;// max 3 buttons (menu button, replies, like)
|
|
132162
132162
|
var paddingLeft$1=spacingS;var HeaderMetadata$1=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__HeaderMetadata",componentId:"sc-el7c23-1"})(templateObject_2$11||(templateObject_2$11=__makeTemplateObject(["\n flex: 1;\n box-sizing: border-box;\n font-size: ","px;\n padding-left: ","px;\n max-width: calc(100% - ","px - ","px);\n"],["\n flex: 1;\n box-sizing: border-box;\n font-size: ","px;\n padding-left: ","px;\n max-width: calc(100% - ","px - ","px);\n"])),fontSizeSmall,paddingLeft$1,avatarWidth$1,maxButtonsWidth$1);var CommentDisplayName=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__CommentDisplayName",componentId:"sc-el7c23-2"})(templateObject_3$I||(templateObject_3$I=__makeTemplateObject(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"])));var StyledPersonaCard$1=_styled__default["default"](PersonaCard).withConfig({displayName:"CommentDisplay__StyledPersonaCard",componentId:"sc-el7c23-3"})(templateObject_4$t||(templateObject_4$t=__makeTemplateObject(["\n && {\n max-width: 100%;\n .ms-Button {\n width: 100%;\n }\n .ms-Button-textContainer {\n width: 100%;\n }\n\n .ms-Button-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"],["\n && {\n max-width: 100%;\n .ms-Button {\n width: 100%;\n }\n .ms-Button-textContainer {\n width: 100%;\n }\n\n .ms-Button-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n"])));var CommentDateTime=_styled__default["default"](DateTime).withConfig({displayName:"CommentDisplay__CommentDateTime",componentId:"sc-el7c23-4"})(templateObject_5$q||(templateObject_5$q=__makeTemplateObject(["\n font-size: 12px;\n"],["\n font-size: 12px;\n"])));var Buttons$1=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__Buttons",componentId:"sc-el7c23-5"})(templateObject_6$g||(templateObject_6$g=__makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: auto;\n\n button {\n height: auto;\n min-height: ","px; /* icons have a font-size of 20px */\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: auto;\n\n button {\n height: auto;\n min-height: ","px; /* icons have a font-size of 20px */\n }\n"])),fontSizeLarge);var Body=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__Body",componentId:"sc-el7c23-6"})(templateObject_7$b||(templateObject_7$b=__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n"],["\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n"])));var Content$4=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__Content",componentId:"sc-el7c23-7"})(templateObject_8$a||(templateObject_8$a=__makeTemplateObject(["\n padding-top: ","px;\n flex: 1 1 auto;\n a {\n font-weight: bold;\n &:hover,\n &:active {\n text-decoration: underline;\n }\n }\n"],["\n padding-top: ","px;\n flex: 1 1 auto;\n a {\n font-weight: bold;\n &:hover,\n &:active {\n text-decoration: underline;\n }\n }\n"])),spacingXs);var Container$1=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__Container",componentId:"sc-el7c23-8"})(templateObject_10$7||(templateObject_10$7=__makeTemplateObject(["\n padding-bottom: 15px;\n font-size: ","px;\n line-height: ","px;\n\n ","\n"],["\n padding-bottom: 15px;\n font-size: ","px;\n line-height: ","px;\n\n ","\n"])),fontSizeSmall,spacingM,function(p){return p.highlight&&_styled.css(templateObject_9$8||(templateObject_9$8=__makeTemplateObject(["\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n top: -","px;\n bottom: 0;\n right: -","px;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "],["\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n top: -","px;\n bottom: 0;\n right: -","px;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "])),postsSectionPadding,postsSectionPadding,spacingXs,function(p){return p.theme.palette.accent;});});var CommentUser=_styled__default["default"](PersonaCard).withConfig({displayName:"CommentDisplay__CommentUser",componentId:"sc-el7c23-9"})(templateObject_11$3||(templateObject_11$3=__makeTemplateObject(["\n align-self: flex-start;\n"],["\n align-self: flex-start;\n"])));var StyledEditCommentWithAttachments=_styled__default["default"](EditCommentWithAttachments).withConfig({displayName:"CommentDisplay__StyledEditCommentWithAttachments",componentId:"sc-el7c23-10"})(templateObject_12$2$1||(templateObject_12$2$1=__makeTemplateObject(["\n width: 100%;\n position: relative;\n"],["\n width: 100%;\n position: relative;\n"])));var StyledImagesAndFilesList$1=_styled__default["default"](ImagesAndFilesList).withConfig({displayName:"CommentDisplay__StyledImagesAndFilesList",componentId:"sc-el7c23-11"})(templateObject_13$2$1||(templateObject_13$2$1=__makeTemplateObject(["\n margin-top: ","px;\n\n && [data-preload-video='true'] video {\n background-color: ",";\n }\n"],["\n margin-top: ","px;\n\n && [data-preload-video='true'] video {\n background-color: ",";\n }\n"])),spacingM,function(p){return p.theme.palette.white;});var FeedbackButtonStyle=_styled.css(templateObject_14$2$1||(templateObject_14$2$1=__makeTemplateObject(["\n min-width: auto;\n padding: 0 4px;\n\n && {\n margin-right: 0;\n }\n\n i {\n font-size: ","px;\n height: ","px;\n line-height: ","px;\n }\n"],["\n min-width: auto;\n padding: 0 4px;\n\n && {\n margin-right: 0;\n }\n\n i {\n font-size: ","px;\n height: ","px;\n line-height: ","px;\n }\n"])),fontSizeMedium+2,fontSizeMedium+2,fontSizeMedium+2);var StyledLikeButton$1=_styled__default["default"](LikeButton).withConfig({displayName:"CommentDisplay__StyledLikeButton",componentId:"sc-el7c23-12"})(templateObject_15$2$1||(templateObject_15$2$1=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),FeedbackButtonStyle);var ReplyCountButton=_styled__default["default"](FeedbackCountButton).withConfig({displayName:"CommentDisplay__ReplyCountButton",componentId:"sc-el7c23-13"})(templateObject_16$2||(templateObject_16$2=__makeTemplateObject(["\n &&& {\n margin-right: ","px;\n }\n ","\n"],["\n &&& {\n margin-right: ","px;\n }\n ","\n"])),spacingS,FeedbackButtonStyle);var templateObject_1$1I,templateObject_2$11,templateObject_3$I,templateObject_4$t,templateObject_5$q,templateObject_6$g,templateObject_7$b,templateObject_8$a,templateObject_9$8,templateObject_10$7,templateObject_11$3,templateObject_12$2$1,templateObject_13$2$1,templateObject_14$2$1,templateObject_15$2$1,templateObject_16$2;var CardStatisticItem=function CardStatisticItem(_a){var count=_a.count,tooltipResourceKey=_a.tooltipResourceKey,icon=_a.icon,ariaLabel=_a.ariaLabel,targetRoute=_a.targetRoute,highlight=_a.highlight,onClick=_a.onClick,className=_a.className,domIdentifier=_a.domIdentifier;var formatMessage=useIntl().formatMessage;return jsxRuntime.jsx(Tooltip,__assign({resourceKey:tooltipResourceKey,values:{count:count},className:className},{children:onClick?jsxRuntime.jsx(StatisticButton,__assign({"data-statistic-button":domIdentifier,iconProps:{iconName:icon},onClick:onClick,"aria-label":formatMessage({id:ariaLabel})},{children:count>0&&jsxRuntime.jsx(StatisticCount,__assign({"aria-hidden":"true"},{children:count}),void 0)}),void 0):jsxRuntime.jsxs(StatisticLink,__assign({to:targetRoute,"aria-label":formatMessage({id:ariaLabel})},{children:[jsxRuntime.jsx(StatisticIcon,{iconName:icon,highlight:highlight},void 0),count>0&&jsxRuntime.jsx(StatisticCount,__assign({"aria-hidden":"true"},{children:count}),void 0)]}),void 0)}),void 0);};var StatisticLink=_styled__default["default"](ReactRouterDom.NavLink).withConfig({displayName:"CardStatisticItem__StatisticLink",componentId:"sc-1ll8iv5-0"})(templateObject_1$1H||(templateObject_1$1H=__makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n color: ",";\n height: ","px;\n"],["\n display: inline-flex;\n align-items: center;\n color: ",";\n height: ","px;\n"])),function(p){return p.theme.textColors.default;},feedbackButtonHeight);var StatisticButton=_styled__default["default"](IconButton).withConfig({displayName:"CardStatisticItem__StatisticButton",componentId:"sc-1ll8iv5-1"})(templateObject_2$10||(templateObject_2$10=__makeTemplateObject(["\n && {\n width: auto;\n margin: 0;\n padding: 0;\n\n i {\n font-size: ","px;\n }\n }\n"],["\n && {\n width: auto;\n margin: 0;\n padding: 0;\n\n i {\n font-size: ","px;\n }\n }\n"])),fontSizeLarge-3);var StatisticIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"CardStatisticItem__StatisticIcon",componentId:"sc-1ll8iv5-2"})(templateObject_3$H||(templateObject_3$H=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),function(p){return p.highlight&&unreadCommentHighlight;});var StatisticCount=_styled__default["default"].span.withConfig({displayName:"CardStatisticItem__StatisticCount",componentId:"sc-1ll8iv5-3"})(templateObject_4$s||(templateObject_4$s=__makeTemplateObject(["\n flex: 1 0 auto;\n padding-left: 5px;\n font-size: 0.9rem;\n"],["\n flex: 1 0 auto;\n padding-left: 5px;\n font-size: 0.9rem;\n"])));var templateObject_1$1H,templateObject_2$10,templateObject_3$H,templateObject_4$s;var BookmarkButton=function BookmarkButton(_a){var item=_a.item,isReadOnly=_a.isReadOnly,className=_a.className;var formatMessage=useIntl().formatMessage;var refreshStatistics=useNewsApi().refreshStatistics;var toggleBookmark=useManageCurrentUserApi().toggleBookmark;var user=useCurrentUser();var showError=useNotificationContext().showError;var _b=React$d.useState(isUserBookmarked),isBookmarked=_b[0],setIsBookmarked=_b[1];var _c=React$d.useState(false),isSaving=_c[0],setIsSaving=_c[1];var itemId=item===null||item===void 0?void 0:item.id;var resourceKey="BookmarkButton."+(isBookmarked?'remove':'add')+"Tooltip";React$d.useEffect(function(){setIsBookmarked(isUserBookmarked());// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132163
|
-
},[itemId]);return jsxRuntime.jsx(Tooltip,__assign({className:className,resourceKey:resourceKey},{children:jsxRuntime.jsx(StyledIconButton$5,{iconProps:{iconName:isBookmarked?'SingleBookmarkSolid':'SingleBookmark'},"data-bookmark-button":itemId,onClick:toggle,"aria-label":formatMessage({id:resourceKey}),disabled:isReadOnly},void 0)}),void 0);function isUserBookmarked(){var _a;return (_a=user.bookmarks)===null||_a===void 0?void 0:_a.some(function(id){return id===(item===null||item===void 0?void 0:item.id);});}function toggle(e){return __awaiter(this,void 0,void 0,function(){var isNowBookmarked;return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();e.stopPropagation();if(isSaving){return [2/*return*/];}setIsSaving(true);isNowBookmarked=!isBookmarked;setIsBookmarked(isNowBookmarked);_a.label=1;case 1:_a.trys.push([1,4,5,6]);return [4/*yield*/,toggleBookmark(itemId,user)];case 2:_a.sent();return [4/*yield*/,refreshStatistics(itemId,{bookmarkCount:isNowBookmarked?1:-1})];case 3:_a.sent();return [3/*break*/,6];case 4:_a.sent();setIsBookmarked(!isNowBookmarked);showError('Profile.bookmarkError');return [3/*break*/,6];case 5:setIsSaving(false);return [7/*endfinally*/];case 6:return [2/*return*/];}});});}};var StyledIconButton$5=_styled__default["default"](IconButton).withConfig({displayName:"BookmarkButton__StyledIconButton",componentId:"sc-1ni4s3y-0"})(templateObject_1$1G||(templateObject_1$1G=__makeTemplateObject(["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"],["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"])));var templateObject_1$1G;var CardFooter=function CardFooter(_a){var item=_a.item,showComments=_a.showComments,targetRoute=_a.targetRoute;var metadata=item.metadata||{};var user=useCurrentUser();var showCommentsIcon=showComments&&item.statistics&&item.statistics.commentCount>0&&hasFeedbackType(metadata.feedbackSettings,'comment');return jsxRuntime.jsx(CardFooterHost,{children:jsxRuntime.jsxs(FooterRightSection,{children:[
|
|
132163
|
+
},[itemId]);return jsxRuntime.jsx(Tooltip,__assign({className:className,resourceKey:resourceKey},{children:jsxRuntime.jsx(StyledIconButton$5,{iconProps:{iconName:isBookmarked?'SingleBookmarkSolid':'SingleBookmark'},"data-bookmark-button":itemId,onClick:toggle,"aria-label":formatMessage({id:resourceKey}),disabled:isReadOnly},void 0)}),void 0);function isUserBookmarked(){var _a;return (_a=user.bookmarks)===null||_a===void 0?void 0:_a.some(function(id){return id===(item===null||item===void 0?void 0:item.id);});}function toggle(e){return __awaiter(this,void 0,void 0,function(){var isNowBookmarked;return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();e.stopPropagation();if(isSaving){return [2/*return*/];}setIsSaving(true);isNowBookmarked=!isBookmarked;setIsBookmarked(isNowBookmarked);_a.label=1;case 1:_a.trys.push([1,4,5,6]);return [4/*yield*/,toggleBookmark(itemId,user)];case 2:_a.sent();return [4/*yield*/,refreshStatistics(itemId,{bookmarkCount:isNowBookmarked?1:-1})];case 3:_a.sent();return [3/*break*/,6];case 4:_a.sent();setIsBookmarked(!isNowBookmarked);showError('Profile.bookmarkError');return [3/*break*/,6];case 5:setIsSaving(false);return [7/*endfinally*/];case 6:return [2/*return*/];}});});}};var StyledIconButton$5=_styled__default["default"](IconButton).withConfig({displayName:"BookmarkButton__StyledIconButton",componentId:"sc-1ni4s3y-0"})(templateObject_1$1G||(templateObject_1$1G=__makeTemplateObject(["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"],["\n padding-left: 0;\n padding-right: 0;\n margin-left: -3px;\n\n i {\n font-size: 22px;\n }\n\n &[disabled] {\n background: transparent;\n }\n"])));var templateObject_1$1G;var CardFooter=function CardFooter(_a){var item=_a.item,showComments=_a.showComments,targetRoute=_a.targetRoute;var metadata=item.metadata||{};var user=useCurrentUser();var showCommentsIcon=showComments&&item.statistics&&item.statistics.commentCount>0&&hasFeedbackType(metadata.feedbackSettings,'comment');return jsxRuntime.jsx(CardFooterHost,{children:jsxRuntime.jsxs(FooterRightSection,{children:[jsxRuntime.jsx(CardLikeButton,{item:item,itemResourceType:ItemResourceTypes.News},void 0),!user.isPublicUser&&showCommentsIcon&&jsxRuntime.jsx(CardStatisticItem,{count:item.statistics.commentCount,tooltipResourceKey:"NewsArticle.numberOfComments",icon:"Chat",targetRoute:targetRoute+"#comments",highlight:item.hasNewComments,ariaLabel:"AriaLabel.commentsButton"},void 0),jsxRuntime.jsx(BookmarkButton,{item:item},void 0)]},void 0)},void 0);};var CardFooterHost=_styled__default["default"].footer.withConfig({displayName:"CardFooter__CardFooterHost",componentId:"sc-8sbpem-0"})(templateObject_1$1F||(templateObject_1$1F=__makeTemplateObject(["\n display: flex;\n margin-top: auto;\n margin-bottom: -4px;\n flex-direction: row;\n justify-content: space-between;\n\n padding-top: ","px;\n\n font-size: ","px;\n\n > div {\n display: flex;\n }\n\n a,\n button {\n position: relative;\n z-index: 1;\n }\n"],["\n display: flex;\n margin-top: auto;\n margin-bottom: -4px;\n flex-direction: row;\n justify-content: space-between;\n\n padding-top: ","px;\n\n font-size: ","px;\n\n > div {\n display: flex;\n }\n\n a,\n button {\n position: relative;\n z-index: 1;\n }\n"])),spacingM,fontSizeMedium+4);var FooterRightSection=_styled__default["default"].div.withConfig({displayName:"CardFooter__FooterRightSection",componentId:"sc-8sbpem-1"})(templateObject_2$$||(templateObject_2$$=__makeTemplateObject(["\n .ms-TooltipHost {\n display: flex;\n align-items: center;\n }\n\n flex: 1 0 ","px;\n justify-content: flex-end;\n > * {\n margin-left: ","px;\n }\n"],["\n .ms-TooltipHost {\n display: flex;\n align-items: center;\n }\n\n flex: 1 0 ","px;\n justify-content: flex-end;\n > * {\n margin-left: ","px;\n }\n"])),spacingXl,spacingS+5);var templateObject_1$1F,templateObject_2$$;var DetailViewContextProvider=function DetailViewContextProvider(_a){var itemId=_a.itemId,type=_a.type,loadItemFunc=_a.loadItemFunc,isEditorPreview=_a.isEditorPreview,children=_a.children;var user=useCurrentUserContext().user;var handleFatalError=React$d.useContext(ErrorContext).handleFatalError;var translateContents=useTranslateApi().translateContents;var _b=React$d.useState(),item=_b[0],setItem=_b[1];var _c=React$d.useState(),originalItem=_c[0],setOriginalItem=_c[1];var _d=React$d.useState(),selectedLanguage=_d[0],setSelectedLanguage=_d[1];var _e=React$d.useState(false),hasError=_e[0],setHasError=_e[1];var _f=React$d.useState(true),isLoading=_f[0],setIsLoading=_f[1];var _g=React$d.useState(false),showAccessDenied=_g[0],setShowAccessDenied=_g[1];var handleAccessDeniedError=React$d.useContext(ErrorContext).handleAccessDeniedError;var isValid=true;React$d.useEffect(function(){refreshItem();return function(){// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132164
132164
|
isValid=false;};},[itemId]);if(showAccessDenied){handleAccessDeniedError({});return null;}var activeLanguages=NewsService.getItemContentLanguages(originalItem,user.subscription.languages);return jsxRuntime.jsx(DetailViewContext.Provider,__assign({value:getContextValues()},{children:children}),void 0);function getContextValues(){return {isLoading:isLoading,hasError:hasError,resourceType:type,item:item,itemId:itemId,contentLanguage:selectedLanguage===null||selectedLanguage===void 0?void 0:selectedLanguage.lang,userPreferredLanguage:(selectedLanguage===null||selectedLanguage===void 0?void 0:selectedLanguage.isUserSet)?selectedLanguage.lang:getPreferredContentLanguage(user),activeLanguages:activeLanguages,content:item&&selectedLanguage?item.contents[selectedLanguage.lang]:null,updateSelectedLanguage:function(l){return setSelectedLanguage({lang:l,isUserSet:true});},handleRefresh:handleRefresh,handleLanguageChange:handleLanguageChange,isEditorPreview:isEditorPreview};}function handleRefresh(onFinished){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,refreshItem()];case 1:_a.sent();onFinished&&onFinished();return [2/*return*/];}});});}function refreshItem(){return __awaiter(this,void 0,void 0,function(){var p,selectedLanguage_1,err_1;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,2,3,4]);return [4/*yield*/,loadItemFunc(itemId)];case 1:p=_a.sent();selectedLanguage_1=NewsService.getLanguageForPublishableItem(p,user);if(isValid){setItem(p);setOriginalItem(p);setSelectedLanguage({isUserSet:false,lang:selectedLanguage_1});setHasError(false);}return [3/*break*/,4];case 2:err_1=_a.sent();if(err_1&&err_1.response&&err_1.response.statusCode===404){if(isValid){setItem(null);setSelectedLanguage(null);setHasError(true);}}else if(err_1&&err_1.response&&err_1.response.statusCode===403){setShowAccessDenied(true);}else {logger.error(err_1);handleFatalError({error:err_1,messageId:'Generic.error'});}return [3/*break*/,4];case 3:isValid&&setIsLoading(false);return [7/*endfinally*/];case 4:return [2/*return*/];}});});}function handleLanguageChange(language){return __awaiter(this,void 0,void 0,function(){var content;var _a;return __generator(this,function(_b){switch(_b.label){case 0:if(item.contents[language]){setSelectedLanguage({isUserSet:true,lang:language});return [2/*return*/];}return [4/*yield*/,translateContents(type,itemId,language)];case 1:content=_b.sent();setItem(__assign(__assign({},item),{contents:__assign(__assign({},item.contents),(_a={},_a[language]=content,_a))}));setSelectedLanguage({isUserSet:true,lang:language});return [2/*return*/];}});});}};var EntityType;(function(EntityType){EntityType["Video"]="video";EntityType["Image"]="image";EntityType["File"]="file";EntityType["Quote"]="quote";EntityType["InlineCode"]="inline-code";EntityType["Gallery"]="gallery";EntityType["Table"]="table";EntityType["Contact"]="contact";EntityType["InlinePageList"]="inline-page-list";EntityType["UrlPreview"]="url-preview";})(EntityType||(EntityType={}));var TextViewer=function TextViewer(_a){var html=_a.html,componentMappers=_a.componentMappers;var _b=React$d.useState(null),editorState=_b[0],setEditorState=_b[1];React$d.useEffect(function(){setEditorState(getInitialEditorState());// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132165
132165
|
},[html]);if(!editorState){return null;}var currentContent=editorState.getCurrentContent();return jsxRuntime.jsx(Draft$1.Editor,{readOnly:true,editorState:editorState,onChange:function(){return null;},blockRendererFn:blockRenderer,blockStyleFn:blockStyle,blockRenderMap:headingRenderMap},void 0);function blockStyle(block){var type=block.getType();if(type==='unstyled'){return 'paragraph';}return null;}function blockRenderer(block){if(block.getType()!=='atomic'){return null;}var entityKey=block.getEntityAt(0);if(entityKey==null){return null;}var entity=currentContent.getEntity(entityKey);var handler=componentMappers.find(function(h){return h.type===entity.getType();});if(handler!=null){return {component:handler.component,editable:false,props:__assign({},entity.getData())};}return null;}function getInitialEditorState(){var contentState=convertFromHTML$1({htmlToEntity:convertHtmlToEntity,htmlToBlock:createHtmlToBlockConverter(componentMappers)})(html||'');return Draft$1.EditorState.createWithContent(contentState,decorator);}function convertHtmlToEntity(nodeName,node,createEntity){for(var _i=0,componentMappers_1=componentMappers;_i<componentMappers_1.length;_i++){var handler=componentMappers_1[_i];var match=handler.getPropsFromHtml(nodeName,node);if(match){return createEntity(handler.type,'IMMUTABLE',match);}}if(nodeName==='a'){return createEntity('LINK','MUTABLE',{url:node.getAttribute('href')});}return null;}};var Link$2=function Link(_a){var contentState=_a.contentState,entityKey=_a.entityKey,children=_a.children;var url=contentState.getEntity(entityKey).getData().url;return jsxRuntime.jsx(TextLink,__assign({url:url},{children:children}),void 0);};function findLinkEntities(contentBlock,callback,contentState){contentBlock.findEntityRanges(function(character){var entityKey=character.getEntity();return entityKey!==null&&contentState.getEntity(entityKey).getType()==='LINK';},callback);}var decorator=new Draft$1.CompositeDecorator([{strategy:findLinkEntities,component:Link$2}]);function createHtmlToBlockConverter(componentMappers){var componentMapperParentNodes=[];return function(nodeName,node){// note (sl): draftJS does call this for all root elements AND
|
|
132166
132166
|
// their children. We only want to handle an element,
|
|
@@ -132396,18 +132396,11 @@
|
|
|
132396
132396
|
var hideComments = _a.hideComments,
|
|
132397
132397
|
hideLikes = _a.hideLikes;
|
|
132398
132398
|
var item = useDetailViewContext().item;
|
|
132399
|
-
|
|
132400
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132401
|
-
return jsxRuntime.jsxs(DetailMainSection, {
|
|
132402
|
-
children: [jsxRuntime.jsx(DetailViewHeadline, {}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(NewsDetailViewMetaInfo, {}, void 0), jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132403
|
-
itemType: ItemResourceTypes.News
|
|
132404
|
-
}, void 0)]
|
|
132405
|
-
}, void 0);
|
|
132406
|
-
}
|
|
132407
|
-
|
|
132408
132399
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132409
132400
|
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132410
|
-
children: [jsxRuntime.jsx(DetailViewHeadline, {}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(NewsDetailViewMetaInfo, {}, void 0),
|
|
132401
|
+
children: [jsxRuntime.jsx(DetailViewHeadline, {}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(NewsDetailViewMetaInfo, {}, void 0), (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132402
|
+
itemType: ItemResourceTypes.News
|
|
132403
|
+
}, void 0) : jsxRuntime.jsx(DetailViewBody, {}, void 0), jsxRuntime.jsx(DetailViewKeywords, {
|
|
132411
132404
|
filterBaseUrl: null
|
|
132412
132405
|
}, void 0)]
|
|
132413
132406
|
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0), jsxRuntime.jsx(NewsDetailViewFeedbackSection, {
|
|
@@ -132893,20 +132886,12 @@
|
|
|
132893
132886
|
}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(PageDetailViewMetaInfo, {}, void 0)]
|
|
132894
132887
|
}, void 0);
|
|
132895
132888
|
|
|
132896
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132897
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132898
|
-
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132899
|
-
children: [Header, jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132900
|
-
itemType: ItemResourceTypes.Pages
|
|
132901
|
-
}, void 0), jsxRuntime.jsx(PagesDetailViewNavigationWrapper, {}, void 0)]
|
|
132902
|
-
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0)]
|
|
132903
|
-
}, void 0);
|
|
132904
|
-
}
|
|
132905
|
-
|
|
132906
132889
|
var isDocument = (item === null || item === void 0 ? void 0 : item.pageType) === PageType.Document;
|
|
132907
132890
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132908
132891
|
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132909
|
-
children: [Header,
|
|
132892
|
+
children: [Header, isDocument ? jsxRuntime.jsx(DetailViewPageDocumentDownload, {}, void 0) : (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132893
|
+
itemType: ItemResourceTypes.Pages
|
|
132894
|
+
}, void 0) : jsxRuntime.jsx(DetailViewBody, {}, void 0), jsxRuntime.jsx(InlinePageListWrapper, {}, void 0), jsxRuntime.jsx(PagesDetailViewNavigationWrapper, {}, void 0), jsxRuntime.jsx(DetailViewKeywords, {
|
|
132910
132895
|
filterBaseUrl: null
|
|
132911
132896
|
}, void 0)]
|
|
132912
132897
|
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0), jsxRuntime.jsx(PageDetailViewFeedbackSection, {
|
|
@@ -133555,34 +133540,32 @@
|
|
|
133555
133540
|
onChannelClick: onChannelClick,
|
|
133556
133541
|
onKeywordClick: onKeywordClick,
|
|
133557
133542
|
buttons: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
133558
|
-
children: [
|
|
133559
|
-
|
|
133560
|
-
|
|
133561
|
-
|
|
133562
|
-
|
|
133563
|
-
|
|
133564
|
-
|
|
133565
|
-
|
|
133566
|
-
|
|
133567
|
-
|
|
133543
|
+
children: [jsxRuntime.jsx(CardLikeButton, {
|
|
133544
|
+
item: item,
|
|
133545
|
+
itemResourceType: ItemResourceTypes.News
|
|
133546
|
+
}, void 0), showComments && jsxRuntime.jsx(Tooltip, __assign$g({
|
|
133547
|
+
resourceKey: "NewsArticle.numberOfComments",
|
|
133548
|
+
values: {
|
|
133549
|
+
count: commentsCount
|
|
133550
|
+
},
|
|
133551
|
+
className: className
|
|
133552
|
+
}, {
|
|
133553
|
+
children: jsxRuntime.jsxs(Comments, __assign$g({
|
|
133554
|
+
href: "" + webAppUrl + targetRoute,
|
|
133555
|
+
target: "_blank",
|
|
133556
|
+
rel: "noopener noreferrer",
|
|
133557
|
+
onClick: function (e) {
|
|
133558
|
+
return handleClick(e, item, false, onItemClick, true);
|
|
133559
|
+
}
|
|
133568
133560
|
}, {
|
|
133569
|
-
children: jsxRuntime.
|
|
133570
|
-
|
|
133571
|
-
|
|
133572
|
-
|
|
133573
|
-
|
|
133574
|
-
|
|
133575
|
-
|
|
133576
|
-
|
|
133577
|
-
children: [jsxRuntime.jsx(StyledIcon$2, {
|
|
133578
|
-
iconName: "Chat",
|
|
133579
|
-
highlight: item.hasNewComments
|
|
133580
|
-
}, void 0), commentsCount > 0 && jsxRuntime.jsx(CommentsCount, {
|
|
133581
|
-
children: commentsCount
|
|
133582
|
-
}, void 0)]
|
|
133583
|
-
}), void 0)
|
|
133584
|
-
}), void 0)]
|
|
133585
|
-
}, void 0), jsxRuntime.jsx(BookmarkButton, {
|
|
133561
|
+
children: [jsxRuntime.jsx(StyledIcon$2, {
|
|
133562
|
+
iconName: "Chat",
|
|
133563
|
+
highlight: item.hasNewComments
|
|
133564
|
+
}, void 0), commentsCount > 0 && jsxRuntime.jsx(CommentsCount, {
|
|
133565
|
+
children: commentsCount
|
|
133566
|
+
}, void 0)]
|
|
133567
|
+
}), void 0)
|
|
133568
|
+
}), void 0), jsxRuntime.jsx(BookmarkButton, {
|
|
133586
133569
|
item: item
|
|
133587
133570
|
}, void 0)]
|
|
133588
133571
|
}, void 0)
|
package/package.json
CHANGED