@rh-support/troubleshoot 2.6.269 → 2.6.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.
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { ISessionItem } from '@cee-eng/hydrajs/@types/api/pcm/troubleshootSession';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { RouteComponentProps } from 'react-router-dom';
|
|
3
4
|
import { IRouteUrlParams } from '../../reducers/RouteConstNTypes';
|
|
4
5
|
interface IProps {
|
|
5
6
|
routeProps: RouteComponentProps<IRouteUrlParams>;
|
|
6
7
|
}
|
|
8
|
+
export declare const isSessionFromCurrentAuthCycle: (sessionItem: ISessionItem | undefined, currentLoginStartTime: number) => boolean;
|
|
7
9
|
export declare function SessionRestore(props: IProps): React.JSX.Element;
|
|
8
10
|
export {};
|
|
9
11
|
//# sourceMappingURL=SessionRestore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionRestore.d.ts","sourceRoot":"","sources":["../../../../src/components/SessionRestore/SessionRestore.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SessionRestore.d.ts","sourceRoot":"","sources":["../../../../src/components/SessionRestore/SessionRestore.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgC,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAQjH,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD,OAAO,EAGH,eAAe,EAElB,MAAM,iCAAiC,CAAC;AAmBzC,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,6BAA6B,GAAI,aAAa,YAAY,GAAG,SAAS,EAAE,uBAAuB,MAAM,YAKjH,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,qBAiX3C"}
|
|
@@ -32,7 +32,17 @@ import { restoreFilesFromSession } from '../shared/fileUpload/reducer/Attachment
|
|
|
32
32
|
import { AttachmentDispatchContext } from '../shared/fileUpload/reducer/AttachmentReducerContext';
|
|
33
33
|
import { RestoreLastSessionModal } from './RestoreLastSessionModal';
|
|
34
34
|
import { SessionRestoreCard } from './SessionRestoreCard';
|
|
35
|
+
export const isSessionFromCurrentAuthCycle = (sessionItem, currentLoginStartTime) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (isEmpty(sessionItem) || !currentLoginStartTime)
|
|
38
|
+
return true;
|
|
39
|
+
const sessionModifiedTime = Date.parse((_b = (_a = sessionItem === null || sessionItem === void 0 ? void 0 : sessionItem.session) === null || _a === void 0 ? void 0 : _a.modifiedDate) !== null && _b !== void 0 ? _b : '');
|
|
40
|
+
if (Number.isNaN(sessionModifiedTime))
|
|
41
|
+
return true;
|
|
42
|
+
return sessionModifiedTime >= currentLoginStartTime;
|
|
43
|
+
};
|
|
35
44
|
export function SessionRestore(props) {
|
|
45
|
+
var _a;
|
|
36
46
|
const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
|
|
37
47
|
const dispatchToAttachmentReducer = useContext(AttachmentDispatchContext);
|
|
38
48
|
const { sessionRestore } = useContext(SessionRestoreStateContext);
|
|
@@ -45,7 +55,7 @@ export function SessionRestore(props) {
|
|
|
45
55
|
ABTestVariation: state.ABTestVariation,
|
|
46
56
|
}), isEqual);
|
|
47
57
|
const caseDispatch = useCaseDispatch();
|
|
48
|
-
const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights, referrerUrl }, } = useContext(GlobalMetadataStateContext);
|
|
58
|
+
const { globalMetadataState: { loggedInUsersAccount, loggedInUserRights, referrerUrl, loggedInUserJwtToken }, } = useContext(GlobalMetadataStateContext);
|
|
49
59
|
const queryParamsFromUrl = RouteUtils.getQueryParams(props.routeProps);
|
|
50
60
|
const currentUrlSeSessionId = queryParamsFromUrl.seSessionId;
|
|
51
61
|
const previousUrlSeSessionId = usePrevious(currentUrlSeSessionId);
|
|
@@ -55,6 +65,7 @@ export function SessionRestore(props) {
|
|
|
55
65
|
const previousActiveSessionId = usePrevious(sessionRestore.activeSessionId);
|
|
56
66
|
const isFirstMountRef = useRef(true);
|
|
57
67
|
const { getMetadata } = useMetadata();
|
|
68
|
+
const currentLoginStartTime = ((_a = loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.iat) !== null && _a !== void 0 ? _a : 0) * 1000;
|
|
58
69
|
/**
|
|
59
70
|
* Fetching previous sessions on load
|
|
60
71
|
*/
|
|
@@ -90,8 +101,9 @@ export function SessionRestore(props) {
|
|
|
90
101
|
}
|
|
91
102
|
const currentRelevantSession = getRelevantSessionFromSessions(sessionRestoreDispatch, currentUrlSeSessionId, sessionRestore.previousSessions.data, caseDetails);
|
|
92
103
|
const relevantSession = sessionRestore.previousSessions.data[currentRelevantSession];
|
|
104
|
+
const canReuseRelevantSession = !isEmpty(relevantSession) && isSessionFromCurrentAuthCycle(relevantSession, currentLoginStartTime);
|
|
93
105
|
const setSession = () => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const needsNewSessionId = hasProductVersionOrSummary &&
|
|
106
|
+
const needsNewSessionId = hasProductVersionOrSummary && !canReuseRelevantSession;
|
|
95
107
|
if (needsNewSessionId) {
|
|
96
108
|
const userAgent = getUserAgentForCaseMode(isCaseCreate);
|
|
97
109
|
const userAgentAB = userAgent + (isEqual(ABTestVariation, 'A') ? '-A-1' : '-B-1');
|
|
@@ -105,7 +117,7 @@ export function SessionRestore(props) {
|
|
|
105
117
|
yield createSession(sessionRestoreDispatch, getSessionDetailsFromCase(caseDetails, selectedNotificationContacts), session);
|
|
106
118
|
}
|
|
107
119
|
}
|
|
108
|
-
else if (
|
|
120
|
+
else if (canReuseRelevantSession) {
|
|
109
121
|
// Checking if session needs to be restored based on found relevant session
|
|
110
122
|
// Found relevent session is not same as activeSessionId and is not being restored
|
|
111
123
|
if (currentRelevantSession !== sessionRestore.activeSessionId && !isRestoring) {
|
|
@@ -286,6 +298,7 @@ export function SessionRestore(props) {
|
|
|
286
298
|
if (sessionItem.session.id !== sessionRestore.activeSessionId &&
|
|
287
299
|
sessionItem.session.isActive &&
|
|
288
300
|
!sessionItem.session.isResolved &&
|
|
301
|
+
isSessionFromCurrentAuthCycle(sessionItem, currentLoginStartTime) &&
|
|
289
302
|
sessionItem.sessionDetails.summary &&
|
|
290
303
|
sessionItem.sessionDetails.product) {
|
|
291
304
|
previousSessions.push(sessionItem);
|
|
@@ -298,6 +311,7 @@ export function SessionRestore(props) {
|
|
|
298
311
|
var _a, _b, _c, _d, _e, _f;
|
|
299
312
|
return s.session.isActive &&
|
|
300
313
|
!s.session.isResolved &&
|
|
314
|
+
isSessionFromCurrentAuthCycle(s, currentLoginStartTime) &&
|
|
301
315
|
s.session.id !== sessionRestore.activeSessionId &&
|
|
302
316
|
((!isEmpty(caseDetails.product) && caseDetails.product === s.sessionDetails.product) ||
|
|
303
317
|
includes(((_a = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.summary) !== null && _a !== void 0 ? _a : '').toLowerCase(), ((_c = (_b = s === null || s === void 0 ? void 0 : s.sessionDetails) === null || _b === void 0 ? void 0 : _b.summary) !== null && _c !== void 0 ? _c : '').toLowerCase()) ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.271",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"defaults and supports es6-module",
|
|
128
128
|
"maintained node versions"
|
|
129
129
|
],
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "9353ee00eb30f15f0abf3f7e192ce6c134956454"
|
|
131
131
|
}
|