@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.
- package/lib/esm/GlobalContextWrapper.d.ts +1 -3
- package/lib/esm/GlobalContextWrapper.d.ts.map +1 -1
- package/lib/esm/GlobalContextWrapper.js +9 -3
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts +0 -2
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.d.ts.map +1 -1
- package/lib/esm/components/AccountSelector/AccountSelectorInternal.js +89 -35
- package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.d.ts +6 -0
- package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.d.ts.map +1 -1
- package/lib/esm/components/EmbeddedServiceChat/EmbeddedServiceChat.js +16 -51
- package/lib/esm/components/EmbeddedServiceChat/embeddedServiceChat.css +0 -51
- package/lib/esm/hooks/index.d.ts +0 -1
- package/lib/esm/hooks/index.d.ts.map +1 -1
- package/lib/esm/hooks/index.js +0 -1
- package/lib/esm/hooks/useChatConfig.d.ts +9 -17
- package/lib/esm/hooks/useChatConfig.d.ts.map +1 -1
- package/lib/esm/hooks/useChatConfig.js +11 -43
- package/lib/esm/hooks/useChatInit.d.ts +9 -13
- package/lib/esm/hooks/useChatInit.d.ts.map +1 -1
- package/lib/esm/hooks/useChatInit.js +59 -119
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts +38 -8
- package/lib/esm/reducers/GlobalMetadataReducer.d.ts.map +1 -1
- package/lib/esm/reducers/GlobalMetadataReducer.js +167 -35
- package/package.json +5 -5
- package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.d.ts +0 -12
- package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.d.ts.map +0 -1
- package/lib/esm/components/EmbeddedServiceChat/ExtraPreChatInfo.js +0 -29
- package/lib/esm/hooks/usePreChatFormDetails.d.ts +0 -12
- package/lib/esm/hooks/usePreChatFormDetails.d.ts.map +0 -1
- package/lib/esm/hooks/usePreChatFormDetails.js +0 -61
|
@@ -1,134 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 { enableScripts, getCookieValue, waitForWindowVariable } from '@rh-support/utils';
|
|
11
|
-
import { useEffect, useState } from 'react';
|
|
12
|
-
import { extraPreChatInfo } from '../components/EmbeddedServiceChat/ExtraPreChatInfo';
|
|
1
|
+
import { getCookieValue } from '@rh-support/utils';
|
|
2
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { GlobalMetadataStateContext } from '../context/GlobalMetadataContext';
|
|
13
4
|
import { useChatConfig } from './useChatConfig';
|
|
14
|
-
import { usePreChatFormDetails } from './usePreChatFormDetails';
|
|
15
5
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
6
|
+
* Dynamically loads the Salesforce Enhanced Messaging bootstrap script and
|
|
7
|
+
* calls `embeddedservice_bootstrap.init()` once the script is ready.
|
|
8
|
+
*
|
|
9
|
+
* The script is injected only after TrustArc functional-cookie consent is
|
|
10
|
+
* confirmed, and the `onload` callback is used instead of polling so we
|
|
11
|
+
* never race against network latency.
|
|
12
|
+
*
|
|
13
|
+
* @see https://developer.salesforce.com/docs/service/messaging-web/guide/set-up-embedded-messaging.html
|
|
20
14
|
*/
|
|
21
|
-
export const useChatInit = (
|
|
22
|
-
const [isChatStarted, setChatStart] = useState(initialState);
|
|
23
|
-
// Need to set loading status true as it will prevent starting chat before loading necessary dependencies
|
|
15
|
+
export const useChatInit = () => {
|
|
24
16
|
const [loadingChat, setLoadingChat] = useState(true);
|
|
25
|
-
const [hasBlockedByBrowser, setHasBlockedByBrowser] = useState(false);
|
|
26
|
-
const [hasChatDomainsBlocked, setHasChatDomainsBlocked] = useState(false);
|
|
27
17
|
const [chatServiceNotAvailable, setChatServiceNotAvailable] = useState(false);
|
|
28
18
|
const [hasBlockedByCookie, setHasBlockedByCookie] = useState(false);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
19
|
+
const { globalMetadataState: { loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
20
|
+
const ssoName = loggedInUserRights === null || loggedInUserRights === void 0 ? void 0 : loggedInUserRights.data.getSSOUsername();
|
|
21
|
+
const { orgId, deploymentDevName, siteURL, scrt2URL, bootstrapScriptURL } = useChatConfig();
|
|
22
|
+
const ssoNameRef = useRef(ssoName);
|
|
23
|
+
ssoNameRef.current = ssoName;
|
|
31
24
|
useEffect(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
1-> Required Cookies
|
|
36
|
-
2-> Functional Cookies
|
|
37
|
-
3-> Advertising Cookies
|
|
38
|
-
we need to make sure 2 that indicates functional cookies is included in value
|
|
39
|
-
*/
|
|
40
|
-
var preferences = getCookieValue('cmapi_cookie_privacy');
|
|
41
|
-
if (preferences && preferences.includes('2')) {
|
|
42
|
-
// based on TrustArc cookie consent, cookie is allowed
|
|
43
|
-
enableScripts();
|
|
44
|
-
const initChatService = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
try {
|
|
46
|
-
yield waitForWindowVariable('embedded_svc', 10000);
|
|
47
|
-
initEmbedChat();
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
console.error('Error: Chat service not available', e.message);
|
|
51
|
-
setLoadingChat(false);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
initChatService();
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
25
|
+
var _a;
|
|
26
|
+
const preferences = getCookieValue('cmapi_cookie_privacy');
|
|
27
|
+
if (!preferences || !preferences.includes('2')) {
|
|
57
28
|
setHasBlockedByCookie(true);
|
|
58
|
-
}
|
|
59
|
-
setLoadingChat(false);
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
}, []);
|
|
62
|
-
const onStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
setLoadingChat(true);
|
|
64
|
-
try {
|
|
65
|
-
// if chat didn't start after a long wait
|
|
66
|
-
// then we assume browser has blocked the script
|
|
67
|
-
const blockedTimeOut = setTimeout(() => {
|
|
68
|
-
if (!window.$Lightning) {
|
|
69
|
-
setHasBlockedByBrowser(true);
|
|
70
|
-
setLoadingChat(false);
|
|
71
|
-
}
|
|
72
|
-
}, 10000);
|
|
73
|
-
yield window.embedded_svc.liveAgentAPI.startChat({
|
|
74
|
-
extraPrechatInfo: extraPreChatInfo,
|
|
75
|
-
extraPrechatFormDetails: getChatFormDetails(),
|
|
76
|
-
});
|
|
77
|
-
clearTimeout(blockedTimeOut);
|
|
78
|
-
setHasBlockedByBrowser(false);
|
|
79
|
-
setChatStart(true);
|
|
80
29
|
setLoadingChat(false);
|
|
30
|
+
return;
|
|
81
31
|
}
|
|
82
|
-
|
|
32
|
+
const onMessagingReady = () => {
|
|
33
|
+
window.embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({
|
|
34
|
+
username: ssoNameRef.current,
|
|
35
|
+
});
|
|
83
36
|
setLoadingChat(false);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
37
|
+
};
|
|
38
|
+
const initChat = () => {
|
|
39
|
+
try {
|
|
40
|
+
window.embeddedservice_bootstrap.settings.language = 'en_US';
|
|
41
|
+
window.embeddedservice_bootstrap.init(orgId, deploymentDevName, siteURL, { scrt2URL });
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
console.error('Error loading Enhanced Messaging: ', err);
|
|
45
|
+
setChatServiceNotAvailable(true);
|
|
46
|
+
setLoadingChat(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
window.addEventListener('onEmbeddedMessagingReady', onMessagingReady);
|
|
50
|
+
if ((_a = window.embeddedservice_bootstrap) === null || _a === void 0 ? void 0 : _a.prechatAPI) {
|
|
51
|
+
onMessagingReady();
|
|
91
52
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
console.log(e);
|
|
53
|
+
else if (window.embeddedservice_bootstrap) {
|
|
54
|
+
initChat();
|
|
95
55
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
window.embedded_svc.init(host, sandBox, gslbBaseURL, key, appName, extra);
|
|
105
|
-
// Fired when Embedded Service Chat has ended and the application is closed.
|
|
106
|
-
window.embedded_svc.addEventHandler('afterDestroy', function (data) {
|
|
107
|
-
setChatStart(false);
|
|
108
|
-
});
|
|
109
|
-
// if chat didn't initialized after a long wait then we assume
|
|
110
|
-
// chat domains blocked by client network or browser
|
|
111
|
-
const blockedByNetworkTimeOut = setTimeout(() => {
|
|
112
|
-
if (!window.liveAgentDeployment) {
|
|
113
|
-
setHasChatDomainsBlocked(true);
|
|
56
|
+
else {
|
|
57
|
+
const script = document.createElement('script');
|
|
58
|
+
script.src = bootstrapScriptURL;
|
|
59
|
+
script.type = 'text/javascript';
|
|
60
|
+
script.onload = initChat;
|
|
61
|
+
script.onerror = () => {
|
|
62
|
+
console.error('Failed to load Enhanced Messaging bootstrap script');
|
|
63
|
+
setChatServiceNotAvailable(true);
|
|
114
64
|
setLoadingChat(false);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
loadingChat,
|
|
125
|
-
isChatStarted,
|
|
126
|
-
hasBlockedByBrowser,
|
|
127
|
-
hasChatDomainsBlocked,
|
|
128
|
-
initEmbedChat,
|
|
129
|
-
onStartChat,
|
|
130
|
-
chatServiceNotAvailable,
|
|
131
|
-
hasBlockedByCookie,
|
|
132
|
-
getChatFormDetails,
|
|
133
|
-
};
|
|
65
|
+
};
|
|
66
|
+
document.body.appendChild(script);
|
|
67
|
+
}
|
|
68
|
+
return () => {
|
|
69
|
+
window.removeEventListener('onEmbeddedMessagingReady', onMessagingReady);
|
|
70
|
+
};
|
|
71
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
+
}, []);
|
|
73
|
+
return { loadingChat, chatServiceNotAvailable, hasBlockedByCookie };
|
|
134
74
|
};
|
|
@@ -5,7 +5,6 @@ import { IAccount, IPartnerManagedAccount } from '@cee-eng/hydrajs/@types/models
|
|
|
5
5
|
import { ISsoContact } from '@cee-eng/hydrajs/@types/models/contact';
|
|
6
6
|
import { IPreference } from '@cee-eng/hydrajs/@types/models/general';
|
|
7
7
|
import { IConfigurationResponse } from '@cee-eng/hydrajs/@types/models/maintenance';
|
|
8
|
-
import { ISEProductListParams } from '@cee-eng/hydrajs/@types/models/product';
|
|
9
8
|
import { IAction, IApiResponseDetails, IPortalJwtToken } from '@rh-support/types/shared';
|
|
10
9
|
import { UserAuth } from '@rh-support/user-permissions';
|
|
11
10
|
import { ITroubleshootProductResponse } from '@rh-support/utils';
|
|
@@ -78,7 +77,8 @@ export declare enum GlobalMetadataReducerConstants {
|
|
|
78
77
|
setReferrerUrl = "setReferrerUrl",
|
|
79
78
|
getNoclusteridreasons = "getNoclusteridreasons",
|
|
80
79
|
setIsSharingHostnameswithRHt = "setIsSharingHostnameswithRHt",
|
|
81
|
-
setCaseListTraditionalSupportAgreed = "setCaseListTraditionalSupportAgreed"
|
|
80
|
+
setCaseListTraditionalSupportAgreed = "setCaseListTraditionalSupportAgreed",
|
|
81
|
+
setCaseRecordTypes = "setCaseRecordTypes"
|
|
82
82
|
}
|
|
83
83
|
export type ICaseType = string;
|
|
84
84
|
export type ICaseSeverity = string;
|
|
@@ -99,6 +99,9 @@ export interface IBookmarkedGroupIds {
|
|
|
99
99
|
namespaceId: number;
|
|
100
100
|
valueTypeId: number;
|
|
101
101
|
}
|
|
102
|
+
export interface ICaseRecordTypeMap {
|
|
103
|
+
[name: string]: string;
|
|
104
|
+
}
|
|
102
105
|
export interface IGlobalMetadataState {
|
|
103
106
|
allCaseTypes: IApiResponseDetails<ICaseType[]>;
|
|
104
107
|
allCaseSeverities: IApiResponseDetails<ICaseSeverity[]>;
|
|
@@ -127,6 +130,7 @@ export interface IGlobalMetadataState {
|
|
|
127
130
|
accountCustomEmails: IApiResponseDetails<IAccountNotificationAddresses[]>;
|
|
128
131
|
referrerUrl: string;
|
|
129
132
|
caseNoClusterIdReasons: IApiResponseDetails<string[]>;
|
|
133
|
+
caseRecordTypes: IApiResponseDetails<ICaseRecordTypeMap>;
|
|
130
134
|
caseListTraditionalSupportAgreed: boolean;
|
|
131
135
|
}
|
|
132
136
|
export interface IGlobalMetadataPayloadType extends IGlobalMetadataState {
|
|
@@ -142,14 +146,40 @@ export declare const setReferrerUrl: (dispatch: GlobalMetadataReducerDispatchTyp
|
|
|
142
146
|
export declare const removeGroupedBookmarks: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], removedAccountsId: number[]) => void;
|
|
143
147
|
export declare const removeWholeGroup: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], rootBookmarIds: number[]) => void;
|
|
144
148
|
export declare const addEditbookmarks: (dispatch: GlobalMetadataReducerDispatchType, allBookmarks: IBookmark[], updatedAccounts: IBookmarkedAccounts, selectedAccounts: IBookmark[], group: string, accountsRemovedFromGroup?: IBookmark[]) => void;
|
|
145
|
-
export declare const fetchCaseTypes: (dispatch: GlobalMetadataReducerDispatchType,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export declare const
|
|
149
|
+
export declare const fetchCaseTypes: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
150
|
+
query: (options: any) => Promise<any>;
|
|
151
|
+
}) => Promise<void>;
|
|
152
|
+
export declare const fetchCaseTypesHydra: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
153
|
+
export declare const fetchCaseSeverities: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
154
|
+
query: (options: any) => Promise<any>;
|
|
155
|
+
}) => Promise<void>;
|
|
156
|
+
export declare const fetchCaseSeveritiesHydra: (dispatch: GlobalMetadataReducerDispatchType, isSecureSupport: boolean) => Promise<void>;
|
|
157
|
+
type CaseDetailsDispatch = (action: {
|
|
158
|
+
type: string;
|
|
159
|
+
payload?: unknown;
|
|
160
|
+
}) => void;
|
|
161
|
+
type CaseDetailsApolloClient = {
|
|
162
|
+
query: (options: any) => Promise<any>;
|
|
163
|
+
};
|
|
164
|
+
type SetCaseAccountNumberFn = (dispatch: CaseDetailsDispatch, accountNumber: string, isLoggedInUsersAccount?: boolean, loggedInUserAccount?: Partial<IAccount>, apolloClient?: CaseDetailsApolloClient) => Promise<void>;
|
|
165
|
+
export declare const fetchCaseDetails: (caseDispatch: CaseDetailsDispatch, apolloClient: CaseDetailsApolloClient, caseNumber: string, setCaseAccountNumber?: SetCaseAccountNumberFn) => Promise<void>;
|
|
166
|
+
export declare const fetchAllStatuses: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
167
|
+
query: (options: any) => Promise<any>;
|
|
168
|
+
}) => Promise<void>;
|
|
169
|
+
export declare const fetchProducts: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
170
|
+
query: (options: any) => Promise<any>;
|
|
171
|
+
}) => Promise<void>;
|
|
172
|
+
export declare const fetchCaseRecordTypes: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
173
|
+
query: (options: any) => Promise<any>;
|
|
174
|
+
}) => Promise<void>;
|
|
149
175
|
export declare const setAllProducts: (dispatch: GlobalMetadataReducerDispatchType, allProducts: ITroubleshootProductResponse) => void;
|
|
150
|
-
export declare const fetchLoggedInUsersAccount: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, silent?: boolean
|
|
176
|
+
export declare const fetchLoggedInUsersAccount: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, silent?: boolean, apolloClient?: {
|
|
177
|
+
query: (options: any) => Promise<any>;
|
|
178
|
+
}) => Promise<import("@rh-support/utils").IGraphQLAccountResult>;
|
|
151
179
|
export declare const fetchLoggedInUser: (dispatch: GlobalMetadataReducerDispatchType, token: Partial<IPortalJwtToken>, pcmConfig: any) => Promise<void>;
|
|
152
|
-
export declare const fetchLanguageMetadata: (dispatch: GlobalMetadataReducerDispatchType
|
|
180
|
+
export declare const fetchLanguageMetadata: (dispatch: GlobalMetadataReducerDispatchType, apolloClient: {
|
|
181
|
+
query: (options: any) => Promise<any>;
|
|
182
|
+
}) => Promise<void>;
|
|
153
183
|
export declare const fetchInternalStatusMetadata: (dispatch: GlobalMetadataReducerDispatchType) => Promise<void>;
|
|
154
184
|
export declare const fetchCaseSbrsMetadata: (dispatch: GlobalMetadataReducerDispatchType) => Promise<void>;
|
|
155
185
|
export declare const fetchCaseGroupsForSSO: (dispatch: GlobalMetadataReducerDispatchType, ssoUserName: string) => Promise<ICaseGroup[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalMetadataReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/GlobalMetadataReducer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GlobalMetadataReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/GlobalMetadataReducer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C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
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { accounts, caseMetadata, contacts, customEmail, maintenance,
|
|
11
|
-
import { getApiResourceObject,
|
|
10
|
+
import { accounts, caseMetadata, contacts, customEmail, maintenance, publicApi, userPreferences, } from '@cee-eng/hydrajs';
|
|
11
|
+
import { buildPicklistInput, fetchCaseDetailsByCaseNumber, fetchPicklistValues, GET_ACCOUNT, GET_CASE_RECORD_TYPES, GET_PRODUCTS, getAccountQueryVariables, getApiResourceObject, handleGraphQLAccountResponse, handleGraphQLProductsResponse, setCaseRecordTypes, severitySort, } from '@rh-support/utils';
|
|
12
12
|
import differenceBy from 'lodash/differenceBy';
|
|
13
13
|
import filter from 'lodash/filter';
|
|
14
14
|
import find from 'lodash/find';
|
|
@@ -80,6 +80,7 @@ export var GlobalMetadataReducerConstants;
|
|
|
80
80
|
GlobalMetadataReducerConstants["getNoclusteridreasons"] = "getNoclusteridreasons";
|
|
81
81
|
GlobalMetadataReducerConstants["setIsSharingHostnameswithRHt"] = "setIsSharingHostnameswithRHt";
|
|
82
82
|
GlobalMetadataReducerConstants["setCaseListTraditionalSupportAgreed"] = "setCaseListTraditionalSupportAgreed";
|
|
83
|
+
GlobalMetadataReducerConstants["setCaseRecordTypes"] = "setCaseRecordTypes";
|
|
83
84
|
})(GlobalMetadataReducerConstants || (GlobalMetadataReducerConstants = {}));
|
|
84
85
|
const initialProductResponse = {
|
|
85
86
|
topProducts: [],
|
|
@@ -118,6 +119,7 @@ export const initialGlobalMetadataState = {
|
|
|
118
119
|
},
|
|
119
120
|
referrerUrl: null,
|
|
120
121
|
caseNoClusterIdReasons: getApiResourceObject([]),
|
|
122
|
+
caseRecordTypes: getApiResourceObject({}),
|
|
121
123
|
caseListTraditionalSupportAgreed: false,
|
|
122
124
|
};
|
|
123
125
|
// Resucers
|
|
@@ -218,6 +220,9 @@ export const globalMetadataReducer = (pState, action) => {
|
|
|
218
220
|
case GlobalMetadataReducerConstants.setCaseListTraditionalSupportAgreed: {
|
|
219
221
|
return Object.assign(Object.assign({}, pState), { caseListTraditionalSupportAgreed: (_a = action.payload) === null || _a === void 0 ? void 0 : _a.caseListTraditionalSupportAgreed });
|
|
220
222
|
}
|
|
223
|
+
case GlobalMetadataReducerConstants.setCaseRecordTypes: {
|
|
224
|
+
return Object.assign(Object.assign({}, pState), { caseRecordTypes: action.payload.caseRecordTypes });
|
|
225
|
+
}
|
|
221
226
|
default: {
|
|
222
227
|
return pState;
|
|
223
228
|
}
|
|
@@ -278,7 +283,33 @@ export const addEditbookmarks = (dispatch, allBookmarks, updatedAccounts, select
|
|
|
278
283
|
payload: { bookmarkedGroupAccounts: getApiResourceObject(allBookmarksCopy, false) },
|
|
279
284
|
});
|
|
280
285
|
};
|
|
281
|
-
export const fetchCaseTypes = (dispatch,
|
|
286
|
+
export const fetchCaseTypes = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
287
|
+
var _a;
|
|
288
|
+
dispatch({
|
|
289
|
+
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
290
|
+
payload: { allCaseTypes: getApiResourceObject([], true) },
|
|
291
|
+
});
|
|
292
|
+
try {
|
|
293
|
+
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Type']));
|
|
294
|
+
const allCaseTypes = getProcessedCaseTypes((_a = picklists.Type) !== null && _a !== void 0 ? _a : []);
|
|
295
|
+
dispatch({
|
|
296
|
+
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
297
|
+
payload: { allCaseTypes: getApiResourceObject(allCaseTypes) },
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
catch (e) {
|
|
301
|
+
dispatch({
|
|
302
|
+
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
303
|
+
payload: { allCaseTypes: getApiResourceObject([], false, true, e.message) },
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
// const caseTypes = await caseMetadata.getTypes(isSecureSupport);
|
|
307
|
+
// dispatch({
|
|
308
|
+
// type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
309
|
+
// payload: { allCaseTypes: getApiResourceObject(getProcessedCaseTypes(caseTypes.items)) },
|
|
310
|
+
// });
|
|
311
|
+
});
|
|
312
|
+
export const fetchCaseTypesHydra = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
282
313
|
dispatch({
|
|
283
314
|
type: GlobalMetadataReducerConstants.setCaseTypes,
|
|
284
315
|
payload: { allCaseTypes: getApiResourceObject([], true) },
|
|
@@ -297,7 +328,28 @@ export const fetchCaseTypes = (dispatch, isSecureSupport) => __awaiter(void 0, v
|
|
|
297
328
|
});
|
|
298
329
|
}
|
|
299
330
|
});
|
|
300
|
-
export const fetchCaseSeverities = (dispatch,
|
|
331
|
+
export const fetchCaseSeverities = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
332
|
+
var _a;
|
|
333
|
+
dispatch({
|
|
334
|
+
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
335
|
+
payload: { allCaseSeverities: getApiResourceObject([], true) },
|
|
336
|
+
});
|
|
337
|
+
try {
|
|
338
|
+
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Priority']));
|
|
339
|
+
const allCaseSeverities = [...((_a = picklists.Priority) !== null && _a !== void 0 ? _a : [])].sort((sevA, sevB) => severitySort(sevA, sevB));
|
|
340
|
+
dispatch({
|
|
341
|
+
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
342
|
+
payload: { allCaseSeverities: getApiResourceObject(allCaseSeverities) },
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
dispatch({
|
|
347
|
+
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
348
|
+
payload: { allCaseSeverities: getApiResourceObject([], false, true, e.message) },
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
export const fetchCaseSeveritiesHydra = (dispatch, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
|
|
301
353
|
dispatch({
|
|
302
354
|
type: GlobalMetadataReducerConstants.setCaseSeverities,
|
|
303
355
|
payload: { allCaseSeverities: getApiResourceObject([], true) },
|
|
@@ -317,16 +369,54 @@ export const fetchCaseSeverities = (dispatch, isSecureSupport) => __awaiter(void
|
|
|
317
369
|
});
|
|
318
370
|
}
|
|
319
371
|
});
|
|
320
|
-
|
|
372
|
+
/** Case reducer action types — kept in sync with CaseReducerConstants in troubleshoot */
|
|
373
|
+
const CaseDetailsFetchActions = {
|
|
374
|
+
requestCaseDetails: 'requestCaseDetails',
|
|
375
|
+
receivedCaseDetails: 'receivedCaseDetails',
|
|
376
|
+
receivedCaseDetailsError: 'receivedCaseDetailsError',
|
|
377
|
+
};
|
|
378
|
+
export const fetchCaseDetails = (caseDispatch, apolloClient, caseNumber, setCaseAccountNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
379
|
+
var _a;
|
|
380
|
+
caseDispatch({
|
|
381
|
+
type: CaseDetailsFetchActions.requestCaseDetails,
|
|
382
|
+
payload: { caseDetails: { caseNumber } },
|
|
383
|
+
});
|
|
384
|
+
try {
|
|
385
|
+
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
386
|
+
if (!caseDetails) {
|
|
387
|
+
throw new Error(`Case ${caseNumber} was not found`);
|
|
388
|
+
}
|
|
389
|
+
caseDispatch({
|
|
390
|
+
type: CaseDetailsFetchActions.receivedCaseDetails,
|
|
391
|
+
payload: {
|
|
392
|
+
caseDetails,
|
|
393
|
+
isClosed: ((_a = caseDetails.status) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'closed',
|
|
394
|
+
caseNoOfCreatedCase: caseNumber,
|
|
395
|
+
},
|
|
396
|
+
});
|
|
397
|
+
if (setCaseAccountNumber) {
|
|
398
|
+
yield setCaseAccountNumber(caseDispatch, caseDetails.accountNumberRef, false, {}, apolloClient);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
caseDispatch({
|
|
403
|
+
type: CaseDetailsFetchActions.receivedCaseDetailsError,
|
|
404
|
+
payload: { caseDetailsError: error },
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
export const fetchAllStatuses = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
409
|
+
var _a;
|
|
321
410
|
dispatch({
|
|
322
411
|
type: GlobalMetadataReducerConstants.setCaseStatuses,
|
|
323
412
|
payload: { allCaseStatuses: getApiResourceObject([], true) },
|
|
324
413
|
});
|
|
325
414
|
try {
|
|
326
|
-
const
|
|
415
|
+
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Status']));
|
|
416
|
+
const allCaseStatuses = (_a = picklists.Status) !== null && _a !== void 0 ? _a : [];
|
|
327
417
|
dispatch({
|
|
328
418
|
type: GlobalMetadataReducerConstants.setCaseStatuses,
|
|
329
|
-
payload: { allCaseStatuses: getApiResourceObject(
|
|
419
|
+
payload: { allCaseStatuses: getApiResourceObject(allCaseStatuses) },
|
|
330
420
|
});
|
|
331
421
|
}
|
|
332
422
|
catch (e) {
|
|
@@ -336,25 +426,26 @@ export const fetchAllStatuses = (dispatch, isSecureSupport) => __awaiter(void 0,
|
|
|
336
426
|
});
|
|
337
427
|
}
|
|
338
428
|
});
|
|
339
|
-
export const fetchProducts = (
|
|
429
|
+
export const fetchProducts = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
430
|
+
var _a, _b, _c, _d;
|
|
340
431
|
try {
|
|
341
432
|
dispatch({
|
|
342
433
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
343
434
|
payload: { allProducts: getApiResourceObject(initialProductResponse, true) },
|
|
344
435
|
});
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
436
|
+
const { data } = yield apolloClient.query({
|
|
437
|
+
query: GET_PRODUCTS,
|
|
438
|
+
variables: {
|
|
439
|
+
where: {
|
|
440
|
+
ParentProduct__c: { eq: null },
|
|
441
|
+
IsActive: { eq: true },
|
|
442
|
+
},
|
|
443
|
+
first: 200,
|
|
444
|
+
orderBy: { Name: { order: 'ASC' } },
|
|
445
|
+
},
|
|
446
|
+
});
|
|
447
|
+
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportProduct2) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
448
|
+
const allProducts = handleGraphQLProductsResponse(edges);
|
|
358
449
|
dispatch({
|
|
359
450
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
360
451
|
payload: { allProducts: getApiResourceObject(allProducts) },
|
|
@@ -367,18 +458,51 @@ export const fetchProducts = (dispatch_1, ownerSSOUsername_1, ...args_1) => __aw
|
|
|
367
458
|
});
|
|
368
459
|
}
|
|
369
460
|
});
|
|
461
|
+
export const fetchCaseRecordTypes = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
462
|
+
var _a, _b, _c, _d;
|
|
463
|
+
dispatch({
|
|
464
|
+
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
465
|
+
payload: { caseRecordTypes: getApiResourceObject({}, true) },
|
|
466
|
+
});
|
|
467
|
+
try {
|
|
468
|
+
const { data } = yield apolloClient.query({
|
|
469
|
+
query: GET_CASE_RECORD_TYPES,
|
|
470
|
+
});
|
|
471
|
+
const recordTypeInfos = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.objectInfos) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.recordTypeInfos) !== null && _d !== void 0 ? _d : [];
|
|
472
|
+
const caseRecordTypes = {};
|
|
473
|
+
recordTypeInfos.forEach((info) => {
|
|
474
|
+
caseRecordTypes[info.name] = info.recordTypeId;
|
|
475
|
+
});
|
|
476
|
+
setCaseRecordTypes(caseRecordTypes);
|
|
477
|
+
dispatch({
|
|
478
|
+
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
479
|
+
payload: { caseRecordTypes: getApiResourceObject(caseRecordTypes) },
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
catch (e) {
|
|
483
|
+
dispatch({
|
|
484
|
+
type: GlobalMetadataReducerConstants.setCaseRecordTypes,
|
|
485
|
+
payload: { caseRecordTypes: getApiResourceObject({}, false, true, e.message) },
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
});
|
|
370
489
|
export const setAllProducts = (dispatch, allProducts) => {
|
|
371
490
|
dispatch({
|
|
372
491
|
type: GlobalMetadataReducerConstants.setAllProducts,
|
|
373
492
|
payload: { allProducts: getApiResourceObject(allProducts) },
|
|
374
493
|
});
|
|
375
494
|
};
|
|
376
|
-
export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __awaiter(void 0, [dispatch_1, token_1, ...args_1], void 0, function* (dispatch, token, silent = false) {
|
|
377
|
-
var _a;
|
|
495
|
+
export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __awaiter(void 0, [dispatch_1, token_1, ...args_1], void 0, function* (dispatch, token, silent = false, apolloClient) {
|
|
496
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
378
497
|
let accountNumber = token.account_number;
|
|
379
498
|
if (silent) {
|
|
380
499
|
try {
|
|
381
|
-
const
|
|
500
|
+
const { data } = yield apolloClient.query({
|
|
501
|
+
query: GET_ACCOUNT,
|
|
502
|
+
variables: getAccountQueryVariables(accountNumber),
|
|
503
|
+
});
|
|
504
|
+
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
505
|
+
const loggedInUsersAccount = handleGraphQLAccountResponse(edges);
|
|
382
506
|
dispatch({
|
|
383
507
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
384
508
|
payload: { loggedInUsersAccount: getApiResourceObject(loggedInUsersAccount) },
|
|
@@ -394,7 +518,13 @@ export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __a
|
|
|
394
518
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
395
519
|
payload: { loggedInUsersAccount: getApiResourceObject({}, true) },
|
|
396
520
|
});
|
|
397
|
-
const
|
|
521
|
+
const { data } = yield apolloClient.query({
|
|
522
|
+
query: GET_ACCOUNT,
|
|
523
|
+
variables: getAccountQueryVariables(accountNumber),
|
|
524
|
+
fetchPolicy: 'network-only',
|
|
525
|
+
});
|
|
526
|
+
const edges = (_h = (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f.SalesforceSupportAccount) === null || _g === void 0 ? void 0 : _g.edges) !== null && _h !== void 0 ? _h : [];
|
|
527
|
+
const loggedInUsersAccount = handleGraphQLAccountResponse(edges);
|
|
398
528
|
dispatch({
|
|
399
529
|
type: GlobalMetadataReducerConstants.setLoggedInUsersAccount,
|
|
400
530
|
payload: { loggedInUsersAccount: getApiResourceObject(loggedInUsersAccount) },
|
|
@@ -402,7 +532,7 @@ export const fetchLoggedInUsersAccount = (dispatch_1, token_1, ...args_1) => __a
|
|
|
402
532
|
return loggedInUsersAccount;
|
|
403
533
|
}
|
|
404
534
|
catch (e) {
|
|
405
|
-
(
|
|
535
|
+
(_j = window.sessionjs) === null || _j === void 0 ? void 0 : _j.reportProblem(e, {
|
|
406
536
|
tags: {
|
|
407
537
|
portal_app: window.app || 'Portal Case Management',
|
|
408
538
|
error_effect: 'PCM - App wide error',
|
|
@@ -424,7 +554,7 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
424
554
|
type: GlobalMetadataReducerConstants.setLoggedInUser,
|
|
425
555
|
payload: { loggedInUser: getApiResourceObject({}, true) },
|
|
426
556
|
});
|
|
427
|
-
|
|
557
|
+
const loggedInUser = yield contacts.getCurrentContact({
|
|
428
558
|
userId: token.sub,
|
|
429
559
|
assumeEntitledIfSubscriptionServiceUnavailable: true,
|
|
430
560
|
});
|
|
@@ -432,7 +562,7 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
432
562
|
type: GlobalMetadataReducerConstants.setLoggedInUser,
|
|
433
563
|
payload: { loggedInUser: getApiResourceObject(loggedInUser) },
|
|
434
564
|
});
|
|
435
|
-
//
|
|
565
|
+
// TODO: migrate to GraphQL - bookmark accounts skipped for now
|
|
436
566
|
const canViewBookmarkAccounts = loggedInUser.isInternal;
|
|
437
567
|
if (canViewBookmarkAccounts) {
|
|
438
568
|
fetchBookmarkedGroupAccounts(dispatch, loggedInUser.ssoUsername);
|
|
@@ -455,16 +585,18 @@ export const fetchLoggedInUser = (dispatch, token, pcmConfig) => __awaiter(void
|
|
|
455
585
|
});
|
|
456
586
|
}
|
|
457
587
|
});
|
|
458
|
-
export const fetchLanguageMetadata = (dispatch) => __awaiter(void 0, void 0, void 0, function* () {
|
|
588
|
+
export const fetchLanguageMetadata = (dispatch, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
589
|
+
var _a;
|
|
590
|
+
dispatch({
|
|
591
|
+
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
592
|
+
payload: { caseLanguages: getApiResourceObject([], true) },
|
|
593
|
+
});
|
|
459
594
|
try {
|
|
595
|
+
const picklists = yield fetchPicklistValues(apolloClient, buildPicklistInput(['Language']));
|
|
596
|
+
const caseLanguages = (_a = picklists.Language) !== null && _a !== void 0 ? _a : [];
|
|
460
597
|
dispatch({
|
|
461
598
|
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
462
|
-
payload: { caseLanguages: getApiResourceObject(
|
|
463
|
-
});
|
|
464
|
-
const response = yield caseMetadata.getLanguagesMetadata();
|
|
465
|
-
dispatch({
|
|
466
|
-
type: GlobalMetadataReducerConstants.setCaseLanguages,
|
|
467
|
-
payload: { caseLanguages: getApiResourceObject(response.items) },
|
|
599
|
+
payload: { caseLanguages: getApiResourceObject(caseLanguages) },
|
|
468
600
|
});
|
|
469
601
|
}
|
|
470
602
|
catch (e) {
|