@rh-support/react-context 2.5.263 → 2.5.271

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.
Files changed (29) hide show
  1. package/lib/esm/GlobalContextWrapper.d.ts +1 -3
  2. package/lib/esm/GlobalContextWrapper.d.ts.map +1 -1
  3. package/lib/esm/GlobalContextWrapper.js +9 -3
  4. package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts +0 -2
  5. package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts.map +1 -1
  6. package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +89 -35
  7. package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.d.ts +6 -0
  8. package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.d.ts.map +1 -1
  9. package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.js +16 -51
  10. package/lib/esm/components/EmbeddedServiceChat/embeddedServiceChat.css +0 -51
  11. package/lib/esm/hooks/index.d.ts +0 -1
  12. package/lib/esm/hooks/index.d.ts.map +1 -1
  13. package/lib/esm/hooks/index.js +0 -1
  14. package/lib/esm/hooks/useChatConfig.d.ts +9 -17
  15. package/lib/esm/hooks/useChatConfig.d.ts.map +1 -1
  16. package/lib/esm/hooks/useChatConfig.js +11 -43
  17. package/lib/esm/hooks/useChatInit.d.ts +9 -13
  18. package/lib/esm/hooks/useChatInit.d.ts.map +1 -1
  19. package/lib/esm/hooks/useChatInit.js +59 -119
  20. package/lib/esm/reducers/GlobalMetadataReducer.d.ts +38 -8
  21. package/lib/esm/reducers/GlobalMetadataReducer.d.ts.map +1 -1
  22. package/lib/esm/reducers/GlobalMetadataReducer.js +167 -35
  23. package/package.json +5 -5
  24. package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.d.ts +0 -12
  25. package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.d.ts.map +0 -1
  26. package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.js +0 -29
  27. package/lib/esm/hooks/usePreChatFormDetails.d.ts +0 -12
  28. package/lib/esm/hooks/usePreChatFormDetails.d.ts.map +0 -1
  29. package/lib/esm/hooks/usePreChatFormDetails.js +0 -61
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/react-context",
3
- "version": "2.5.263",
3
+ "version": "2.5.271",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -36,10 +36,10 @@
36
36
  "@cee-eng/hydrajs": "4.18.111",
37
37
  "@patternfly/react-core": "6.2.1",
38
38
  "@patternfly/react-icons": "6.2.1",
39
- "@rh-support/components": "2.5.165",
39
+ "@rh-support/components": "2.5.177",
40
40
  "@rh-support/types": "2.0.26",
41
- "@rh-support/user-permissions": "2.5.111",
42
- "@rh-support/utils": "2.5.92",
41
+ "@rh-support/user-permissions": "2.5.123",
42
+ "@rh-support/utils": "2.5.106",
43
43
  "i18next": "^23.15.0",
44
44
  "localforage": "^1.10.0",
45
45
  "lodash": "^4.17.21",
@@ -89,5 +89,5 @@
89
89
  "defaults and supports es6-module",
90
90
  "maintained node versions"
91
91
  ],
92
- "gitHead": "807e479fdf2ee11467e286baeceb5856f0f32c00"
92
+ "gitHead": "7b1306d35722c768378d97b4c6f9895c6a66bce8"
93
93
  }
@@ -1,12 +0,0 @@
1
- export declare const extraPreChatInfo: {
2
- entityFieldMaps: {
3
- doCreate: boolean;
4
- doFind: boolean;
5
- fieldName: string;
6
- isExactMatch: boolean;
7
- label: string;
8
- }[];
9
- entityName: string;
10
- saveToTranscript: string;
11
- }[];
12
- //# sourceMappingURL=ExtraPreChatInfo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExtraPreChatInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/EmbeddedServiceChat/ExtraPreChatInfo.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;GA6B5B,CAAC"}
@@ -1,29 +0,0 @@
1
- export const extraPreChatInfo = [
2
- {
3
- entityFieldMaps: [
4
- {
5
- doCreate: false,
6
- doFind: true,
7
- fieldName: 'SSO_Username__c',
8
- isExactMatch: true,
9
- label: 'SSO Name',
10
- },
11
- {
12
- doCreate: false,
13
- doFind: true,
14
- fieldName: 'ContactSessionId__c',
15
- isExactMatch: false,
16
- label: 'SessionId',
17
- },
18
- {
19
- doCreate: false,
20
- doFind: true,
21
- fieldName: 'Account',
22
- isExactMatch: true,
23
- label: 'account',
24
- },
25
- ],
26
- entityName: '',
27
- saveToTranscript: 'SSO_Username__c',
28
- },
29
- ];
@@ -1,12 +0,0 @@
1
- export interface IPreChatFormDetails {
2
- label: string;
3
- value: string;
4
- transcriptFields?: Array<string>;
5
- displayToAgent: boolean;
6
- }
7
- /**
8
- *
9
- * The use of this hook is to generate form details based on user current screen
10
- */
11
- export declare const usePreChatFormDetails: () => (() => IPreChatFormDetails[]);
12
- //# sourceMappingURL=usePreChatFormDetails.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePreChatFormDetails.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePreChatFormDetails.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AAEH,eAAO,MAAM,qBAAqB,QAAO,CAAC,MAAM,mBAAmB,EAAE,CA+CpE,CAAC"}
@@ -1,61 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { publicApi } from '@cee-eng/hydrajs';
11
- import { useContext, useEffect, useState } from 'react';
12
- import { GlobalMetadataStateContext } from '../context/GlobalMetadataContext';
13
- /**
14
- *
15
- * The use of this hook is to generate form details based on user current screen
16
- */
17
- export const usePreChatFormDetails = () => {
18
- const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
19
- const [sessionId, setSessionId] = useState('');
20
- const loggedInUserRightsData = loggedInUserRights === null || loggedInUserRights === void 0 ? void 0 : loggedInUserRights.data;
21
- const ssoName = loggedInUserRightsData.getSSOUsername();
22
- const name = loggedInUserRightsData.getUserFullName();
23
- const accountNumber = loggedInUserRightsData.getAccountNumber();
24
- useEffect(() => {
25
- try {
26
- const fetchChatSessionId = () => __awaiter(void 0, void 0, void 0, function* () {
27
- const { message } = yield publicApi.chat.getChatSession();
28
- setSessionId(message);
29
- });
30
- fetchChatSessionId();
31
- }
32
- catch (error) {
33
- console.log('Error', error);
34
- }
35
- }, []);
36
- const getChatFormDetails = () => [
37
- {
38
- label: 'SSO Name',
39
- value: ssoName,
40
- transcriptFields: ['SSO_Username__c'],
41
- displayToAgent: true,
42
- },
43
- {
44
- label: 'SessionId',
45
- value: sessionId,
46
- transcriptFields: ['SessionId__c'],
47
- displayToAgent: true,
48
- },
49
- {
50
- label: 'name',
51
- value: name,
52
- displayToAgent: true,
53
- },
54
- {
55
- label: 'account',
56
- value: accountNumber,
57
- displayToAgent: true,
58
- },
59
- ];
60
- return getChatFormDetails;
61
- };