@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
137 lines • 10.9 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.visitorPanelInfo = void 0;
var React = __importStar(require("react"));
// import { ILoadPerformanceALVFM } from '../Performance/IPerformance';
// import { createPerformanceTableVisitor } from '../Performance/tables';
/***
* d888888b d8b db d888888b d88888b d8888b. d88888b .d8b. .o88b. d88888b
* `88' 888o 88 `~~88~~' 88' 88 `8D 88' d8' `8b d8P Y8 88'
* 88 88V8o 88 88 88ooooo 88oobY' 88ooo 88ooo88 8P 88ooooo
* 88 88 V8o88 88 88~~~~~ 88`8b 88~~~ 88~~~88 8b 88~~~~~
* .88. 88 V888 88 88. 88 `88. 88 88 88 Y8b d8 88.
* Y888888P VP V8P YP Y88888P 88 YD YP YP YP `Y88P' Y88888P
*
*
*/
var TeamsLogo = "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGRlZnM+PHN0eWxlPi5jbHMtMXtvcGFjaXR5OjAuMTt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hLW5hbWU9IkhlYWQiIGNsYXNzPSJjbHMtNCIgY3g9IjE0IiBjeT0iNSIgcj0iMy4zMSIvPjxwYXRoIGNsYXNzPSJjbHMtNSIgZD0iTTgsMTAuMTJWMTcuNUE1LjQsNS40LDAsMCwwLDguNjEsMjBoNUExLjUsMS41LDAsMCwwLDE1LDE4LjY1VjlsLS4yOCwwSDkuMTJBMS4xMiwxLjEyLDAsMCwwLDgsMTAuMTJaIi8+PHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTMuODMsNmgtM0EzLjI5LDMuMjksMCwwLDAsMTQsOC4zMWEzLjMzLDMuMzMsMCwwLDAsMS0uMTd2LTFBMS4xOCwxLjE4LDAsMCwwLDEzLjgzLDZaIi8+PHJlY3QgaWQ9IkJhY2tfUGxhdGUiIGRhdGEtbmFtZT0iQmFjayBQbGF0ZSIgY2xhc3M9ImNscy02IiB5PSI1IiB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHJ4PSIxLjE3Ii8+PHBhdGggY2xhc3M9ImNscy03IiBkPSJNMTAuMTgsOS41OEg3Ljc5VjE2SDYuMjJWOS41OEgzLjgyVjhoNi4zNloiLz48L2c+PC9zdmc+";
/***
* db db d888888b .d8888. d888888b d888888b .d88b. d8888b. d8888b. .d8b. d8b db d88888b db d888888b d8b db d88888b .d88b.
* 88 88 `88' 88' YP `88' `~~88~~' .8P Y8. 88 `8D 88 `8D d8' `8b 888o 88 88' 88 `88' 888o 88 88' .8P Y8.
* Y8 8P 88 `8bo. 88 88 88 88 88oobY' 88oodD' 88ooo88 88V8o 88 88ooooo 88 88 88V8o 88 88ooo 88 88
* `8b d8' 88 `Y8b. 88 88 88 88 88`8b 88~~~ 88~~~88 88 V8o88 88~~~~~ 88 88 88 V8o88 88~~~ 88 88
* `8bd8' .88. db 8D .88. 88 `8b d8' 88 `88. 88 88 88 88 V888 88. 88booo. .88. 88 V888 88 `8b d8'
* YP Y888888P `8888Y' Y888888P YP `Y88P' 88 YD 88 YP YP VP V8P Y88888P Y88888P Y888888P VP V8P YP `Y88P'
*
*
*/
// export function visitorPanelInfo( wpProps: IMinWPVisitorPanelInfo, performance: ILoadPerformanceALVFM ) {
function visitorPanelInfo(wpProps, repoLinks, bodyText, fromText, loadSummary) {
var bannerTitle = wpProps.bannerTitle, documentationLinkDesc = wpProps.documentationLinkDesc, documentationLinkUrl = wpProps.documentationLinkUrl, supportContacts = wpProps.supportContacts, panelMessageDescription1 = wpProps.panelMessageDescription1, panelMessageSupport = wpProps.panelMessageSupport, panelMessageDocumentation = wpProps.panelMessageDocumentation, panelMessageIfYouStill = wpProps.panelMessageIfYouStill;
if (!bodyText)
bodyText = 'Add your question or comment here: ';
if (!fromText)
fromText = 'SharePoint Support Team';
console.log('visitorPanelInfo - wpProps', wpProps);
// text-decoration: underline;
var headingStyles = { fontSize: 'larger', paddingTop: '25px', fontWeight: 'bold' };
var subHeadingStyles = { fontSize: 'normal', paddingLeft: '20px' };
var subHeadingStylesAround = { fontSize: 'normal', padding: '16px 20px 0px 20px' };
var contactStyles = { fontSize: 'normal', padding: '16px 20px 0px 20px' };
var Description1 = !panelMessageDescription1 ? null :
React.createElement("div", { style: subHeadingStyles }, panelMessageDescription1);
var Support = !panelMessageSupport ? null :
React.createElement("div", { style: subHeadingStylesAround }, panelMessageSupport);
var DocumentationMessage = !panelMessageDocumentation ? null :
React.createElement("div", { style: subHeadingStylesAround }, panelMessageDocumentation);
var cardStyles = {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
padding: '5px',
};
var lbreak = '%0D%0A';
var contactList = !supportContacts ? [] : supportContacts.map(function (contact) {
var pageName = window.location.pathname.substring(window.location.pathname.lastIndexOf("/") + 1);
var mailTemplate = "mailto:".concat(contact.email);
mailTemplate += "?subject=".concat(repoLinks.desc, " Webpart Question or Issue on PAGE: ").concat(pageName);
mailTemplate += "&body=".concat(bodyText, " ").concat(lbreak).concat(lbreak).concat(lbreak);
mailTemplate += "Page Name: ".concat(pageName).concat(lbreak).concat(lbreak);
mailTemplate += "Link to page:".concat(lbreak).concat(window.location.href).concat(lbreak).concat(lbreak);
mailTemplate += "Best Regards, ".concat(lbreak).concat(lbreak);
mailTemplate += "".concat(fromText);
//Fix: https://github.com/mikezimm/ALVFinMan/issues/141
var imageUrl = !contact.imageUrl || (contact.email && contact.email.indexOf('.teams.ms')) ? TeamsLogo : contact.imageUrl;
return React.createElement("div", { style: cardStyles },
React.createElement("img", { src: imageUrl, alt: "Picture of ".concat(contact.fullName), width: 30, height: 30, style: { borderRadius: '50%' } }),
React.createElement("a", { style: { paddingLeft: '20px', paddingRight: '20px' }, href: mailTemplate }, "Email"),
React.createElement("div", { style: { paddingLeft: '20px', paddingRight: '20px' } }, contact.fullName));
});
var ContactInfo = contactList.length === 0 ? null : React.createElement("div", { style: contactStyles }, contactList);
var validLink = documentationLinkUrl && documentationLinkUrl.length > 0 &&
(documentationLinkUrl.indexOf('./') === 0 ||
documentationLinkUrl.indexOf('../') === 0 ||
documentationLinkUrl.indexOf('/sites') === 0 ||
documentationLinkUrl.indexOf(window.origin) === 0) ? '' : 'Please Verify Link :(';
var docsLink = !documentationLinkUrl ? null : React.createElement("div", { style: contactStyles },
React.createElement("span", { onClick: function () { return onLinkClick(documentationLinkUrl); }, style: { color: 'blue', cursor: 'pointer', paddingRight: '30px' }, title: documentationLinkUrl }, documentationLinkDesc),
React.createElement("span", null, validLink));
// const loadSummary = createPerformanceTableVisitor( performance );
/***
* d8888b. d88888b d888888b db db d8888b. d8b db
* 88 `8D 88' `~~88~~' 88 88 88 `8D 888o 88
* 88oobY' 88ooooo 88 88 88 88oobY' 88V8o 88
* 88`8b 88~~~~~ 88 8 88 88`8b 88 V8o88
* 88 `88. 88. 88 88b d88 88 `88. 88 V888
* 88 YD Y88888P YP ~Y8888P' 88 YD VP V8P
*
*
*/
var panelMessageIfYouStillContent = panelMessageIfYouStill ? panelMessageIfYouStill : ' - please contact the owner of this webpart before submitting an incident.';
return (React.createElement("div", { style: { fontSize: 'larger' } },
React.createElement("h2", null, "Support information for: ".concat(bannerTitle ? bannerTitle : 'This web part')),
Description1,
React.createElement("div", { style: headingStyles }, "If the webpart displays a warning"),
React.createElement("div", { style: subHeadingStyles }, " - please notify someone listed below in the contacts section"),
React.createElement("div", { style: headingStyles }, "Before asking for additional support"),
React.createElement("div", { style: subHeadingStyles }, " - please review our support documentation"),
Support,
DocumentationMessage,
docsLink,
React.createElement("div", { style: headingStyles }, "If you still have issues..."),
React.createElement("div", { style: subHeadingStyles },
panelMessageIfYouStillContent,
" "),
React.createElement("div", { style: headingStyles }, "Contact(s) for primary support or issues"),
React.createElement("div", null, ContactInfo),
React.createElement("div", null, loadSummary)));
}
exports.visitorPanelInfo = visitorPanelInfo;
function onLinkClick(gotoLink) {
window.open(gotoLink, '_none');
}
//# sourceMappingURL=VisitorPanelComponent.js.map