@royaloperahouse/chord 0.7.31 → 0.7.34
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/CHANGELOG.md +9 -0
- package/dist/chord.cjs.development.js +93 -3
- package/dist/chord.cjs.development.js.map +1 -1
- package/dist/chord.cjs.production.min.js +1 -1
- package/dist/chord.cjs.production.min.js.map +1 -1
- package/dist/chord.esm.js +93 -4
- package/dist/chord.esm.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/organisms/LiveChat/LiveChat.d.ts +3 -0
- package/dist/components/organisms/LiveChat/index.d.ts +2 -0
- package/dist/components/organisms/index.d.ts +2 -1
- package/dist/helpers/htmlStrings.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/chord.esm.js
CHANGED
|
@@ -3554,7 +3554,7 @@ var NavTop = function NavTop(_ref) {
|
|
|
3554
3554
|
|
|
3555
3555
|
var _templateObject$s, _templateObject2$c, _templateObject3$6, _templateObject4$3;
|
|
3556
3556
|
var TabsContainer = /*#__PURE__*/styled.div(_templateObject$s || (_templateObject$s = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: row;\n column-gap: 32px;\n"])));
|
|
3557
|
-
var ItemsContainer = /*#__PURE__*/styled.div(_templateObject2$c || (_templateObject2$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: row;\n column-gap: 32px;\n\n @media ", " {\n column-gap: 15px;\n }\n\n @media ", " {\n ", "\n }\n"])), devices.desktop, devices.mobileAndTablet, function (props) {
|
|
3557
|
+
var ItemsContainer = /*#__PURE__*/styled.div(_templateObject2$c || (_templateObject2$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n flex-direction: row;\n column-gap: 32px;\n\n @media ", ", ", " {\n column-gap: 15px;\n\n div:last-child > div {\n right: 1px;\n }\n }\n\n @media ", " {\n ", "\n }\n"])), devices.desktop, devices.largeDesktop, devices.mobileAndTablet, function (props) {
|
|
3558
3558
|
if (props.showMenu) {
|
|
3559
3559
|
return "\n display: flex;\n flex-direction: column;\n row-gap: 32px;\n ";
|
|
3560
3560
|
}
|
|
@@ -4413,6 +4413,48 @@ var RotatorButtonsWrapper = /*#__PURE__*/styled.div(_templateObject9$1 || (_temp
|
|
|
4413
4413
|
var RotatorButtonsWrapperMobile = /*#__PURE__*/styled.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: none;\n\n @media ", " {\n & {\n display: flex;\n grid-area: 1 / 12 / 2 / 14;\n align-self: center;\n justify-content: flex-end;\n }\n }\n\n @media ", " {\n & {\n display: flex;\n grid-area: 1 / 11 / 2 / 14;\n align-self: center;\n justify-content: flex-end;\n }\n }\n"])), devices.tablet, devices.mobile);
|
|
4414
4414
|
var HtmlBodyText = /*#__PURE__*/styled.p(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0;\n margin: 0;\n"])));
|
|
4415
4415
|
|
|
4416
|
+
var TEXT_STYLE_HTML_TAGS_REGEXP = '<em>|</em>|<b>|</b>';
|
|
4417
|
+
|
|
4418
|
+
var stripAllHtmlTags = function stripAllHtmlTags(htmlString) {
|
|
4419
|
+
return htmlString.replace(/<[^>]*>/g, '');
|
|
4420
|
+
};
|
|
4421
|
+
|
|
4422
|
+
var insertString = function insertString(mainString, str, position) {
|
|
4423
|
+
return "" + mainString.substring(0, position) + str + mainString.substring(position);
|
|
4424
|
+
};
|
|
4425
|
+
|
|
4426
|
+
var insertHtmlTags = function insertHtmlTags(strWithTags, strWithoutTags, resultLength) {
|
|
4427
|
+
var htmlTagPositions = Array.from(strWithTags.matchAll(new RegExp(TEXT_STYLE_HTML_TAGS_REGEXP, 'g')));
|
|
4428
|
+
var tagsLength = 0;
|
|
4429
|
+
var resultString = strWithoutTags;
|
|
4430
|
+
htmlTagPositions.forEach(function (tag) {
|
|
4431
|
+
resultString = insertString(resultString, tag[0], tag.index);
|
|
4432
|
+
if (tag.index - tagsLength <= resultLength) tagsLength += tag[0].length;
|
|
4433
|
+
});
|
|
4434
|
+
return {
|
|
4435
|
+
stringWithInsertedTags: resultString,
|
|
4436
|
+
tagsLength: tagsLength
|
|
4437
|
+
};
|
|
4438
|
+
};
|
|
4439
|
+
|
|
4440
|
+
var truncateHtmlString = function truncateHtmlString(str, resultLength, addDots) {
|
|
4441
|
+
if (addDots === void 0) {
|
|
4442
|
+
addDots = false;
|
|
4443
|
+
}
|
|
4444
|
+
|
|
4445
|
+
var strWithoutTags = stripAllHtmlTags(str);
|
|
4446
|
+
if (strWithoutTags.length <= resultLength) return str;
|
|
4447
|
+
|
|
4448
|
+
var _insertHtmlTags = insertHtmlTags(str, strWithoutTags, resultLength),
|
|
4449
|
+
stringWithInsertedTags = _insertHtmlTags.stringWithInsertedTags,
|
|
4450
|
+
tagsLength = _insertHtmlTags.tagsLength;
|
|
4451
|
+
|
|
4452
|
+
var truncatedString = stringWithInsertedTags.substring(0, resultLength + tagsLength);
|
|
4453
|
+
var isSpaceNext = strWithoutTags[resultLength] === ' ';
|
|
4454
|
+
if (!isSpaceNext) truncatedString = truncatedString.substring(0, truncatedString.lastIndexOf(' '));
|
|
4455
|
+
return addDots ? truncatedString + "..." : truncatedString;
|
|
4456
|
+
};
|
|
4457
|
+
|
|
4416
4458
|
var _excluded$8 = ["text"];
|
|
4417
4459
|
|
|
4418
4460
|
var HighlightsCarousel = function HighlightsCarousel(_ref) {
|
|
@@ -4444,7 +4486,7 @@ var HighlightsCarousel = function HighlightsCarousel(_ref) {
|
|
|
4444
4486
|
var linkText = link.text,
|
|
4445
4487
|
restLink = _objectWithoutPropertiesLoose(link, _excluded$8);
|
|
4446
4488
|
|
|
4447
|
-
var description = infoText
|
|
4489
|
+
var description = infoText ? truncateHtmlString(infoText, 185, true) : '';
|
|
4448
4490
|
useEffect(function () {
|
|
4449
4491
|
var slideChangeHandler = function slideChangeHandler(s) {
|
|
4450
4492
|
return setCurrentSlide(s.realIndex);
|
|
@@ -4639,6 +4681,52 @@ var TitleWithCTA = function TitleWithCTA(_ref) {
|
|
|
4639
4681
|
}, message)));
|
|
4640
4682
|
};
|
|
4641
4683
|
|
|
4684
|
+
var SCRIPT_SRC = 'https://talkdeskchatsdk.talkdeskapp.com/talkdeskchatsdk.js?t=';
|
|
4685
|
+
var THEME_COLOR = core.colors.core;
|
|
4686
|
+
var DATA_BIND = '5ea4b1ad-1a17-11ec-af32-06f09e0065e0';
|
|
4687
|
+
var DATA_ORG = '';
|
|
4688
|
+
var DIV_ID = 'tdWebchat';
|
|
4689
|
+
var THEME_ICON = 'https://static.roh.org.uk/images/logo-crest.png';
|
|
4690
|
+
var SCRIPT_CONTENT = "var webchat;\n((window, document, node, props, configs) => {\n if (window.TalkdeskChatSDK) {\n console.error(\"TalkdeskChatSDK already included\");\n return;\n }\n var divContainer = document.createElement(\"div\");\n divContainer.id = node;\n document.body.appendChild(divContainer);\n var currentDate = new Date().getTime();\n var src = \"" + SCRIPT_SRC + "\" + currentDate;\n var script = document.createElement(\"script\");\n var firstScriptTag = document.getElementsByTagName(\"script\")[0];\n script.type = \"text/javascript\";\n script.charset = \"UTF-8\";\n script.id = \"tdwebchatscript\";\n script.src = src;\n script.async = true;\n firstScriptTag.parentNode.insertBefore(script, firstScriptTag);\n script.onload = () => {\n webchat = TalkdeskChatSDK(node, props);\n webchat.init(configs);\n };\n})(\n window,\n document,\n \"" + DIV_ID + "\",\n { flowId: \"cd19d348b5fb4a0ab0d3277686f28d1e\", accountId: \"\", region: \"td-us-1\" },\n { enableEmoji: true, enableUserInput: true, styles :{\n \"chatThemeColor\": \"" + THEME_COLOR + "\",\n \"chatTitleIcon\": \"" + THEME_ICON + "\"\n }}\n);";
|
|
4691
|
+
|
|
4692
|
+
var loadLiveChatScript = function loadLiveChatScript(callback) {
|
|
4693
|
+
var existingScript = document.getElementById(DIV_ID);
|
|
4694
|
+
|
|
4695
|
+
if (!existingScript) {
|
|
4696
|
+
var liveChatDiv = document.createElement('div');
|
|
4697
|
+
liveChatDiv.id = DIV_ID;
|
|
4698
|
+
liveChatDiv.setAttribute('data-bind', DATA_BIND);
|
|
4699
|
+
liveChatDiv.setAttribute('data-org', DATA_ORG);
|
|
4700
|
+
var script = document.createElement('script');
|
|
4701
|
+
var scriptBody = document.createTextNode(SCRIPT_CONTENT);
|
|
4702
|
+
script.appendChild(scriptBody);
|
|
4703
|
+
document.body.appendChild(liveChatDiv);
|
|
4704
|
+
document.body.appendChild(script);
|
|
4705
|
+
|
|
4706
|
+
script.onload = function () {
|
|
4707
|
+
if (callback) callback();
|
|
4708
|
+
};
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
if (existingScript && callback) callback();
|
|
4712
|
+
};
|
|
4713
|
+
|
|
4714
|
+
var LiveChat = function LiveChat() {
|
|
4715
|
+
// eslint-disable-next-line
|
|
4716
|
+
var _React$useState = useState(false),
|
|
4717
|
+
loaded = _React$useState[0],
|
|
4718
|
+
setLoaded = _React$useState[1];
|
|
4719
|
+
|
|
4720
|
+
useEffect(function () {
|
|
4721
|
+
loadLiveChatScript(function () {
|
|
4722
|
+
setLoaded(true);
|
|
4723
|
+
});
|
|
4724
|
+
});
|
|
4725
|
+
return /*#__PURE__*/createElement("span", {
|
|
4726
|
+
"data-loaded": loaded
|
|
4727
|
+
});
|
|
4728
|
+
};
|
|
4729
|
+
|
|
4642
4730
|
var _templateObject$B, _templateObject2$l, _templateObject3$f, _templateObject4$b, _templateObject5$7;
|
|
4643
4731
|
var AccordionContainer = /*#__PURE__*/styled.div(_templateObject$B || (_templateObject$B = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n"])));
|
|
4644
4732
|
var LineContainer = /*#__PURE__*/styled.div(_templateObject2$l || (_templateObject2$l = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2px;\n background-color: var(--base-color-lightgrey);\n width: 100%;\n"])));
|
|
@@ -4880,6 +4968,7 @@ var Card = function Card(_ref) {
|
|
|
4880
4968
|
hovered = _useState[0],
|
|
4881
4969
|
setHovered = _useState[1];
|
|
4882
4970
|
|
|
4971
|
+
var truncatedText = truncateHtmlString(text, 185, true);
|
|
4883
4972
|
var primaryButton = links == null ? void 0 : links[0];
|
|
4884
4973
|
|
|
4885
4974
|
var _ref2 = primaryButton || {},
|
|
@@ -4944,7 +5033,7 @@ var Card = function Card(_ref) {
|
|
|
4944
5033
|
level: 6
|
|
4945
5034
|
}, title)), subtitle ? /*#__PURE__*/React__default.createElement(SubtitleContainer, null, subtitle) : null, /*#__PURE__*/React__default.createElement(TextContainer, {
|
|
4946
5035
|
dangerouslySetInnerHTML: {
|
|
4947
|
-
__html:
|
|
5036
|
+
__html: truncatedText
|
|
4948
5037
|
}
|
|
4949
5038
|
})), links ? /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
|
|
4950
5039
|
ref: node,
|
|
@@ -6470,5 +6559,5 @@ var GlobalStyles = /*#__PURE__*/createGlobalStyle(_templateObject$R || (_templat
|
|
|
6470
6559
|
return theme.fonts.tablet.sizes.body[1];
|
|
6471
6560
|
}, devices.desktop, devices.largeDesktop);
|
|
6472
6561
|
|
|
6473
|
-
export { Accordion, Accordions, AltHeader, AnchorTapBar, AnnouncementBanner, AspectRatio, BodyText, Card, Cards, Carousel, CarouselType, CinemaBadge, Colors, ContactCard, ControlledDropdown, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, HighlightsCarousel, HighlightsCinema as HighlightsCarouselCinema, HighlightsCore as HighlightsCarouselCore, HighlightsStream as HighlightsCarouselStream, Icon, ImageAspectRatioWrapper, ImageWithCaption, Navigation, Overline, PageHeadingCinema, PageHeadingCore, PageHeadingImpact, PageHeadingStream, PeopleListing, PrimaryButton, PromoWithTitle, Quote, RotatorButtons, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Sponsorship, StreamBadge, Subtitle, Tab, TabLink, Tabs, Button$1 as TertiaryButton, TextLink, TextOnly, Theme as ThemeProvider, ThemeType, Tickbox, TickboxMode, TitleWithCTA, TypeTags, devices };
|
|
6562
|
+
export { Accordion, Accordions, AltHeader, AnchorTapBar, AnnouncementBanner, AspectRatio, BodyText, Card, Cards, Carousel, CarouselType, CinemaBadge, Colors, ContactCard, ControlledDropdown, Editorial, Footer, GlobalStyles, Grid, GridItem, Header, HighlightsCarousel, HighlightsCinema as HighlightsCarouselCinema, HighlightsCore as HighlightsCarouselCore, HighlightsStream as HighlightsCarouselStream, Icon, ImageAspectRatioWrapper, ImageWithCaption, LiveChat, Navigation, Overline, PageHeadingCinema, PageHeadingCore, PageHeadingImpact, PageHeadingStream, PeopleListing, PrimaryButton, PromoWithTitle, Quote, RotatorButtons, SecondaryButton, SecondaryLogo, SectionSplitter, SectionTitle, Sponsorship, StreamBadge, Subtitle, Tab, TabLink, Tabs, Button$1 as TertiaryButton, TextLink, TextOnly, Theme as ThemeProvider, ThemeType, Tickbox, TickboxMode, TitleWithCTA, TypeTags, devices };
|
|
6474
6563
|
//# sourceMappingURL=chord.esm.js.map
|