@rh-support/react-context 1.0.18 → 1.0.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"EmbeddedServiceChat.d.ts","sourceRoot":"","sources":["../../../../src/components/EmbeddedServiceChat/EmbeddedServiceChat.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAInC,OAAc,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAMvD,eAAO,MAAM,mBAAmB,EAAE,EAwEjC,CAAC"}
1
+ {"version":3,"file":"EmbeddedServiceChat.d.ts","sourceRoot":"","sources":["../../../../src/components/EmbeddedServiceChat/EmbeddedServiceChat.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAInC,OAAc,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAM/D,eAAO,MAAM,mBAAmB,EAAE,EA0FjC,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import './embeddedServiceChat.css';
2
2
  import { Button, ButtonVariant, Popover, PopoverPosition, Spinner } from '@patternfly/react-core';
3
3
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
4
- import React, { useEffect, useState } from 'react';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
5
  import { Trans, useTranslation } from 'react-i18next';
6
- import { useChatInit } from '../..';
6
+ import { FeatureAnnouncementKeys, NewFeaturePopoverAnnouncement, useChatInit } from '../..';
7
7
  import { ChatSVGIcon } from './ChatSVGIcon';
8
8
  export const EmbeddedServiceChat = () => {
9
+ const componentRef = useRef(null);
9
10
  const { loadingChat, isChatStarted, initEmbedChat, onStartChat, hasChatDomainsBlocked, hasBlockedByBrowser } = useChatInit();
10
11
  const [isBlockedErrorBoxVisible, setIsBlockedErrorBoxVisible] = useState(true);
11
12
  const { t } = useTranslation();
@@ -32,6 +33,8 @@ export const EmbeddedServiceChat = () => {
32
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
34
  }, []);
34
35
  return loadingChat ? (React.createElement("div", { className: "chatButton" },
35
- React.createElement(Spinner, { isSVG: true, diameter: "28px", className: "pf-u-m-xs" }))) : hasBlockedByBrowser || hasChatDomainsBlocked ? (chatErrorMessagePopover()) : !isChatStarted ? (React.createElement("div", { className: "chatButton", onClick: onStartChat, "data-tracking-id": "embedded-service-chat" },
36
- React.createElement(ChatSVGIcon, null))) : (React.createElement(React.Fragment, null));
36
+ React.createElement(Spinner, { isSVG: true, diameter: "28px", className: "pf-u-m-xs" }))) : hasBlockedByBrowser || hasChatDomainsBlocked ? (chatErrorMessagePopover()) : !isChatStarted ? (React.createElement("div", { className: "chatButton", onClick: onStartChat, "data-tracking-id": "embedded-service-chat", ref: componentRef, id: "chat-bot-wrapper" },
37
+ React.createElement(ChatSVGIcon, null),
38
+ React.createElement(NewFeaturePopoverAnnouncement, { "aria-label": t('Support now has a chatbot (beta). Try it if you need help with a case.'), featureName: FeatureAnnouncementKeys.CHAT_BOT, sectionRef: componentRef, bodyContent: React.createElement("div", null,
39
+ React.createElement(Trans, null, "Support now has a chatbot (beta). Try it if you need help with a case.")), reference: () => document.getElementById('chat-bot-wrapper') }))) : (React.createElement(React.Fragment, null));
37
40
  };
@@ -2,7 +2,8 @@ export declare enum FeatureAnnouncementKeys {
2
2
  SEND_NOTIFICATIONS = "sendNotifications",
3
3
  MARKDOWN_INLINE_IMAGES = "markdownInlineImages",
4
4
  CASE_TYPE_FILTER = "caseTypeFilter",
5
- SHARE_HOSTNAMES = "shareHostnamesWithRHT"
5
+ SHARE_HOSTNAMES = "shareHostnamesWithRHT",
6
+ CHAT_BOT = "chatBot"
6
7
  }
7
8
  export interface IFeatureConfig {
8
9
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useFeatureAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFeatureAnnouncement.ts"],"names":[],"mappings":"AAYA,oBAAY,uBAAuB;IAC/B,kBAAkB,sBAAsB;IACxC,sBAAsB,yBAAyB;IAC/C,gBAAgB,mBAAmB;IACnC,eAAe,0BAA0B;CAC5C;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,GAAG,UAAU,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;CAC3B;AAOD,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,uBAAuB;;;;;;EAgG1E"}
1
+ {"version":3,"file":"useFeatureAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFeatureAnnouncement.ts"],"names":[],"mappings":"AAYA,oBAAY,uBAAuB;IAC/B,kBAAkB,sBAAsB;IACxC,sBAAsB,yBAAyB;IAC/C,gBAAgB,mBAAmB;IACnC,eAAe,0BAA0B;IACzC,QAAQ,YAAY;CACvB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,GAAG,UAAU,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;CAC3B;AAOD,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,uBAAuB;;;;;;EAgG1E"}
@@ -9,6 +9,7 @@ export var FeatureAnnouncementKeys;
9
9
  FeatureAnnouncementKeys["MARKDOWN_INLINE_IMAGES"] = "markdownInlineImages";
10
10
  FeatureAnnouncementKeys["CASE_TYPE_FILTER"] = "caseTypeFilter";
11
11
  FeatureAnnouncementKeys["SHARE_HOSTNAMES"] = "shareHostnamesWithRHT";
12
+ FeatureAnnouncementKeys["CHAT_BOT"] = "chatBot";
12
13
  })(FeatureAnnouncementKeys || (FeatureAnnouncementKeys = {}));
13
14
  export function useFeatureAnnouncement(featureName) {
14
15
  const { globalMetadataState: { loggedInUserRights, hydraUserPreferences, pcmConfig }, } = useContext(GlobalMetadataStateContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/react-context",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -90,5 +90,5 @@
90
90
  "not ie <= 11",
91
91
  "not op_mini all"
92
92
  ],
93
- "gitHead": "0c83240511a0382d9e55ee1c303ddd276b8f1610"
93
+ "gitHead": "df23c68f566e8b933a0dcfb1535286bd319cdd80"
94
94
  }