@livetiles/reach-components-react 0.4.0-preview.302 → 0.4.0-preview.303
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
|
@@ -87658,9 +87658,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
|
|
|
87658
87658
|
}), void 0);
|
|
87659
87659
|
};
|
|
87660
87660
|
|
|
87661
|
-
var version$1 = "0.4.0-preview.
|
|
87662
|
-
var buildId = "
|
|
87663
|
-
var commitId = "
|
|
87661
|
+
var version$1 = "0.4.0-preview.303";
|
|
87662
|
+
var buildId = "100286";
|
|
87663
|
+
var commitId = "6baa273b75e79971727d94f55568feb584733ab6";
|
|
87664
87664
|
var isCustomerBuild = false;
|
|
87665
87665
|
var buildInfo = {
|
|
87666
87666
|
version: version$1,
|
|
@@ -131963,7 +131963,7 @@ var handleAttachmentCallback=useCallback(handleAttachmentsAdded,[attachments,set
|
|
|
131963
131963
|
// => we should display a retry button on the attachment preview
|
|
131964
131964
|
.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,attachmentPreviewTheme:props.attachmentPreviewTheme}),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,ariaLabel:formatMessage({id:'AriaLabel.commentInput'})},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$1G||(templateObject_1$1G=__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)
|
|
131965
131965
|
var paddingLeft$1=spacingS;var HeaderMetadata$1=_styled.div.withConfig({displayName:"CommentDisplay__HeaderMetadata",componentId:"sc-el7c23-1"})(templateObject_2$$||(templateObject_2$$=__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$F||(templateObject_3$F=__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$q||(templateObject_4$q=__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$n||(templateObject_5$n=__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$f||(templateObject_6$f=__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$a||(templateObject_7$a=__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$9||(templateObject_8$9=__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$1G,templateObject_2$$,templateObject_3$F,templateObject_4$q,templateObject_5$n,templateObject_6$f,templateObject_7$a,templateObject_8$9,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$1F||(templateObject_1$1F=__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$_||(templateObject_2$_=__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$E||(templateObject_3$E=__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$p||(templateObject_4$p=__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$1F,templateObject_2$_,templateObject_3$E,templateObject_4$p;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
|
|
131966
|
-
},[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$1E||(templateObject_1$1E=__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$1E;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:[
|
|
131966
|
+
},[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$1E||(templateObject_1$1E=__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$1E;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$1D||(templateObject_1$1D=__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$Z||(templateObject_2$Z=__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$1D,templateObject_2$Z;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
|
|
131967
131967
|
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
|
|
131968
131968
|
},[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$1=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$1}]);function createHtmlToBlockConverter(componentMappers){var componentMapperParentNodes=[];return function(nodeName,node){// note (sl): draftJS does call this for all root elements AND
|
|
131969
131969
|
// their children. We only want to handle an element,
|
|
@@ -132202,18 +132202,11 @@ var NewsDetailMainContent = function NewsDetailMainContent(_a) {
|
|
|
132202
132202
|
var hideComments = _a.hideComments,
|
|
132203
132203
|
hideLikes = _a.hideLikes;
|
|
132204
132204
|
var item = useDetailViewContext().item;
|
|
132205
|
-
|
|
132206
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132207
|
-
return jsxs(DetailMainSection, {
|
|
132208
|
-
children: [jsx$1(DetailViewHeadline, {}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(NewsDetailViewMetaInfo, {}, void 0), jsx$1(DetailViewBodyExternalContent, {
|
|
132209
|
-
itemType: ItemResourceTypes.News
|
|
132210
|
-
}, void 0)]
|
|
132211
|
-
}, void 0);
|
|
132212
|
-
}
|
|
132213
|
-
|
|
132214
132205
|
return jsxs(Fragment, {
|
|
132215
132206
|
children: [jsxs(DetailMainSection, {
|
|
132216
|
-
children: [jsx$1(DetailViewHeadline, {}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(NewsDetailViewMetaInfo, {}, void 0),
|
|
132207
|
+
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, {
|
|
132208
|
+
itemType: ItemResourceTypes.News
|
|
132209
|
+
}, void 0) : jsx$1(DetailViewBody, {}, void 0), jsx$1(DetailViewKeywords, {
|
|
132217
132210
|
filterBaseUrl: null
|
|
132218
132211
|
}, void 0)]
|
|
132219
132212
|
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0), jsx$1(NewsDetailViewFeedbackSection, {
|
|
@@ -132699,20 +132692,12 @@ var PageDetailInternal = function PageDetailInternal(_a) {
|
|
|
132699
132692
|
}, void 0), jsx$1(DetailViewTitle, {}, void 0), jsx$1(DetailViewIntro, {}, void 0), jsx$1(PageDetailViewMetaInfo, {}, void 0)]
|
|
132700
132693
|
}, void 0);
|
|
132701
132694
|
|
|
132702
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132703
|
-
return jsxs(Fragment, {
|
|
132704
|
-
children: [jsxs(DetailMainSection, {
|
|
132705
|
-
children: [Header, jsx$1(DetailViewBodyExternalContent, {
|
|
132706
|
-
itemType: ItemResourceTypes.Pages
|
|
132707
|
-
}, void 0), jsx$1(PagesDetailViewNavigationWrapper, {}, void 0)]
|
|
132708
|
-
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0)]
|
|
132709
|
-
}, void 0);
|
|
132710
|
-
}
|
|
132711
|
-
|
|
132712
132695
|
var isDocument = (item === null || item === void 0 ? void 0 : item.pageType) === PageType.Document;
|
|
132713
132696
|
return jsxs(Fragment, {
|
|
132714
132697
|
children: [jsxs(DetailMainSection, {
|
|
132715
|
-
children: [Header,
|
|
132698
|
+
children: [Header, isDocument ? jsx$1(DetailViewPageDocumentDownload, {}, void 0) : (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsx$1(DetailViewBodyExternalContent, {
|
|
132699
|
+
itemType: ItemResourceTypes.Pages
|
|
132700
|
+
}, void 0) : jsx$1(DetailViewBody, {}, void 0), jsx$1(InlinePageListWrapper, {}, void 0), jsx$1(PagesDetailViewNavigationWrapper, {}, void 0), jsx$1(DetailViewKeywords, {
|
|
132716
132701
|
filterBaseUrl: null
|
|
132717
132702
|
}, void 0)]
|
|
132718
132703
|
}, void 0), jsx$1(DetailViewPoll, {}, void 0), jsx$1(DetailViewConfirmations, {}, void 0), jsx$1(PageDetailViewFeedbackSection, {
|
|
@@ -133361,34 +133346,32 @@ var NewsListInternal = function NewsListInternal(_a) {
|
|
|
133361
133346
|
onChannelClick: onChannelClick,
|
|
133362
133347
|
onKeywordClick: onKeywordClick,
|
|
133363
133348
|
buttons: jsxs(Fragment, {
|
|
133364
|
-
children: [
|
|
133365
|
-
|
|
133366
|
-
|
|
133367
|
-
|
|
133368
|
-
|
|
133369
|
-
|
|
133370
|
-
|
|
133371
|
-
|
|
133372
|
-
|
|
133373
|
-
|
|
133349
|
+
children: [jsx$1(CardLikeButton, {
|
|
133350
|
+
item: item,
|
|
133351
|
+
itemResourceType: ItemResourceTypes.News
|
|
133352
|
+
}, void 0), showComments && jsx$1(Tooltip, __assign$g({
|
|
133353
|
+
resourceKey: "NewsArticle.numberOfComments",
|
|
133354
|
+
values: {
|
|
133355
|
+
count: commentsCount
|
|
133356
|
+
},
|
|
133357
|
+
className: className
|
|
133358
|
+
}, {
|
|
133359
|
+
children: jsxs(Comments, __assign$g({
|
|
133360
|
+
href: "" + webAppUrl + targetRoute,
|
|
133361
|
+
target: "_blank",
|
|
133362
|
+
rel: "noopener noreferrer",
|
|
133363
|
+
onClick: function (e) {
|
|
133364
|
+
return handleClick(e, item, false, onItemClick, true);
|
|
133365
|
+
}
|
|
133374
133366
|
}, {
|
|
133375
|
-
children:
|
|
133376
|
-
|
|
133377
|
-
|
|
133378
|
-
|
|
133379
|
-
|
|
133380
|
-
|
|
133381
|
-
|
|
133382
|
-
|
|
133383
|
-
children: [jsx$1(StyledIcon$2, {
|
|
133384
|
-
iconName: "Chat",
|
|
133385
|
-
highlight: item.hasNewComments
|
|
133386
|
-
}, void 0), commentsCount > 0 && jsx$1(CommentsCount, {
|
|
133387
|
-
children: commentsCount
|
|
133388
|
-
}, void 0)]
|
|
133389
|
-
}), void 0)
|
|
133390
|
-
}), void 0)]
|
|
133391
|
-
}, void 0), jsx$1(BookmarkButton, {
|
|
133367
|
+
children: [jsx$1(StyledIcon$2, {
|
|
133368
|
+
iconName: "Chat",
|
|
133369
|
+
highlight: item.hasNewComments
|
|
133370
|
+
}, void 0), commentsCount > 0 && jsx$1(CommentsCount, {
|
|
133371
|
+
children: commentsCount
|
|
133372
|
+
}, void 0)]
|
|
133373
|
+
}), void 0)
|
|
133374
|
+
}), void 0), jsx$1(BookmarkButton, {
|
|
133392
133375
|
item: item
|
|
133393
133376
|
}, void 0)]
|
|
133394
133377
|
}, void 0)
|
package/index.umd.js
CHANGED
|
@@ -87514,9 +87514,9 @@
|
|
|
87514
87514
|
}), void 0);
|
|
87515
87515
|
};
|
|
87516
87516
|
|
|
87517
|
-
var version$1 = "0.4.0-preview.
|
|
87518
|
-
var buildId = "
|
|
87519
|
-
var commitId = "
|
|
87517
|
+
var version$1 = "0.4.0-preview.303";
|
|
87518
|
+
var buildId = "100286";
|
|
87519
|
+
var commitId = "6baa273b75e79971727d94f55568feb584733ab6";
|
|
87520
87520
|
var isCustomerBuild = false;
|
|
87521
87521
|
var buildInfo = {
|
|
87522
87522
|
version: version$1,
|
|
@@ -131835,7 +131835,7 @@
|
|
|
131835
131835
|
// => we should display a retry button on the attachment preview
|
|
131836
131836
|
.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,attachmentPreviewTheme:props.attachmentPreviewTheme}),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,ariaLabel:formatMessage({id:'AriaLabel.commentInput'})},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$1G||(templateObject_1$1G=__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)
|
|
131837
131837
|
var paddingLeft$1=spacingS;var HeaderMetadata$1=_styled__default["default"].div.withConfig({displayName:"CommentDisplay__HeaderMetadata",componentId:"sc-el7c23-1"})(templateObject_2$$||(templateObject_2$$=__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$F||(templateObject_3$F=__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$q||(templateObject_4$q=__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$n||(templateObject_5$n=__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$f||(templateObject_6$f=__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$a||(templateObject_7$a=__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$9||(templateObject_8$9=__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$1G,templateObject_2$$,templateObject_3$F,templateObject_4$q,templateObject_5$n,templateObject_6$f,templateObject_7$a,templateObject_8$9,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$1F||(templateObject_1$1F=__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$_||(templateObject_2$_=__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$E||(templateObject_3$E=__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$p||(templateObject_4$p=__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$1F,templateObject_2$_,templateObject_3$E,templateObject_4$p;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
|
|
131838
|
-
},[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$1E||(templateObject_1$1E=__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$1E;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:[
|
|
131838
|
+
},[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$1E||(templateObject_1$1E=__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$1E;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$1D||(templateObject_1$1D=__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$Z||(templateObject_2$Z=__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$1D,templateObject_2$Z;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
|
|
131839
131839
|
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
|
|
131840
131840
|
},[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$1=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$1}]);function createHtmlToBlockConverter(componentMappers){var componentMapperParentNodes=[];return function(nodeName,node){// note (sl): draftJS does call this for all root elements AND
|
|
131841
131841
|
// their children. We only want to handle an element,
|
|
@@ -132074,18 +132074,11 @@
|
|
|
132074
132074
|
var hideComments = _a.hideComments,
|
|
132075
132075
|
hideLikes = _a.hideLikes;
|
|
132076
132076
|
var item = useDetailViewContext().item;
|
|
132077
|
-
|
|
132078
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132079
|
-
return jsxRuntime.jsxs(DetailMainSection, {
|
|
132080
|
-
children: [jsxRuntime.jsx(DetailViewHeadline, {}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(NewsDetailViewMetaInfo, {}, void 0), jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132081
|
-
itemType: ItemResourceTypes.News
|
|
132082
|
-
}, void 0)]
|
|
132083
|
-
}, void 0);
|
|
132084
|
-
}
|
|
132085
|
-
|
|
132086
132077
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132087
132078
|
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132088
|
-
children: [jsxRuntime.jsx(DetailViewHeadline, {}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(NewsDetailViewMetaInfo, {}, void 0),
|
|
132079
|
+
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, {
|
|
132080
|
+
itemType: ItemResourceTypes.News
|
|
132081
|
+
}, void 0) : jsxRuntime.jsx(DetailViewBody, {}, void 0), jsxRuntime.jsx(DetailViewKeywords, {
|
|
132089
132082
|
filterBaseUrl: null
|
|
132090
132083
|
}, void 0)]
|
|
132091
132084
|
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0), jsxRuntime.jsx(NewsDetailViewFeedbackSection, {
|
|
@@ -132571,20 +132564,12 @@
|
|
|
132571
132564
|
}, void 0), jsxRuntime.jsx(DetailViewTitle, {}, void 0), jsxRuntime.jsx(DetailViewIntro, {}, void 0), jsxRuntime.jsx(PageDetailViewMetaInfo, {}, void 0)]
|
|
132572
132565
|
}, void 0);
|
|
132573
132566
|
|
|
132574
|
-
if (item === null || item === void 0 ? void 0 : item.useExternalContent) {
|
|
132575
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132576
|
-
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132577
|
-
children: [Header, jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132578
|
-
itemType: ItemResourceTypes.Pages
|
|
132579
|
-
}, void 0), jsxRuntime.jsx(PagesDetailViewNavigationWrapper, {}, void 0)]
|
|
132580
|
-
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0)]
|
|
132581
|
-
}, void 0);
|
|
132582
|
-
}
|
|
132583
|
-
|
|
132584
132567
|
var isDocument = (item === null || item === void 0 ? void 0 : item.pageType) === PageType.Document;
|
|
132585
132568
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
132586
132569
|
children: [jsxRuntime.jsxs(DetailMainSection, {
|
|
132587
|
-
children: [Header,
|
|
132570
|
+
children: [Header, isDocument ? jsxRuntime.jsx(DetailViewPageDocumentDownload, {}, void 0) : (item === null || item === void 0 ? void 0 : item.useExternalContent) ? jsxRuntime.jsx(DetailViewBodyExternalContent, {
|
|
132571
|
+
itemType: ItemResourceTypes.Pages
|
|
132572
|
+
}, void 0) : jsxRuntime.jsx(DetailViewBody, {}, void 0), jsxRuntime.jsx(InlinePageListWrapper, {}, void 0), jsxRuntime.jsx(PagesDetailViewNavigationWrapper, {}, void 0), jsxRuntime.jsx(DetailViewKeywords, {
|
|
132588
132573
|
filterBaseUrl: null
|
|
132589
132574
|
}, void 0)]
|
|
132590
132575
|
}, void 0), jsxRuntime.jsx(DetailViewPoll, {}, void 0), jsxRuntime.jsx(DetailViewConfirmations, {}, void 0), jsxRuntime.jsx(PageDetailViewFeedbackSection, {
|
|
@@ -133233,34 +133218,32 @@
|
|
|
133233
133218
|
onChannelClick: onChannelClick,
|
|
133234
133219
|
onKeywordClick: onKeywordClick,
|
|
133235
133220
|
buttons: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
133236
|
-
children: [
|
|
133237
|
-
|
|
133238
|
-
|
|
133239
|
-
|
|
133240
|
-
|
|
133241
|
-
|
|
133242
|
-
|
|
133243
|
-
|
|
133244
|
-
|
|
133245
|
-
|
|
133221
|
+
children: [jsxRuntime.jsx(CardLikeButton, {
|
|
133222
|
+
item: item,
|
|
133223
|
+
itemResourceType: ItemResourceTypes.News
|
|
133224
|
+
}, void 0), showComments && jsxRuntime.jsx(Tooltip, __assign$g({
|
|
133225
|
+
resourceKey: "NewsArticle.numberOfComments",
|
|
133226
|
+
values: {
|
|
133227
|
+
count: commentsCount
|
|
133228
|
+
},
|
|
133229
|
+
className: className
|
|
133230
|
+
}, {
|
|
133231
|
+
children: jsxRuntime.jsxs(Comments, __assign$g({
|
|
133232
|
+
href: "" + webAppUrl + targetRoute,
|
|
133233
|
+
target: "_blank",
|
|
133234
|
+
rel: "noopener noreferrer",
|
|
133235
|
+
onClick: function (e) {
|
|
133236
|
+
return handleClick(e, item, false, onItemClick, true);
|
|
133237
|
+
}
|
|
133246
133238
|
}, {
|
|
133247
|
-
children: jsxRuntime.
|
|
133248
|
-
|
|
133249
|
-
|
|
133250
|
-
|
|
133251
|
-
|
|
133252
|
-
|
|
133253
|
-
|
|
133254
|
-
|
|
133255
|
-
children: [jsxRuntime.jsx(StyledIcon$2, {
|
|
133256
|
-
iconName: "Chat",
|
|
133257
|
-
highlight: item.hasNewComments
|
|
133258
|
-
}, void 0), commentsCount > 0 && jsxRuntime.jsx(CommentsCount, {
|
|
133259
|
-
children: commentsCount
|
|
133260
|
-
}, void 0)]
|
|
133261
|
-
}), void 0)
|
|
133262
|
-
}), void 0)]
|
|
133263
|
-
}, void 0), jsxRuntime.jsx(BookmarkButton, {
|
|
133239
|
+
children: [jsxRuntime.jsx(StyledIcon$2, {
|
|
133240
|
+
iconName: "Chat",
|
|
133241
|
+
highlight: item.hasNewComments
|
|
133242
|
+
}, void 0), commentsCount > 0 && jsxRuntime.jsx(CommentsCount, {
|
|
133243
|
+
children: commentsCount
|
|
133244
|
+
}, void 0)]
|
|
133245
|
+
}), void 0)
|
|
133246
|
+
}), void 0), jsxRuntime.jsx(BookmarkButton, {
|
|
133264
133247
|
item: item
|
|
133265
133248
|
}, void 0)]
|
|
133266
133249
|
}, void 0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livetiles/reach-components-react",
|
|
3
3
|
"description": "Provides React components to consume LiveTiles Reach data",
|
|
4
|
-
"version": "0.4.0-preview.
|
|
4
|
+
"version": "0.4.0-preview.303",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^16.14.0 || ^17",
|
|
7
7
|
"react-dom": "^16.14.0 || ^17",
|