@rh-support/react-context 2.5.87 → 2.5.93
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/lib/esm/GlobalContextWrapper.js +1 -1
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +1 -1
- package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.js +6 -5
- package/lib/esm/hooks/useChatInit.d.ts +0 -1
- package/lib/esm/hooks/useChatInit.d.ts.map +1 -1
- package/lib/esm/hooks/useChatInit.js +0 -3
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/package.json +5 -5
|
@@ -35,7 +35,7 @@ function GlobalContextMetadataWrapper() {
|
|
|
35
35
|
const loadGlobalMetadata = (loggedInUserJwtToken) => {
|
|
36
36
|
setLoggedInUserJwtToken(dispatchToGlobalMetadataReducer, loggedInUserJwtToken);
|
|
37
37
|
/**
|
|
38
|
-
* Even GS4 users can use strata's normal user and
|
|
38
|
+
* Even GS4 users can use strata's normal user and account endpoints and thus fetching them before hand. This improves the load time by 4 seconds
|
|
39
39
|
*/
|
|
40
40
|
loadPCMConfig(dispatchToGlobalMetadataReducer).then((pcmConfig) => {
|
|
41
41
|
fetchLoggedInUser(dispatchToGlobalMetadataReducer, loggedInUserJwtToken, pcmConfig);
|
|
@@ -127,7 +127,7 @@ function AccountSelectorInternal(props) {
|
|
|
127
127
|
accountNumberNotNull: true,
|
|
128
128
|
};
|
|
129
129
|
let queryKey;
|
|
130
|
-
// query as number is a hack to get around TS, isNaN can take a string but it was throwing
|
|
130
|
+
// query as number is a hack to get around TS, isNaN can take a string but it was throwing errors here
|
|
131
131
|
if (isNaN(query)) {
|
|
132
132
|
params.nameLike = query;
|
|
133
133
|
queryKey = 'name';
|
|
@@ -3,14 +3,17 @@ 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 } from '../..';
|
|
6
|
+
import { FeatureAnnouncementKeys, NewFeaturePopoverAnnouncement, useChatInit, usePreChatFormDetails } from '../..';
|
|
7
7
|
import { ChatSVGIcon } from './ChatSVGIcon';
|
|
8
8
|
export const EmbeddedServiceChat = () => {
|
|
9
|
+
var _a;
|
|
9
10
|
const componentRef = useRef(null);
|
|
10
|
-
const { loadingChat, isChatStarted, onStartChat, hasChatDomainsBlocked, hasBlockedByBrowser, chatServiceNotAvailable, hasBlockedByCookie,
|
|
11
|
+
const { loadingChat, isChatStarted, onStartChat, hasChatDomainsBlocked, hasBlockedByBrowser, chatServiceNotAvailable, hasBlockedByCookie, } = useChatInit();
|
|
11
12
|
const [isBlockedErrorBoxVisible, setIsBlockedErrorBoxVisible] = useState(true);
|
|
12
13
|
const [chatClicked, setChatClicked] = useState(false);
|
|
13
14
|
const { t } = useTranslation();
|
|
15
|
+
const getChatFormDetails = usePreChatFormDetails();
|
|
16
|
+
const sessionId = (_a = getChatFormDetails().find((item) => item.label === 'SessionId')) === null || _a === void 0 ? void 0 : _a.value;
|
|
14
17
|
const shouldClose = () => {
|
|
15
18
|
setIsBlockedErrorBoxVisible(false);
|
|
16
19
|
};
|
|
@@ -42,10 +45,8 @@ export const EmbeddedServiceChat = () => {
|
|
|
42
45
|
return React.createElement(React.Fragment, null);
|
|
43
46
|
return loadingChat ? (React.createElement("div", { className: "chatButton" },
|
|
44
47
|
React.createElement(Spinner, { diameter: "28px", className: "pf-v6-u-m-xs" }))) : hasBlockedByCookie && chatClicked && document.querySelector('#teconsent a[role="link"]') !== null ? (chatErrorMessagePopover('cookie')) : (hasBlockedByBrowser || hasChatDomainsBlocked || !sessionId) && chatClicked ? (chatErrorMessagePopover()) : !isChatStarted ? (React.createElement("div", { className: "chatButton", onClick: () => {
|
|
48
|
+
onStartChat();
|
|
45
49
|
setChatClicked(true);
|
|
46
|
-
if (sessionId) {
|
|
47
|
-
onStartChat();
|
|
48
|
-
}
|
|
49
50
|
}, "data-tracking-id": "embedded-service-chat", ref: componentRef, id: "chat-bot-wrapper" },
|
|
50
51
|
React.createElement(ChatSVGIcon, null),
|
|
51
52
|
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,
|
|
@@ -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;
|
|
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"}
|
|
@@ -19,7 +19,6 @@ import { usePreChatFormDetails } from './usePreChatFormDetails';
|
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
21
|
export const useChatInit = (initialState = false) => {
|
|
22
|
-
var _a;
|
|
23
22
|
const [isChatStarted, setChatStart] = useState(initialState);
|
|
24
23
|
// Need to set loading status true as it will prevent starting chat before loading necessary dependencies
|
|
25
24
|
const [loadingChat, setLoadingChat] = useState(true);
|
|
@@ -121,7 +120,6 @@ export const useChatInit = (initialState = false) => {
|
|
|
121
120
|
clearTimeout(blockedByNetworkTimeOut);
|
|
122
121
|
});
|
|
123
122
|
};
|
|
124
|
-
const sessionId = ((_a = getChatFormDetails().find((item) => item.label === 'SessionId')) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
125
123
|
return {
|
|
126
124
|
loadingChat,
|
|
127
125
|
isChatStarted,
|
|
@@ -131,6 +129,5 @@ export const useChatInit = (initialState = false) => {
|
|
|
131
129
|
onStartChat,
|
|
132
130
|
chatServiceNotAvailable,
|
|
133
131
|
hasBlockedByCookie,
|
|
134
|
-
sessionId,
|
|
135
132
|
};
|
|
136
133
|
};
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACH,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,uBAAuB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,GACpC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACH,6BAA6B,EAC7B,0BAA0B,EAC1B,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,uBAAuB,GAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,GACpC,MAAM,qCAAqC,CAAC;AAG7C,cAAc,SAAS,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { GlobalContextWrapper } from './GlobalContextWrapper';
|
|
|
5
5
|
export { GlobalMetadataContextProvider, GlobalMetadataStateContext, GlobalMetadataDispatchContext, useGlobalDispatchContext, useGlobalStateContext, } from './context/GlobalMetadataContext';
|
|
6
6
|
export { GlobalTranslationContext, GlobalTranslationProvider, cacheTrans, SELECTED_TRANS_LANGUAGE, } from './context/GlobalTranslationProvider';
|
|
7
7
|
export { GlobalAlertMessageContextProvider, GlobalAlertMessageStateContext, GlobalAlertMessageDispatchContext, useGlobalAlertMessageDispatchContext, useGlobalAlertMessageStateContext, } from './context/GlobalAlertMessageContext';
|
|
8
|
+
//test
|
|
8
9
|
export * from './utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.93",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@cee-eng/hydrajs": "4.18.95",
|
|
41
41
|
"@patternfly/react-core": "6.2.1",
|
|
42
42
|
"@patternfly/react-icons": "6.2.1",
|
|
43
|
-
"@rh-support/components": "2.5.
|
|
43
|
+
"@rh-support/components": "2.5.73",
|
|
44
44
|
"@rh-support/types": "2.0.5",
|
|
45
|
-
"@rh-support/user-permissions": "2.5.
|
|
46
|
-
"@rh-support/utils": "2.5.
|
|
45
|
+
"@rh-support/user-permissions": "2.5.46",
|
|
46
|
+
"@rh-support/utils": "2.5.42",
|
|
47
47
|
"i18next": "^23.15.0",
|
|
48
48
|
"localforage": "^1.10.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"defaults and supports es6-module",
|
|
94
94
|
"maintained node versions"
|
|
95
95
|
],
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "08156d909dacebb039e331be207937c5879306a8"
|
|
97
97
|
}
|