@royaloperahouse/chord 0.7.30 → 0.7.33
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 +95 -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 +95 -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/dist/types/card.d.ts +5 -0
- package/package.json +1 -1
package/dist/chord.esm.js
CHANGED
|
@@ -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"])));
|
|
@@ -4861,6 +4949,8 @@ var Card = function Card(_ref) {
|
|
|
4861
4949
|
_ref$tags = _ref.tags,
|
|
4862
4950
|
tags = _ref$tags === void 0 ? [] : _ref$tags,
|
|
4863
4951
|
image = _ref.image,
|
|
4952
|
+
_ref$imageAltText = _ref.imageAltText,
|
|
4953
|
+
imageAltText = _ref$imageAltText === void 0 ? '' : _ref$imageAltText,
|
|
4864
4954
|
_ref$withContinueWatc = _ref.withContinueWatching,
|
|
4865
4955
|
withContinueWatching = _ref$withContinueWatc === void 0 ? false : _ref$withContinueWatc,
|
|
4866
4956
|
_ref$size = _ref.size,
|
|
@@ -4878,6 +4968,7 @@ var Card = function Card(_ref) {
|
|
|
4878
4968
|
hovered = _useState[0],
|
|
4879
4969
|
setHovered = _useState[1];
|
|
4880
4970
|
|
|
4971
|
+
var truncatedText = truncateHtmlString(text, 185, true);
|
|
4881
4972
|
var primaryButton = links == null ? void 0 : links[0];
|
|
4882
4973
|
|
|
4883
4974
|
var _ref2 = primaryButton || {},
|
|
@@ -4925,7 +5016,7 @@ var Card = function Card(_ref) {
|
|
|
4925
5016
|
aspectRatio: AspectRatio['4:3']
|
|
4926
5017
|
}, /*#__PURE__*/React__default.createElement("img", {
|
|
4927
5018
|
src: image,
|
|
4928
|
-
alt:
|
|
5019
|
+
alt: imageAltText
|
|
4929
5020
|
})), withContinueWatching && /*#__PURE__*/React__default.createElement(ProgressContainer, null, /*#__PURE__*/React__default.createElement(Progress, {
|
|
4930
5021
|
progress: progress
|
|
4931
5022
|
}))), /*#__PURE__*/React__default.createElement(ContentContainer$2, {
|
|
@@ -4942,7 +5033,7 @@ var Card = function Card(_ref) {
|
|
|
4942
5033
|
level: 6
|
|
4943
5034
|
}, title)), subtitle ? /*#__PURE__*/React__default.createElement(SubtitleContainer, null, subtitle) : null, /*#__PURE__*/React__default.createElement(TextContainer, {
|
|
4944
5035
|
dangerouslySetInnerHTML: {
|
|
4945
|
-
__html:
|
|
5036
|
+
__html: truncatedText
|
|
4946
5037
|
}
|
|
4947
5038
|
})), links ? /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
|
|
4948
5039
|
ref: node,
|
|
@@ -6468,5 +6559,5 @@ var GlobalStyles = /*#__PURE__*/createGlobalStyle(_templateObject$R || (_templat
|
|
|
6468
6559
|
return theme.fonts.tablet.sizes.body[1];
|
|
6469
6560
|
}, devices.desktop, devices.largeDesktop);
|
|
6470
6561
|
|
|
6471
|
-
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 };
|
|
6472
6563
|
//# sourceMappingURL=chord.esm.js.map
|