@royaloperahouse/chord 0.7.32 → 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/dist/chord.esm.js CHANGED
@@ -4681,6 +4681,52 @@ var TitleWithCTA = function TitleWithCTA(_ref) {
4681
4681
  }, message)));
4682
4682
  };
4683
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
+
4684
4730
  var _templateObject$B, _templateObject2$l, _templateObject3$f, _templateObject4$b, _templateObject5$7;
4685
4731
  var AccordionContainer = /*#__PURE__*/styled.div(_templateObject$B || (_templateObject$B = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n"])));
4686
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"])));
@@ -6513,5 +6559,5 @@ var GlobalStyles = /*#__PURE__*/createGlobalStyle(_templateObject$R || (_templat
6513
6559
  return theme.fonts.tablet.sizes.body[1];
6514
6560
  }, devices.desktop, devices.largeDesktop);
6515
6561
 
6516
- 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 };
6517
6563
  //# sourceMappingURL=chord.esm.js.map