@rh-support/react-context 2.5.114 → 2.5.115

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.
@@ -3,16 +3,15 @@ import { Button, ButtonVariant, Popover, PopoverPosition, Spinner } from '@patte
3
3
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
4
4
  import React, { useRef, useState } from 'react';
5
5
  import { Trans, useTranslation } from 'react-i18next';
6
- import { FeatureAnnouncementKeys, NewFeaturePopoverAnnouncement, useChatInit, usePreChatFormDetails } from '../..';
6
+ import { FeatureAnnouncementKeys, NewFeaturePopoverAnnouncement, useChatInit } from '../..';
7
7
  import { ChatSVGIcon } from './ChatSVGIcon';
8
8
  export const EmbeddedServiceChat = () => {
9
9
  var _a;
10
10
  const componentRef = useRef(null);
11
- const { loadingChat, isChatStarted, onStartChat, hasChatDomainsBlocked, hasBlockedByBrowser, chatServiceNotAvailable, hasBlockedByCookie, } = useChatInit();
11
+ const { loadingChat, isChatStarted, onStartChat, hasChatDomainsBlocked, hasBlockedByBrowser, chatServiceNotAvailable, hasBlockedByCookie, getChatFormDetails, } = useChatInit();
12
12
  const [isBlockedErrorBoxVisible, setIsBlockedErrorBoxVisible] = useState(true);
13
13
  const [chatClicked, setChatClicked] = useState(false);
14
14
  const { t } = useTranslation();
15
- const getChatFormDetails = usePreChatFormDetails();
16
15
  const sessionId = (_a = getChatFormDetails().find((item) => item.label === 'SessionId')) === null || _a === void 0 ? void 0 : _a.value;
17
16
  const shouldClose = () => {
18
17
  setIsBlockedErrorBoxVisible(false);
@@ -1,3 +1,4 @@
1
+ import { IPreChatFormDetails } from './usePreChatFormDetails';
1
2
  interface IChatOptions {
2
3
  loadingChat: boolean;
3
4
  isChatStarted: boolean;
@@ -7,6 +8,8 @@ interface IChatOptions {
7
8
  onStartChat: () => void;
8
9
  chatServiceNotAvailable: boolean;
9
10
  hasBlockedByCookie: boolean;
11
+ /** Pre-chat form details (SSO, sessionId, etc.). From single usePreChatFormDetails instance to avoid duplicate API calls. */
12
+ getChatFormDetails: () => IPreChatFormDetails[];
10
13
  }
11
14
  /**
12
15
  * This hook is used for setting chat up and listing custom event of chat.
@@ -1 +1 @@
1
- {"version":3,"file":"useChatInit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatInit.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kBAAkB,OAAO,KAAW,YA0H3D,CAAC"}
1
+ {"version":3,"file":"useChatInit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatInit.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAyB,MAAM,yBAAyB,CAAC;AAErF,UAAU,YAAY;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6HAA6H;IAC7H,kBAAkB,EAAE,MAAM,mBAAmB,EAAE,CAAC;CACnD;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kBAAkB,OAAO,KAAW,YA2H3D,CAAC"}
@@ -123,11 +123,12 @@ export const useChatInit = (initialState = false) => {
123
123
  return {
124
124
  loadingChat,
125
125
  isChatStarted,
126
- hasChatDomainsBlocked,
127
126
  hasBlockedByBrowser,
127
+ hasChatDomainsBlocked,
128
128
  initEmbedChat,
129
129
  onStartChat,
130
130
  chatServiceNotAvailable,
131
131
  hasBlockedByCookie,
132
+ getChatFormDetails,
132
133
  };
133
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/react-context",
3
- "version": "2.5.114",
3
+ "version": "2.5.115",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -93,5 +93,5 @@
93
93
  "defaults and supports es6-module",
94
94
  "maintained node versions"
95
95
  ],
96
- "gitHead": "f7c4ed3e081c30729eb7b76ec54af7553176cbd3"
96
+ "gitHead": "d0728328034411e969779d97b4a75bc8296b195f"
97
97
  }