@livetiles/reach-components-react 0.4.0-preview.21 → 0.4.0-preview.23
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 +45 -13
- package/index.umd.js +45 -13
- package/package.json +1 -1
package/index.esm2.js
CHANGED
|
@@ -81467,12 +81467,41 @@ function useFileAccessTokenApi() {
|
|
|
81467
81467
|
fetchFromApi = _a.fetchFromApi;
|
|
81468
81468
|
|
|
81469
81469
|
var identifier = useContext(SubscriptionIdContext).identifier;
|
|
81470
|
+
var env = useEnvironmentConfig();
|
|
81470
81471
|
var subscriptionId = identifier === null || identifier === void 0 ? void 0 : identifier.id;
|
|
81471
81472
|
return useMemo(function () {
|
|
81472
81473
|
return {
|
|
81473
81474
|
exchangeShortLivedToken: exchangeShortLivedToken,
|
|
81474
|
-
getPublishableItemShortLivedToken: getPublishableItemShortLivedToken
|
|
81475
|
-
|
|
81475
|
+
getPublishableItemShortLivedToken: getPublishableItemShortLivedToken,
|
|
81476
|
+
createDownloadClickHandler: createDownloadClickHandler
|
|
81477
|
+
}; // Creates a click handler that is safe to be used on iOS.
|
|
81478
|
+
// iOS does not allow async onClick handler that open a new window
|
|
81479
|
+
// with `window.open(url, '_blank')`
|
|
81480
|
+
|
|
81481
|
+
function createDownloadClickHandler(target, getUrl) {
|
|
81482
|
+
var _this = this;
|
|
81483
|
+
|
|
81484
|
+
return function () {
|
|
81485
|
+
return __awaiter$1(_this, void 0, void 0, function () {
|
|
81486
|
+
var url;
|
|
81487
|
+
return __generator$1(this, function (_a) {
|
|
81488
|
+
switch (_a.label) {
|
|
81489
|
+
case 0:
|
|
81490
|
+
return [4
|
|
81491
|
+
/*yield*/
|
|
81492
|
+
, getUrl()];
|
|
81493
|
+
|
|
81494
|
+
case 1:
|
|
81495
|
+
url = _a.sent();
|
|
81496
|
+
window.open(url, env.deviceInfo.platform === 'ios' ? '_self' : target);
|
|
81497
|
+
return [2
|
|
81498
|
+
/*return*/
|
|
81499
|
+
];
|
|
81500
|
+
}
|
|
81501
|
+
});
|
|
81502
|
+
});
|
|
81503
|
+
};
|
|
81504
|
+
}
|
|
81476
81505
|
|
|
81477
81506
|
function getPublishableItemShortLivedToken(basePath, itemId) {
|
|
81478
81507
|
return api.custom(basePath + "/" + itemId + "/file_access_token/types/short_lived").get().then(function (r) {
|
|
@@ -81606,7 +81635,11 @@ var FileAttachmentPreview = function FileAttachmentPreview(_a) {
|
|
|
81606
81635
|
disabled = _a.disabled;
|
|
81607
81636
|
var formatMessage = useIntl().formatMessage;
|
|
81608
81637
|
var showDeleteButton = !disabled && onDeleteClick;
|
|
81609
|
-
|
|
81638
|
+
|
|
81639
|
+
var _b = useFileAccessTokenApi(),
|
|
81640
|
+
exchangeShortLivedToken = _b.exchangeShortLivedToken,
|
|
81641
|
+
createDownloadClickHandler = _b.createDownloadClickHandler;
|
|
81642
|
+
|
|
81610
81643
|
return jsxs(Host$n$1, {
|
|
81611
81644
|
children: [attachment.isUploadInProgress && jsx$1(AttachmentOverlay$1, {
|
|
81612
81645
|
children: jsx$1(CenteredSpinner$1, {
|
|
@@ -81650,7 +81683,7 @@ var FileAttachmentPreview = function FileAttachmentPreview(_a) {
|
|
|
81650
81683
|
if (getFileUrl) {
|
|
81651
81684
|
return jsxs(DownloadButton$4, __assign$1({
|
|
81652
81685
|
title: attachment.filename,
|
|
81653
|
-
onClick: function () {
|
|
81686
|
+
onClick: createDownloadClickHandler('_blank', function () {
|
|
81654
81687
|
return __awaiter$1(_this, void 0, void 0, function () {
|
|
81655
81688
|
var token;
|
|
81656
81689
|
return __generator$1(this, function (_a) {
|
|
@@ -81662,14 +81695,13 @@ var FileAttachmentPreview = function FileAttachmentPreview(_a) {
|
|
|
81662
81695
|
|
|
81663
81696
|
case 1:
|
|
81664
81697
|
token = _a.sent();
|
|
81665
|
-
window.open(getFileUrl(attachment.id, token), '_blank');
|
|
81666
81698
|
return [2
|
|
81667
81699
|
/*return*/
|
|
81668
|
-
];
|
|
81700
|
+
, getFileUrl(attachment.id, token)];
|
|
81669
81701
|
}
|
|
81670
81702
|
});
|
|
81671
81703
|
});
|
|
81672
|
-
}
|
|
81704
|
+
})
|
|
81673
81705
|
}, {
|
|
81674
81706
|
children: [jsx$1(FileIcon$2, {
|
|
81675
81707
|
iconName: iconName
|
|
@@ -87267,9 +87299,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
|
|
|
87267
87299
|
}), void 0);
|
|
87268
87300
|
};
|
|
87269
87301
|
|
|
87270
|
-
var version$1 = "0.3.
|
|
87271
|
-
var buildId = "
|
|
87272
|
-
var commitId = "
|
|
87302
|
+
var version$1 = "0.3.16";
|
|
87303
|
+
var buildId = "95251";
|
|
87304
|
+
var commitId = "e7e817da69b52acef0dd781a3c6da8bc4789a5a1";
|
|
87273
87305
|
var isCustomerBuild = false;
|
|
87274
87306
|
var buildInfo = {
|
|
87275
87307
|
version: version$1,
|
|
@@ -125925,9 +125957,9 @@ var STRICT_METHOD=arrayMethodIsStrict('sort');var FORCED$1=FAILS_ON_UNDEFINED||!
|
|
|
125925
125957
|
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
|
|
125926
125958
|
$$3({target:'Array',proto:true,forced:FORCED$1},{sort:function sort(comparefn){return comparefn===undefined?nativeSort.call(toObject$1(this)):nativeSort.call(toObject$1(this),aFunction(comparefn));}});function useExternalContentHandler(){var _this=this;var history=useHistory();var onRequestToken=useContext(AuthenticationContext).onRequestToken;var trackExternalItem=useNewsApi().trackExternalItem;var createApiUrl=useApiFactory().createApiUrl;var currentUser=useCurrentUser();var webAppUrls=useSubscriptionWebAppUrls();var _a=useContext(LinkContext),onOpenExternalLink=_a.onOpenExternalLink,tryGetInternalLink=_a.tryGetInternalLink;var refreshUserDetails=useRefreshUserDetails();return function(item,itemType,openInNewTab){return __awaiter(_this,void 0,void 0,function(){var language,externalContentUrl,internalLink,token;return __generator(this,function(_a){switch(_a.label){case 0:if(!(item===null||item===void 0?void 0:item.useExternalContent)){return [2/*return*/,null];}language=getPreferredContentLanguage(currentUser);externalContentUrl=getExternalContentUrl(item,language);if(!externalContentUrl){return [2/*return*/,null];}internalLink=tryGetInternalLink(externalContentUrl,webAppUrls);if(internalLink){// no API redirect; only the unread & page views tracking
|
|
125927
125959
|
trackExternalItem(item.id,itemType).then(function(){return refreshUserDetails();},logger.error);history.push(internalLink);return [2/*return*/,true];}return [4/*yield*/,onRequestToken()];case 1:token=_a.sent();if(!token){return [2/*return*/,false];}return [4/*yield*/,redirectToExternalContent(item.id,itemType,token,openInNewTab)];case 2:_a.sent();refreshUserDetails();return [2/*return*/,true];}});});};function redirectToExternalContent(itemId,itemType,token,openNewTab){return __awaiter(this,void 0,void 0,function(){var apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:apiExternalContentRedirectRoute=createApiUrl("/"+itemType+"/"+encodeURIComponent(itemId)+"/external_url",{access_token:token});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,openNewTab)];case 1:_a.sent();return [2/*return*/];}});});}}function useExternalContentClickHandler(){var _this=this;var handleExternalContent=useExternalContentHandler();return function(e,item,itemType){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:if(!item.useExternalContent){return [2/*return*/];}e.stopPropagation();e.preventDefault();return [4/*yield*/,handleExternalContent(item,itemType,true)];case 1:_a.sent();return [2/*return*/];}});});};}function useExternalContentRedirectHandler(item,resourceType,noRedirect){var _this=this;var handleExternalContent=useExternalContentHandler();useEffect$1(function(){if(noRedirect){return;}(function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,handleExternalContent(item,resourceType)];case 1:return [2/*return*/,_a.sent()];}});});})();// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125928
|
-
},[item===null||item===void 0?void 0:item.id]);}function usePagesClickHandler(){var user=useCurrentUser();var userToken=useCurrentToken();var onOpenExternalLink=useContext(LinkContext).onOpenExternalLink;var getDocumentFileUrl=usePagesApi().getDocumentFileUrl;var createApiUrl=useApiFactory().createApiUrl;var handleExternalContent=useExternalContentHandler();var _a=useFileAccessTokenApi(),exchangeShortLivedToken=_a.exchangeShortLivedToken,getPublishableItemShortLivedToken=_a.getPublishableItemShortLivedToken;return useMemo(function(){return {createPageClickHandler:createPageClickHandler,createDocumentClickHandler:createDocumentClickHandler};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125960
|
+
},[item===null||item===void 0?void 0:item.id]);}function usePagesClickHandler(){var user=useCurrentUser();var userToken=useCurrentToken();var onOpenExternalLink=useContext(LinkContext).onOpenExternalLink;var getDocumentFileUrl=usePagesApi().getDocumentFileUrl;var createApiUrl=useApiFactory().createApiUrl;var handleExternalContent=useExternalContentHandler();var _a=useFileAccessTokenApi(),exchangeShortLivedToken=_a.exchangeShortLivedToken,getPublishableItemShortLivedToken=_a.getPublishableItemShortLivedToken,createDownloadClickHandler=_a.createDownloadClickHandler;return useMemo(function(){return {createPageClickHandler:createPageClickHandler,createDocumentClickHandler:createDocumentClickHandler};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125929
125961
|
},[user.subscription.id,userToken,getDocumentFileUrl,handleExternalContent]);function createPageClickHandler(page,basePath,additionalOnClick,ignoreExternalContent){var _this=this;if(!page.useExternalContent||// we don't want the editor view to open the external page
|
|
125930
|
-
isEditorUrl(basePath)||ignoreExternalContent){return additionalOnClick;}return function(e){return __awaiter(_this,void 0,void 0,function(){var wasHandled,apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:e.stopPropagation();e.preventDefault();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [4/*yield*/,handleExternalContent(page,ItemResourceTypes.Pages,true)];case 1:wasHandled=_a.sent();if(wasHandled){return [2/*return*/];}apiExternalContentRedirectRoute=createApiUrl("/pages/"+encodeURIComponent(page.id)+"/external_url",{access_token:userToken});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,true)];case 2:_a.sent();return [2/*return*/];}});});};}function createDocumentClickHandler(pageId,fileId,language,shouldOpenInBrowser,fileAccessToken,basePath,additionalOnClick){var _this=this;
|
|
125962
|
+
isEditorUrl(basePath)||ignoreExternalContent){return additionalOnClick;}return function(e){return __awaiter(_this,void 0,void 0,function(){var wasHandled,apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:e.stopPropagation();e.preventDefault();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [4/*yield*/,handleExternalContent(page,ItemResourceTypes.Pages,true)];case 1:wasHandled=_a.sent();if(wasHandled){return [2/*return*/];}apiExternalContentRedirectRoute=createApiUrl("/pages/"+encodeURIComponent(page.id)+"/external_url",{access_token:userToken});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,true)];case 2:_a.sent();return [2/*return*/];}});});};}function createDocumentClickHandler(pageId,fileId,language,shouldOpenInBrowser,fileAccessToken,basePath,additionalOnClick){var _this=this;var target=shouldOpenInBrowser?'_blank':'_self';var downloadHandler=createDownloadClickHandler(target,function(){return __awaiter(_this,void 0,void 0,function(){var token,_a;return __generator(this,function(_b){switch(_b.label){case 0:if(!fileAccessToken)return [3/*break*/,2];return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:_a=_b.sent();return [3/*break*/,4];case 2:return [4/*yield*/,getPublishableItemShortLivedToken(basePath||'pages',pageId)];case 3:_a=_b.sent();_b.label=4;case 4:token=_a;return [2/*return*/,getDocumentFileUrl(basePath||'pages',user.subscription.id,pageId,fileId,language,token||fileAccessToken||userToken)];}});});});return function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();return [4/*yield*/,downloadHandler()];case 1:_a.sent();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [2/*return*/];}});});};}function isEditorUrl(basePath){var _a;return (_a=basePath===null||basePath===void 0?void 0:basePath.includes('editor'))!==null&&_a!==void 0?_a:false;}}function getTitle(node,user,formatMessage,languageOverride){if(!node){return null;}var contents=node.contents?node.contents:node.contents;var preferredLanguage=NewsService.getLanguageForContent(contents,user);// If there is no preferred language => there is no active language at all
|
|
125931
125963
|
// nothing to display...
|
|
125932
125964
|
if(!preferredLanguage){return null;}var language=languageOverride||preferredLanguage;var content=contents[language]||contents[preferredLanguage];return content.title||"<"+formatMessage({id:'Generic.noTitle'})+">";}function getHeadline(item,user,languageOverride){if(!item){return null;}var headline=item.contents;if(!headline){return null;}var preferredLanguage=NewsService.getLanguageForContent(headline,user);// If there is no preferred language => there is no active language at all
|
|
125933
125965
|
// nothing to display...
|
|
@@ -125966,7 +125998,7 @@ var paddingLeft$1=spacingS;var HeaderMetadata$1=_styled.div.withConfig({displayN
|
|
|
125966
125998
|
var _a;if(componentMapperParentNodes.some(function(n){return n.contains(node);})){return false;}for(var _i=0,componentMappers_2=componentMappers;_i<componentMappers_2.length;_i++){var handler=componentMappers_2[_i];var match=handler.getPropsFromHtml(nodeName,node);if(match){componentMapperParentNodes.push(node);handler.prepareRootNode&&handler.prepareRootNode(node);}}if(nodeName==='div'){return 'atomic';}if(nodeName==='p'&&((_a=node.innerHTML)===null||_a===void 0?void 0:_a.trim())==='<br>'){// Quill used to generate <p><br></p> for empty rows
|
|
125967
125999
|
// This is not compatible with draftJS.
|
|
125968
126000
|
// Hence we remove the innerHTML for empty p tags.
|
|
125969
|
-
node.innerHTML='';}return null;};}var FileListHost=_styled.ul.withConfig({displayName:"InlineFileStyles__FileListHost",componentId:"sc-1qjkw11-0"})(templateObject_1$1v||(templateObject_1$1v=__makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"],["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"])));var FileListItem=_styled.li.withConfig({displayName:"InlineFileStyles__FileListItem",componentId:"sc-1qjkw11-1"})(templateObject_2$T||(templateObject_2$T=__makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"],["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"])),minScreenSize.small,spacingS-5);var FileContainerStyle=css$2(templateObject_3$A||(templateObject_3$A=__makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"],["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"])),spacingS,spacingS+5,fontSizeSmall);var FileIconStyle=css$2(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"],["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"])),spacingS,fontSizeLarge-3);var templateObject_1$1v,templateObject_2$T,templateObject_3$A,templateObject_4$o;var InlineFileDownloadButton=function InlineFileDownloadButton(_a){var getFileUrl=_a.getFileUrl,fileName=_a.fileName,title=_a.title,fileAccessToken=_a.fileAccessToken,additionalContent=_a.additionalContent,className=_a.className;var exchangeShortLivedToken=useFileAccessTokenApi().exchangeShortLivedToken;var iconName=getFileIcon(fileName);if(!getFileUrl){return jsxs(FileHost,__assign({className:className,title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0);}return jsx$1(DownloadButton$3,__assign({className:className,onClick:function(){return __awaiter(void 0,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:token=_a.sent();window.open(getFileUrl(token),'_blank');return [2/*return*/];}});});}},{children:jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var FileHost=_styled.div.withConfig({displayName:"InlineFileDownloadButton__FileHost",componentId:"sc-1nadbt8-0"})(templateObject_1$1u||(templateObject_1$1u=__makeTemplateObject(["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"],["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"])),FileContainerStyle,FileIconStyle);var DownloadButton$3=_styled(DefaultButton).withConfig({displayName:"InlineFileDownloadButton__DownloadButton",componentId:"sc-1nadbt8-1"})(templateObject_2$S||(templateObject_2$S=__makeTemplateObject(["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"],["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var DownloadLink$1=_styled.a.withConfig({displayName:"InlineFileDownloadButton__DownloadLink",componentId:"sc-1nadbt8-2"})(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"],["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;});var templateObject_1$1u,templateObject_2$S,templateObject_3$z;var InlinePageDocumentDownloadButton=function InlinePageDocumentDownloadButton(_a){var fileUrl=_a.fileUrl,fileName=_a.fileName,title=_a.title,fileIconName=_a.fileIconName,onClick=_a.onClick,className=_a.className;var iconName=fileIconName||getFileIcon(fileName);return jsx$1(DownloadLink$1,__assign({href:fileUrl,target:"_blank",rel:"noopener noreferrer",onClick:onClick,className:className},{children:jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxs(Fragment,{children:[videoFiles.length>0&&jsx$1(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsx$1(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsx$1(FileListHost,{children:audioFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsx$1(FileListHost,{children:otherFiles.map(function(f){return jsx$1(FileListItem,{children:f.pageId?jsx$1(InlinePageDocument,{file:f},void 0):jsx$1(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsx$1(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled.div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1t||(templateObject_1$1t=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1t;var InlineQuoteViewer=function InlineQuoteViewer(_a){var _b,_c;var quoteDetails=_a.quoteDetails,onClick=_a.onClick,className=_a.className;var upn=(_b=quoteDetails.author)===null||_b===void 0?void 0:_b.userPrincipalName;var displayName=(_c=quoteDetails.author)===null||_c===void 0?void 0:_c.displayName;var showAvatar=upn&"eDetails.showAvatar;return jsxs(Host$w,__assign({onClick:onClick,"data-inline-quote":true,className:className},{children:[jsx$1("blockquote",{children:quoteDetails.text},void 0),showAvatar&&jsx$1("figcaption",{children:jsx$1(PersonaCard,__assign({upn:upn},{children:jsx$1(Avatar,{upn:upn,text:displayName,secondaryText:upn},void 0)}),void 0)},void 0),!showAvatar&&displayName&&jsx$1("figcaption",{children:displayName},void 0)]}),void 0);};var Host$w=_styled.figure.withConfig({displayName:"InlineQuoteViewer__Host",componentId:"sc-1kb6gh1-0"})(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"],["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"])),function(p){return p.theme.palette.accent;},spacingM,2*spacingXl,spacingXl,spacingS,fontSizeSmall,maxScreenSize.medium);var templateObject_1$1s;var InlineQuote=function InlineQuote(_a){var quoteDetails=_a.blockProps;return jsx$1(InlineQuoteViewer,{quoteDetails:quoteDetails},void 0);};var InlineQuoteMapper={component:InlineQuote,type:EntityType.Quote,getPropsFromHtml:function(nodeName,node){var _a,_b,_c,_d;if(nodeName!=='div'){return null;}var quoteId=node.getAttribute('data-quote-id');if(quoteId==null){return null;}var upn=node.getAttribute('data-quote-authorupn');var text=(_b=(_a=node.querySelector('blockquote'))===null||_a===void 0?void 0:_a.innerText)!==null&&_b!==void 0?_b:// use legacy attribute for old content
|
|
126001
|
+
node.innerHTML='';}return null;};}var FileListHost=_styled.ul.withConfig({displayName:"InlineFileStyles__FileListHost",componentId:"sc-1qjkw11-0"})(templateObject_1$1v||(templateObject_1$1v=__makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"],["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"])));var FileListItem=_styled.li.withConfig({displayName:"InlineFileStyles__FileListItem",componentId:"sc-1qjkw11-1"})(templateObject_2$T||(templateObject_2$T=__makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"],["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"])),minScreenSize.small,spacingS-5);var FileContainerStyle=css$2(templateObject_3$A||(templateObject_3$A=__makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"],["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"])),spacingS,spacingS+5,fontSizeSmall);var FileIconStyle=css$2(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"],["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"])),spacingS,fontSizeLarge-3);var templateObject_1$1v,templateObject_2$T,templateObject_3$A,templateObject_4$o;var InlineFileDownloadButton=function InlineFileDownloadButton(_a){var getFileUrl=_a.getFileUrl,fileName=_a.fileName,title=_a.title,fileAccessToken=_a.fileAccessToken,additionalContent=_a.additionalContent,className=_a.className;var _b=useFileAccessTokenApi(),exchangeShortLivedToken=_b.exchangeShortLivedToken,createDownloadClickHandler=_b.createDownloadClickHandler;var iconName=getFileIcon(fileName);if(!getFileUrl){return jsxs(FileHost,__assign({className:className,title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0);}return jsx$1(DownloadButton$3,__assign({className:className,onClick:createDownloadClickHandler('_blank',function(){return __awaiter(void 0,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:token=_a.sent();return [2/*return*/,getFileUrl(token)];}});});})},{children:jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var FileHost=_styled.div.withConfig({displayName:"InlineFileDownloadButton__FileHost",componentId:"sc-1nadbt8-0"})(templateObject_1$1u||(templateObject_1$1u=__makeTemplateObject(["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"],["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"])),FileContainerStyle,FileIconStyle);var DownloadButton$3=_styled(DefaultButton).withConfig({displayName:"InlineFileDownloadButton__DownloadButton",componentId:"sc-1nadbt8-1"})(templateObject_2$S||(templateObject_2$S=__makeTemplateObject(["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"],["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var DownloadLink$1=_styled.a.withConfig({displayName:"InlineFileDownloadButton__DownloadLink",componentId:"sc-1nadbt8-2"})(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"],["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;});var templateObject_1$1u,templateObject_2$S,templateObject_3$z;var InlinePageDocumentDownloadButton=function InlinePageDocumentDownloadButton(_a){var fileUrl=_a.fileUrl,fileName=_a.fileName,title=_a.title,fileIconName=_a.fileIconName,onClick=_a.onClick,className=_a.className;var iconName=fileIconName||getFileIcon(fileName);return jsx$1(DownloadLink$1,__assign({href:fileUrl,target:"_blank",rel:"noopener noreferrer",onClick:onClick,className:className},{children:jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[jsx$1(Icon,{iconName:iconName},void 0),jsx$1("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxs(Fragment,{children:[videoFiles.length>0&&jsx$1(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsx$1(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsx$1(FileListHost,{children:audioFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsx$1(FileListHost,{children:otherFiles.map(function(f){return jsx$1(FileListItem,{children:f.pageId?jsx$1(InlinePageDocument,{file:f},void 0):jsx$1(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsx$1(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled.div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1t||(templateObject_1$1t=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1t;var InlineQuoteViewer=function InlineQuoteViewer(_a){var _b,_c;var quoteDetails=_a.quoteDetails,onClick=_a.onClick,className=_a.className;var upn=(_b=quoteDetails.author)===null||_b===void 0?void 0:_b.userPrincipalName;var displayName=(_c=quoteDetails.author)===null||_c===void 0?void 0:_c.displayName;var showAvatar=upn&"eDetails.showAvatar;return jsxs(Host$w,__assign({onClick:onClick,"data-inline-quote":true,className:className},{children:[jsx$1("blockquote",{children:quoteDetails.text},void 0),showAvatar&&jsx$1("figcaption",{children:jsx$1(PersonaCard,__assign({upn:upn},{children:jsx$1(Avatar,{upn:upn,text:displayName,secondaryText:upn},void 0)}),void 0)},void 0),!showAvatar&&displayName&&jsx$1("figcaption",{children:displayName},void 0)]}),void 0);};var Host$w=_styled.figure.withConfig({displayName:"InlineQuoteViewer__Host",componentId:"sc-1kb6gh1-0"})(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"],["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"])),function(p){return p.theme.palette.accent;},spacingM,2*spacingXl,spacingXl,spacingS,fontSizeSmall,maxScreenSize.medium);var templateObject_1$1s;var InlineQuote=function InlineQuote(_a){var quoteDetails=_a.blockProps;return jsx$1(InlineQuoteViewer,{quoteDetails:quoteDetails},void 0);};var InlineQuoteMapper={component:InlineQuote,type:EntityType.Quote,getPropsFromHtml:function(nodeName,node){var _a,_b,_c,_d;if(nodeName!=='div'){return null;}var quoteId=node.getAttribute('data-quote-id');if(quoteId==null){return null;}var upn=node.getAttribute('data-quote-authorupn');var text=(_b=(_a=node.querySelector('blockquote'))===null||_a===void 0?void 0:_a.innerText)!==null&&_b!==void 0?_b:// use legacy attribute for old content
|
|
125970
126002
|
node.getAttribute('data-quote-text');var displayName=(_d=(_c=node.querySelector('figcaption'))===null||_c===void 0?void 0:_c.innerText)!==null&&_d!==void 0?_d:// use legacy attribute for old content
|
|
125971
126003
|
node.getAttribute('data-quote-authorname');var showAvatar=node.getAttribute('data-quote-showavatar')==='true';var hasAuthor=upn||displayName;return {id:quoteId,text:text,author:hasAuthor?{userPrincipalName:upn,displayName:displayName}:null,showAvatar:showAvatar};},prepareRootNode:function(node){// detect if we a have new (draftJS) content. If not remove innerHTML
|
|
125972
126004
|
// in order to ensure parsing old blocks
|
package/index.umd.js
CHANGED
|
@@ -81324,12 +81324,41 @@
|
|
|
81324
81324
|
fetchFromApi = _a.fetchFromApi;
|
|
81325
81325
|
|
|
81326
81326
|
var identifier = React$d.useContext(SubscriptionIdContext).identifier;
|
|
81327
|
+
var env = useEnvironmentConfig();
|
|
81327
81328
|
var subscriptionId = identifier === null || identifier === void 0 ? void 0 : identifier.id;
|
|
81328
81329
|
return React$d.useMemo(function () {
|
|
81329
81330
|
return {
|
|
81330
81331
|
exchangeShortLivedToken: exchangeShortLivedToken,
|
|
81331
|
-
getPublishableItemShortLivedToken: getPublishableItemShortLivedToken
|
|
81332
|
-
|
|
81332
|
+
getPublishableItemShortLivedToken: getPublishableItemShortLivedToken,
|
|
81333
|
+
createDownloadClickHandler: createDownloadClickHandler
|
|
81334
|
+
}; // Creates a click handler that is safe to be used on iOS.
|
|
81335
|
+
// iOS does not allow async onClick handler that open a new window
|
|
81336
|
+
// with `window.open(url, '_blank')`
|
|
81337
|
+
|
|
81338
|
+
function createDownloadClickHandler(target, getUrl) {
|
|
81339
|
+
var _this = this;
|
|
81340
|
+
|
|
81341
|
+
return function () {
|
|
81342
|
+
return __awaiter$1(_this, void 0, void 0, function () {
|
|
81343
|
+
var url;
|
|
81344
|
+
return __generator$1(this, function (_a) {
|
|
81345
|
+
switch (_a.label) {
|
|
81346
|
+
case 0:
|
|
81347
|
+
return [4
|
|
81348
|
+
/*yield*/
|
|
81349
|
+
, getUrl()];
|
|
81350
|
+
|
|
81351
|
+
case 1:
|
|
81352
|
+
url = _a.sent();
|
|
81353
|
+
window.open(url, env.deviceInfo.platform === 'ios' ? '_self' : target);
|
|
81354
|
+
return [2
|
|
81355
|
+
/*return*/
|
|
81356
|
+
];
|
|
81357
|
+
}
|
|
81358
|
+
});
|
|
81359
|
+
});
|
|
81360
|
+
};
|
|
81361
|
+
}
|
|
81333
81362
|
|
|
81334
81363
|
function getPublishableItemShortLivedToken(basePath, itemId) {
|
|
81335
81364
|
return api.custom(basePath + "/" + itemId + "/file_access_token/types/short_lived").get().then(function (r) {
|
|
@@ -81463,7 +81492,11 @@
|
|
|
81463
81492
|
disabled = _a.disabled;
|
|
81464
81493
|
var formatMessage = useIntl().formatMessage;
|
|
81465
81494
|
var showDeleteButton = !disabled && onDeleteClick;
|
|
81466
|
-
|
|
81495
|
+
|
|
81496
|
+
var _b = useFileAccessTokenApi(),
|
|
81497
|
+
exchangeShortLivedToken = _b.exchangeShortLivedToken,
|
|
81498
|
+
createDownloadClickHandler = _b.createDownloadClickHandler;
|
|
81499
|
+
|
|
81467
81500
|
return jsxRuntime.jsxs(Host$n$1, {
|
|
81468
81501
|
children: [attachment.isUploadInProgress && jsxRuntime.jsx(AttachmentOverlay$1, {
|
|
81469
81502
|
children: jsxRuntime.jsx(CenteredSpinner$1, {
|
|
@@ -81507,7 +81540,7 @@
|
|
|
81507
81540
|
if (getFileUrl) {
|
|
81508
81541
|
return jsxRuntime.jsxs(DownloadButton$4, __assign$1({
|
|
81509
81542
|
title: attachment.filename,
|
|
81510
|
-
onClick: function () {
|
|
81543
|
+
onClick: createDownloadClickHandler('_blank', function () {
|
|
81511
81544
|
return __awaiter$1(_this, void 0, void 0, function () {
|
|
81512
81545
|
var token;
|
|
81513
81546
|
return __generator$1(this, function (_a) {
|
|
@@ -81519,14 +81552,13 @@
|
|
|
81519
81552
|
|
|
81520
81553
|
case 1:
|
|
81521
81554
|
token = _a.sent();
|
|
81522
|
-
window.open(getFileUrl(attachment.id, token), '_blank');
|
|
81523
81555
|
return [2
|
|
81524
81556
|
/*return*/
|
|
81525
|
-
];
|
|
81557
|
+
, getFileUrl(attachment.id, token)];
|
|
81526
81558
|
}
|
|
81527
81559
|
});
|
|
81528
81560
|
});
|
|
81529
|
-
}
|
|
81561
|
+
})
|
|
81530
81562
|
}, {
|
|
81531
81563
|
children: [jsxRuntime.jsx(FileIcon$2, {
|
|
81532
81564
|
iconName: iconName
|
|
@@ -87124,9 +87156,9 @@
|
|
|
87124
87156
|
}), void 0);
|
|
87125
87157
|
};
|
|
87126
87158
|
|
|
87127
|
-
var version$1 = "0.3.
|
|
87128
|
-
var buildId = "
|
|
87129
|
-
var commitId = "
|
|
87159
|
+
var version$1 = "0.3.16";
|
|
87160
|
+
var buildId = "95251";
|
|
87161
|
+
var commitId = "e7e817da69b52acef0dd781a3c6da8bc4789a5a1";
|
|
87130
87162
|
var isCustomerBuild = false;
|
|
87131
87163
|
var buildInfo = {
|
|
87132
87164
|
version: version$1,
|
|
@@ -125798,9 +125830,9 @@
|
|
|
125798
125830
|
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
|
|
125799
125831
|
$$3({target:'Array',proto:true,forced:FORCED$1},{sort:function sort(comparefn){return comparefn===undefined?nativeSort.call(toObject$1(this)):nativeSort.call(toObject$1(this),aFunction(comparefn));}});function useExternalContentHandler(){var _this=this;var history=ReactRouterDom.useHistory();var onRequestToken=React$d.useContext(AuthenticationContext).onRequestToken;var trackExternalItem=useNewsApi().trackExternalItem;var createApiUrl=useApiFactory().createApiUrl;var currentUser=useCurrentUser();var webAppUrls=useSubscriptionWebAppUrls();var _a=React$d.useContext(LinkContext),onOpenExternalLink=_a.onOpenExternalLink,tryGetInternalLink=_a.tryGetInternalLink;var refreshUserDetails=useRefreshUserDetails();return function(item,itemType,openInNewTab){return __awaiter(_this,void 0,void 0,function(){var language,externalContentUrl,internalLink,token;return __generator(this,function(_a){switch(_a.label){case 0:if(!(item===null||item===void 0?void 0:item.useExternalContent)){return [2/*return*/,null];}language=getPreferredContentLanguage(currentUser);externalContentUrl=getExternalContentUrl(item,language);if(!externalContentUrl){return [2/*return*/,null];}internalLink=tryGetInternalLink(externalContentUrl,webAppUrls);if(internalLink){// no API redirect; only the unread & page views tracking
|
|
125800
125832
|
trackExternalItem(item.id,itemType).then(function(){return refreshUserDetails();},logger.error);history.push(internalLink);return [2/*return*/,true];}return [4/*yield*/,onRequestToken()];case 1:token=_a.sent();if(!token){return [2/*return*/,false];}return [4/*yield*/,redirectToExternalContent(item.id,itemType,token,openInNewTab)];case 2:_a.sent();refreshUserDetails();return [2/*return*/,true];}});});};function redirectToExternalContent(itemId,itemType,token,openNewTab){return __awaiter(this,void 0,void 0,function(){var apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:apiExternalContentRedirectRoute=createApiUrl("/"+itemType+"/"+encodeURIComponent(itemId)+"/external_url",{access_token:token});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,openNewTab)];case 1:_a.sent();return [2/*return*/];}});});}}function useExternalContentClickHandler(){var _this=this;var handleExternalContent=useExternalContentHandler();return function(e,item,itemType){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:if(!item.useExternalContent){return [2/*return*/];}e.stopPropagation();e.preventDefault();return [4/*yield*/,handleExternalContent(item,itemType,true)];case 1:_a.sent();return [2/*return*/];}});});};}function useExternalContentRedirectHandler(item,resourceType,noRedirect){var _this=this;var handleExternalContent=useExternalContentHandler();React$d.useEffect(function(){if(noRedirect){return;}(function(){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,handleExternalContent(item,resourceType)];case 1:return [2/*return*/,_a.sent()];}});});})();// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125801
|
-
},[item===null||item===void 0?void 0:item.id]);}function usePagesClickHandler(){var user=useCurrentUser();var userToken=useCurrentToken();var onOpenExternalLink=React$d.useContext(LinkContext).onOpenExternalLink;var getDocumentFileUrl=usePagesApi().getDocumentFileUrl;var createApiUrl=useApiFactory().createApiUrl;var handleExternalContent=useExternalContentHandler();var _a=useFileAccessTokenApi(),exchangeShortLivedToken=_a.exchangeShortLivedToken,getPublishableItemShortLivedToken=_a.getPublishableItemShortLivedToken;return React$d.useMemo(function(){return {createPageClickHandler:createPageClickHandler,createDocumentClickHandler:createDocumentClickHandler};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125833
|
+
},[item===null||item===void 0?void 0:item.id]);}function usePagesClickHandler(){var user=useCurrentUser();var userToken=useCurrentToken();var onOpenExternalLink=React$d.useContext(LinkContext).onOpenExternalLink;var getDocumentFileUrl=usePagesApi().getDocumentFileUrl;var createApiUrl=useApiFactory().createApiUrl;var handleExternalContent=useExternalContentHandler();var _a=useFileAccessTokenApi(),exchangeShortLivedToken=_a.exchangeShortLivedToken,getPublishableItemShortLivedToken=_a.getPublishableItemShortLivedToken,createDownloadClickHandler=_a.createDownloadClickHandler;return React$d.useMemo(function(){return {createPageClickHandler:createPageClickHandler,createDocumentClickHandler:createDocumentClickHandler};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
125802
125834
|
},[user.subscription.id,userToken,getDocumentFileUrl,handleExternalContent]);function createPageClickHandler(page,basePath,additionalOnClick,ignoreExternalContent){var _this=this;if(!page.useExternalContent||// we don't want the editor view to open the external page
|
|
125803
|
-
isEditorUrl(basePath)||ignoreExternalContent){return additionalOnClick;}return function(e){return __awaiter(_this,void 0,void 0,function(){var wasHandled,apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:e.stopPropagation();e.preventDefault();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [4/*yield*/,handleExternalContent(page,ItemResourceTypes.Pages,true)];case 1:wasHandled=_a.sent();if(wasHandled){return [2/*return*/];}apiExternalContentRedirectRoute=createApiUrl("/pages/"+encodeURIComponent(page.id)+"/external_url",{access_token:userToken});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,true)];case 2:_a.sent();return [2/*return*/];}});});};}function createDocumentClickHandler(pageId,fileId,language,shouldOpenInBrowser,fileAccessToken,basePath,additionalOnClick){var _this=this;
|
|
125835
|
+
isEditorUrl(basePath)||ignoreExternalContent){return additionalOnClick;}return function(e){return __awaiter(_this,void 0,void 0,function(){var wasHandled,apiExternalContentRedirectRoute;return __generator(this,function(_a){switch(_a.label){case 0:e.stopPropagation();e.preventDefault();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [4/*yield*/,handleExternalContent(page,ItemResourceTypes.Pages,true)];case 1:wasHandled=_a.sent();if(wasHandled){return [2/*return*/];}apiExternalContentRedirectRoute=createApiUrl("/pages/"+encodeURIComponent(page.id)+"/external_url",{access_token:userToken});return [4/*yield*/,onOpenExternalLink(apiExternalContentRedirectRoute,true)];case 2:_a.sent();return [2/*return*/];}});});};}function createDocumentClickHandler(pageId,fileId,language,shouldOpenInBrowser,fileAccessToken,basePath,additionalOnClick){var _this=this;var target=shouldOpenInBrowser?'_blank':'_self';var downloadHandler=createDownloadClickHandler(target,function(){return __awaiter(_this,void 0,void 0,function(){var token,_a;return __generator(this,function(_b){switch(_b.label){case 0:if(!fileAccessToken)return [3/*break*/,2];return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:_a=_b.sent();return [3/*break*/,4];case 2:return [4/*yield*/,getPublishableItemShortLivedToken(basePath||'pages',pageId)];case 3:_a=_b.sent();_b.label=4;case 4:token=_a;return [2/*return*/,getDocumentFileUrl(basePath||'pages',user.subscription.id,pageId,fileId,language,token||fileAccessToken||userToken)];}});});});return function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:e.preventDefault();return [4/*yield*/,downloadHandler()];case 1:_a.sent();additionalOnClick===null||additionalOnClick===void 0?void 0:additionalOnClick(e);return [2/*return*/];}});});};}function isEditorUrl(basePath){var _a;return (_a=basePath===null||basePath===void 0?void 0:basePath.includes('editor'))!==null&&_a!==void 0?_a:false;}}function getTitle(node,user,formatMessage,languageOverride){if(!node){return null;}var contents=node.contents?node.contents:node.contents;var preferredLanguage=NewsService.getLanguageForContent(contents,user);// If there is no preferred language => there is no active language at all
|
|
125804
125836
|
// nothing to display...
|
|
125805
125837
|
if(!preferredLanguage){return null;}var language=languageOverride||preferredLanguage;var content=contents[language]||contents[preferredLanguage];return content.title||"<"+formatMessage({id:'Generic.noTitle'})+">";}function getHeadline(item,user,languageOverride){if(!item){return null;}var headline=item.contents;if(!headline){return null;}var preferredLanguage=NewsService.getLanguageForContent(headline,user);// If there is no preferred language => there is no active language at all
|
|
125806
125838
|
// nothing to display...
|
|
@@ -125839,7 +125871,7 @@
|
|
|
125839
125871
|
var _a;if(componentMapperParentNodes.some(function(n){return n.contains(node);})){return false;}for(var _i=0,componentMappers_2=componentMappers;_i<componentMappers_2.length;_i++){var handler=componentMappers_2[_i];var match=handler.getPropsFromHtml(nodeName,node);if(match){componentMapperParentNodes.push(node);handler.prepareRootNode&&handler.prepareRootNode(node);}}if(nodeName==='div'){return 'atomic';}if(nodeName==='p'&&((_a=node.innerHTML)===null||_a===void 0?void 0:_a.trim())==='<br>'){// Quill used to generate <p><br></p> for empty rows
|
|
125840
125872
|
// This is not compatible with draftJS.
|
|
125841
125873
|
// Hence we remove the innerHTML for empty p tags.
|
|
125842
|
-
node.innerHTML='';}return null;};}var FileListHost=_styled__default["default"].ul.withConfig({displayName:"InlineFileStyles__FileListHost",componentId:"sc-1qjkw11-0"})(templateObject_1$1v||(templateObject_1$1v=__makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"],["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"])));var FileListItem=_styled__default["default"].li.withConfig({displayName:"InlineFileStyles__FileListItem",componentId:"sc-1qjkw11-1"})(templateObject_2$T||(templateObject_2$T=__makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"],["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"])),minScreenSize.small,spacingS-5);var FileContainerStyle=_styled.css(templateObject_3$A||(templateObject_3$A=__makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"],["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"])),spacingS,spacingS+5,fontSizeSmall);var FileIconStyle=_styled.css(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"],["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"])),spacingS,fontSizeLarge-3);var templateObject_1$1v,templateObject_2$T,templateObject_3$A,templateObject_4$o;var InlineFileDownloadButton=function InlineFileDownloadButton(_a){var getFileUrl=_a.getFileUrl,fileName=_a.fileName,title=_a.title,fileAccessToken=_a.fileAccessToken,additionalContent=_a.additionalContent,className=_a.className;var exchangeShortLivedToken=useFileAccessTokenApi().exchangeShortLivedToken;var iconName=getFileIcon(fileName);if(!getFileUrl){return jsxRuntime.jsxs(FileHost,__assign({className:className,title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0);}return jsxRuntime.jsx(DownloadButton$3,__assign({className:className,onClick:function(){return __awaiter(void 0,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:token=_a.sent();window.open(getFileUrl(token),'_blank');return [2/*return*/];}});});}},{children:jsxRuntime.jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var FileHost=_styled__default["default"].div.withConfig({displayName:"InlineFileDownloadButton__FileHost",componentId:"sc-1nadbt8-0"})(templateObject_1$1u||(templateObject_1$1u=__makeTemplateObject(["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"],["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"])),FileContainerStyle,FileIconStyle);var DownloadButton$3=_styled__default["default"](officeUiFabricReact.DefaultButton).withConfig({displayName:"InlineFileDownloadButton__DownloadButton",componentId:"sc-1nadbt8-1"})(templateObject_2$S||(templateObject_2$S=__makeTemplateObject(["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"],["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var DownloadLink$1=_styled__default["default"].a.withConfig({displayName:"InlineFileDownloadButton__DownloadLink",componentId:"sc-1nadbt8-2"})(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"],["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;});var templateObject_1$1u,templateObject_2$S,templateObject_3$z;var InlinePageDocumentDownloadButton=function InlinePageDocumentDownloadButton(_a){var fileUrl=_a.fileUrl,fileName=_a.fileName,title=_a.title,fileIconName=_a.fileIconName,onClick=_a.onClick,className=_a.className;var iconName=fileIconName||getFileIcon(fileName);return jsxRuntime.jsx(DownloadLink$1,__assign({href:fileUrl,target:"_blank",rel:"noopener noreferrer",onClick:onClick,className:className},{children:jsxRuntime.jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[videoFiles.length>0&&jsxRuntime.jsx(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsxRuntime.jsx(FileListItem,{children:jsxRuntime.jsx(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsxRuntime.jsx(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsxRuntime.jsx(FileListHost,{children:audioFiles.map(function(f){var _a;return jsxRuntime.jsx(FileListItem,{children:jsxRuntime.jsx(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsxRuntime.jsx(FileListHost,{children:otherFiles.map(function(f){return jsxRuntime.jsx(FileListItem,{children:f.pageId?jsxRuntime.jsx(InlinePageDocument,{file:f},void 0):jsxRuntime.jsx(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsxRuntime.jsx(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled__default["default"].div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1t||(templateObject_1$1t=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1t;var InlineQuoteViewer=function InlineQuoteViewer(_a){var _b,_c;var quoteDetails=_a.quoteDetails,onClick=_a.onClick,className=_a.className;var upn=(_b=quoteDetails.author)===null||_b===void 0?void 0:_b.userPrincipalName;var displayName=(_c=quoteDetails.author)===null||_c===void 0?void 0:_c.displayName;var showAvatar=upn&"eDetails.showAvatar;return jsxRuntime.jsxs(Host$w,__assign({onClick:onClick,"data-inline-quote":true,className:className},{children:[jsxRuntime.jsx("blockquote",{children:quoteDetails.text},void 0),showAvatar&&jsxRuntime.jsx("figcaption",{children:jsxRuntime.jsx(PersonaCard,__assign({upn:upn},{children:jsxRuntime.jsx(Avatar,{upn:upn,text:displayName,secondaryText:upn},void 0)}),void 0)},void 0),!showAvatar&&displayName&&jsxRuntime.jsx("figcaption",{children:displayName},void 0)]}),void 0);};var Host$w=_styled__default["default"].figure.withConfig({displayName:"InlineQuoteViewer__Host",componentId:"sc-1kb6gh1-0"})(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"],["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"])),function(p){return p.theme.palette.accent;},spacingM,2*spacingXl,spacingXl,spacingS,fontSizeSmall,maxScreenSize.medium);var templateObject_1$1s;var InlineQuote=function InlineQuote(_a){var quoteDetails=_a.blockProps;return jsxRuntime.jsx(InlineQuoteViewer,{quoteDetails:quoteDetails},void 0);};var InlineQuoteMapper={component:InlineQuote,type:EntityType.Quote,getPropsFromHtml:function(nodeName,node){var _a,_b,_c,_d;if(nodeName!=='div'){return null;}var quoteId=node.getAttribute('data-quote-id');if(quoteId==null){return null;}var upn=node.getAttribute('data-quote-authorupn');var text=(_b=(_a=node.querySelector('blockquote'))===null||_a===void 0?void 0:_a.innerText)!==null&&_b!==void 0?_b:// use legacy attribute for old content
|
|
125874
|
+
node.innerHTML='';}return null;};}var FileListHost=_styled__default["default"].ul.withConfig({displayName:"InlineFileStyles__FileListHost",componentId:"sc-1qjkw11-0"})(templateObject_1$1v||(templateObject_1$1v=__makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"],["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n\n // ensure higher specificity for overwriting the editor list styling\n &&& {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n"])));var FileListItem=_styled__default["default"].li.withConfig({displayName:"InlineFileStyles__FileListItem",componentId:"sc-1qjkw11-1"})(templateObject_2$T||(templateObject_2$T=__makeTemplateObject(["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"],["\n width: 100%;\n display: flex;\n align-items: center;\n\n @media (min-width: ","px) {\n width: calc(50% - ","px);\n\n audio {\n width: 100%;\n }\n }\n"])),minScreenSize.small,spacingS-5);var FileContainerStyle=_styled.css(templateObject_3$A||(templateObject_3$A=__makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"],["\n display: flex;\n align-items: center;\n min-width: 200px;\n padding: ","px ","px;\n box-sizing: border-box;\n border: 1px solid #95989a;\n border-radius: 2px;\n font-size: ","px;\n line-height: 1.5em;\n"])),spacingS,spacingS+5,fontSizeSmall);var FileIconStyle=_styled.css(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"],["\n margin: 0 ","px 0 0;\n font-size: ","px;\n"])),spacingS,fontSizeLarge-3);var templateObject_1$1v,templateObject_2$T,templateObject_3$A,templateObject_4$o;var InlineFileDownloadButton=function InlineFileDownloadButton(_a){var getFileUrl=_a.getFileUrl,fileName=_a.fileName,title=_a.title,fileAccessToken=_a.fileAccessToken,additionalContent=_a.additionalContent,className=_a.className;var _b=useFileAccessTokenApi(),exchangeShortLivedToken=_b.exchangeShortLivedToken,createDownloadClickHandler=_b.createDownloadClickHandler;var iconName=getFileIcon(fileName);if(!getFileUrl){return jsxRuntime.jsxs(FileHost,__assign({className:className,title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0);}return jsxRuntime.jsx(DownloadButton$3,__assign({className:className,onClick:createDownloadClickHandler('_blank',function(){return __awaiter(void 0,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(fileAccessToken)];case 1:token=_a.sent();return [2/*return*/,getFileUrl(token)];}});});})},{children:jsxRuntime.jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[additionalContent,jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var FileHost=_styled__default["default"].div.withConfig({displayName:"InlineFileDownloadButton__FileHost",componentId:"sc-1nadbt8-0"})(templateObject_1$1u||(templateObject_1$1u=__makeTemplateObject(["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"],["\n ","\n\n width: 100%;\n\n i {\n ","\n }\n\n span {\n display: block;\n max-width: calc(100% - 32px); // icon width\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n"])),FileContainerStyle,FileIconStyle);var DownloadButton$3=_styled__default["default"](officeUiFabricReact.DefaultButton).withConfig({displayName:"InlineFileDownloadButton__DownloadButton",componentId:"sc-1nadbt8-1"})(templateObject_2$S||(templateObject_2$S=__makeTemplateObject(["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"],["\n border: 0;\n padding: 0;\n width: 100%;\n\n color: ",";\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: initial;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var DownloadLink$1=_styled__default["default"].a.withConfig({displayName:"InlineFileDownloadButton__DownloadLink",componentId:"sc-1nadbt8-2"})(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"],["\n display: flex;\n align-items: center;\n width: 100%;\n\n &&& {\n color: ",";\n text-decoration: none;\n }\n"])),function(p){return p.theme.palette.neutralPrimary;});var templateObject_1$1u,templateObject_2$S,templateObject_3$z;var InlinePageDocumentDownloadButton=function InlinePageDocumentDownloadButton(_a){var fileUrl=_a.fileUrl,fileName=_a.fileName,title=_a.title,fileIconName=_a.fileIconName,onClick=_a.onClick,className=_a.className;var iconName=fileIconName||getFileIcon(fileName);return jsxRuntime.jsx(DownloadLink$1,__assign({href:fileUrl,target:"_blank",rel:"noopener noreferrer",onClick:onClick,className:className},{children:jsxRuntime.jsxs(FileHost,__assign({title:title!==null&&title!==void 0?title:fileName},{children:[jsxRuntime.jsx(officeUiFabricReact.Icon,{iconName:iconName},void 0),jsxRuntime.jsx("span",{children:title!==null&&title!==void 0?title:fileName},void 0)]}),void 0)}),void 0);};var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[videoFiles.length>0&&jsxRuntime.jsx(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsxRuntime.jsx(FileListItem,{children:jsxRuntime.jsx(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsxRuntime.jsx(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsxRuntime.jsx(FileListHost,{children:audioFiles.map(function(f){var _a;return jsxRuntime.jsx(FileListItem,{children:jsxRuntime.jsx(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsxRuntime.jsx(FileListHost,{children:otherFiles.map(function(f){return jsxRuntime.jsx(FileListItem,{children:f.pageId?jsxRuntime.jsx(InlinePageDocument,{file:f},void 0):jsxRuntime.jsx(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsxRuntime.jsx(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled__default["default"].div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1t||(templateObject_1$1t=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1t;var InlineQuoteViewer=function InlineQuoteViewer(_a){var _b,_c;var quoteDetails=_a.quoteDetails,onClick=_a.onClick,className=_a.className;var upn=(_b=quoteDetails.author)===null||_b===void 0?void 0:_b.userPrincipalName;var displayName=(_c=quoteDetails.author)===null||_c===void 0?void 0:_c.displayName;var showAvatar=upn&"eDetails.showAvatar;return jsxRuntime.jsxs(Host$w,__assign({onClick:onClick,"data-inline-quote":true,className:className},{children:[jsxRuntime.jsx("blockquote",{children:quoteDetails.text},void 0),showAvatar&&jsxRuntime.jsx("figcaption",{children:jsxRuntime.jsx(PersonaCard,__assign({upn:upn},{children:jsxRuntime.jsx(Avatar,{upn:upn,text:displayName,secondaryText:upn},void 0)}),void 0)},void 0),!showAvatar&&displayName&&jsxRuntime.jsx("figcaption",{children:displayName},void 0)]}),void 0);};var Host$w=_styled__default["default"].figure.withConfig({displayName:"InlineQuoteViewer__Host",componentId:"sc-1kb6gh1-0"})(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"],["\n && {\n display: inline-block;\n\n border-left: solid 4px ",";\n padding-left: ","px;\n width: calc(100% - ","px);\n box-sizing: border-box;\n margin: 0 ","px;\n\n blockquote {\n border-left: 0;\n margin: 0;\n }\n\n figcaption {\n text-align: right;\n margin-top: ","px;\n position: relative;\n font-size: ","px;\n }\n\n @media (max-width: ","px) {\n margin: 0;\n width: 100%;\n figcaption {\n margin-right: 10px;\n }\n }\n }\n"])),function(p){return p.theme.palette.accent;},spacingM,2*spacingXl,spacingXl,spacingS,fontSizeSmall,maxScreenSize.medium);var templateObject_1$1s;var InlineQuote=function InlineQuote(_a){var quoteDetails=_a.blockProps;return jsxRuntime.jsx(InlineQuoteViewer,{quoteDetails:quoteDetails},void 0);};var InlineQuoteMapper={component:InlineQuote,type:EntityType.Quote,getPropsFromHtml:function(nodeName,node){var _a,_b,_c,_d;if(nodeName!=='div'){return null;}var quoteId=node.getAttribute('data-quote-id');if(quoteId==null){return null;}var upn=node.getAttribute('data-quote-authorupn');var text=(_b=(_a=node.querySelector('blockquote'))===null||_a===void 0?void 0:_a.innerText)!==null&&_b!==void 0?_b:// use legacy attribute for old content
|
|
125843
125875
|
node.getAttribute('data-quote-text');var displayName=(_d=(_c=node.querySelector('figcaption'))===null||_c===void 0?void 0:_c.innerText)!==null&&_d!==void 0?_d:// use legacy attribute for old content
|
|
125844
125876
|
node.getAttribute('data-quote-authorname');var showAvatar=node.getAttribute('data-quote-showavatar')==='true';var hasAuthor=upn||displayName;return {id:quoteId,text:text,author:hasAuthor?{userPrincipalName:upn,displayName:displayName}:null,showAvatar:showAvatar};},prepareRootNode:function(node){// detect if we a have new (draftJS) content. If not remove innerHTML
|
|
125845
125877
|
// in order to ensure parsing old blocks
|
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.23",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^16.13.1 || ^17",
|
|
7
7
|
"react-dom": "^16.13.1 || ^17",
|