@rh-support/troubleshoot 2.0.7 → 2.0.9
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/components/AccountInfo/AccountSelector.d.ts.map +1 -1
- package/lib/esm/components/AccountInfo/AccountSelector.js +5 -44
- package/lib/esm/components/AccountInfo/OwnerSelector.js +2 -2
- package/lib/esm/components/CaseEditView/CaseDetailsAside.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsAside.js +3 -5
- package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/index.js +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +36 -38
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts +1 -2
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.js +3 -4
- package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +1 -1
- package/lib/esm/components/CaseEditView/ShareCase/PartnerShare.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/ShareCase/PartnerShare.js +1 -6
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +2 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInformation.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.js +1 -1
- package/lib/esm/components/CaseInformation/CaseGroup.js +2 -2
- package/lib/esm/components/CaseInformation/CaseInformation.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseInformation.js +8 -1
- package/lib/esm/components/CaseInformation/Description.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/Description.js +2 -4
- package/lib/esm/components/CaseInformation/OpenCaseIssue.js +2 -2
- package/lib/esm/components/CaseInformation/Severity.js +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.js +9 -2
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts +1 -5
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +7 -7
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +1 -4
- package/lib/esm/components/IdeaInformation/IdeaInformtion.d.ts.map +1 -1
- package/lib/esm/components/IdeaInformation/IdeaInformtion.js +8 -1
- package/lib/esm/components/ImproveCase/KtQuestions.js +2 -2
- package/lib/esm/components/Issue/Issue.d.ts.map +1 -1
- package/lib/esm/components/Issue/Issue.js +2 -1
- package/lib/esm/components/OpenCase/OpenCase.d.ts.map +1 -1
- package/lib/esm/components/OpenCase/OpenCase.js +9 -2
- package/lib/esm/components/OpenCase/SupportTypeSelectorPage.js +10 -10
- package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/AllProductsSelector.js +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/NewProductDropdownSelector.js +3 -3
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts +1 -1
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +3 -3
- package/lib/esm/components/ProductSelector/ProductSelector.js +2 -1
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.d.ts +2 -1
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.d.ts.map +1 -1
- package/lib/esm/components/ProductSelector/ProductSelectorLoader.js +19 -12
- package/lib/esm/components/ProductSelector/ProductVersionDropdownSelector.js +3 -3
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.d.ts.map +1 -1
- package/lib/esm/components/Recommendations/ClusterRecommendationToast.js +1 -2
- package/lib/esm/components/Recommendations/ClusterRecommendations.js +1 -1
- package/lib/esm/components/SessionRestore/RestoreLastSessionModal.js +1 -1
- package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
- package/lib/esm/components/SessionRestore/SessionRestore.js +9 -4
- package/lib/esm/components/SubmitCase/ResubmitToast.js +1 -1
- package/lib/esm/components/SubmitCase/SubmitCase.js +1 -1
- package/lib/esm/components/Suggestions/TopContent.js +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.js +2 -2
- package/lib/esm/components/shared/useIsSectionValid.d.ts +1 -1
- package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
- package/lib/esm/components/shared/useIsSectionValid.js +24 -5
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +80 -40
- package/lib/esm/components/wizardLayout/MainSection.d.ts +3 -5
- package/lib/esm/components/wizardLayout/MainSection.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/MainSection.js +4 -4
- package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardAside.js +10 -3
- package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardLayout.js +42 -31
- package/lib/esm/components/wizardLayout/WizardMain.d.ts +3 -2
- package/lib/esm/components/wizardLayout/WizardMain.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardMain.js +163 -43
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts +3 -7
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardNavigation.js +90 -46
- package/lib/esm/components/wizardLayout/WizardProgress.d.ts +13 -0
- package/lib/esm/components/wizardLayout/WizardProgress.d.ts.map +1 -0
- package/lib/esm/components/wizardLayout/WizardProgress.js +108 -0
- package/lib/esm/components/wizardLayout/index.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/index.js +10 -2
- package/lib/esm/context/AppMetadataContext.d.ts +11 -0
- package/lib/esm/context/AppMetadataContext.d.ts.map +1 -0
- package/lib/esm/context/AppMetadataContext.js +13 -0
- package/lib/esm/context/RootTroubleshootProvider.d.ts.map +1 -1
- package/lib/esm/context/RootTroubleshootProvider.js +9 -7
- package/lib/esm/css/app.css +450 -0
- package/lib/esm/hooks/useResetCaseCreate.d.ts.map +1 -1
- package/lib/esm/hooks/useResetCaseCreate.js +4 -0
- package/lib/esm/reducers/AppMetadataReducer.d.ts +28 -0
- package/lib/esm/reducers/AppMetadataReducer.d.ts.map +1 -0
- package/lib/esm/reducers/AppMetadataReducer.js +28 -0
- package/lib/esm/reducers/RouteConstNTypes.d.ts +1 -21
- package/lib/esm/reducers/RouteConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/RouteConstNTypes.js +0 -43
- package/lib/esm/reducers/RouteReducer.d.ts +47 -13
- package/lib/esm/reducers/RouteReducer.d.ts.map +1 -1
- package/lib/esm/reducers/RouteReducer.js +165 -36
- package/lib/esm/scss/_main.scss +786 -106
- package/lib/esm/utils/routeUtils.d.ts +9 -3
- package/lib/esm/utils/routeUtils.d.ts.map +1 -1
- package/lib/esm/utils/routeUtils.js +41 -14
- package/package.json +25 -14
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.d.ts +0 -12
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.d.ts.map +0 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/HandpickedItem.js +0 -14
- package/lib/esm/hooks/useWizard.d.ts +0 -4
- package/lib/esm/hooks/useWizard.d.ts.map +0 -1
- package/lib/esm/hooks/useWizard.js +0 -128
|
@@ -8,50 +8,7 @@ export var AppRouteSections;
|
|
|
8
8
|
AppRouteSections["MANAGEMENT"] = "management";
|
|
9
9
|
AppRouteSections["REVIEW"] = "review";
|
|
10
10
|
AppRouteSections["SUBMIT_CASE"] = "submit-case";
|
|
11
|
-
AppRouteSections["BREAK"] = "break";
|
|
12
11
|
})(AppRouteSections || (AppRouteSections = {}));
|
|
13
|
-
// start of wizard steps sequences
|
|
14
|
-
// - Note: use AppRouteSections.BREAK whenever you want partially show steps
|
|
15
|
-
// first and then reveal the rest at a certain point
|
|
16
|
-
export const openCaseNonTechnicalSequence = [
|
|
17
|
-
AppRouteSections.GET_SUPPORT,
|
|
18
|
-
AppRouteSections.SUMMARIZE,
|
|
19
|
-
AppRouteSections.DESCRIBE_IDEA,
|
|
20
|
-
];
|
|
21
|
-
export const troubleshootNonTechnicalSequence = [
|
|
22
|
-
AppRouteSections.SUMMARIZE,
|
|
23
|
-
AppRouteSections.TROUBLESHOOT,
|
|
24
|
-
AppRouteSections.GET_SUPPORT,
|
|
25
|
-
AppRouteSections.DESCRIBE_IDEA,
|
|
26
|
-
];
|
|
27
|
-
export const troubleshootRouteSectionsSequence = [
|
|
28
|
-
AppRouteSections.SUMMARIZE,
|
|
29
|
-
AppRouteSections.TROUBLESHOOT,
|
|
30
|
-
AppRouteSections.BREAK,
|
|
31
|
-
AppRouteSections.GET_SUPPORT,
|
|
32
|
-
AppRouteSections.DESCRIBE_MORE,
|
|
33
|
-
AppRouteSections.MANAGEMENT,
|
|
34
|
-
AppRouteSections.REVIEW,
|
|
35
|
-
];
|
|
36
|
-
export const searchIntentRouteSectionSequence = [
|
|
37
|
-
AppRouteSections.GET_SUPPORT,
|
|
38
|
-
AppRouteSections.SUMMARIZE,
|
|
39
|
-
AppRouteSections.BREAK,
|
|
40
|
-
AppRouteSections.TROUBLESHOOT,
|
|
41
|
-
AppRouteSections.DESCRIBE_MORE,
|
|
42
|
-
AppRouteSections.MANAGEMENT,
|
|
43
|
-
AppRouteSections.REVIEW,
|
|
44
|
-
];
|
|
45
|
-
export const openCaseRouteSectionSequence = [
|
|
46
|
-
AppRouteSections.GET_SUPPORT,
|
|
47
|
-
AppRouteSections.SUMMARIZE,
|
|
48
|
-
AppRouteSections.BREAK,
|
|
49
|
-
AppRouteSections.TROUBLESHOOT,
|
|
50
|
-
AppRouteSections.DESCRIBE_MORE,
|
|
51
|
-
AppRouteSections.MANAGEMENT,
|
|
52
|
-
AppRouteSections.REVIEW,
|
|
53
|
-
];
|
|
54
|
-
// end of wizard steps sequences
|
|
55
12
|
export const sessionRestoreCardSections = [AppRouteSections.GET_SUPPORT];
|
|
56
13
|
export const hideFileUploadSidebarWidgetSections = [
|
|
57
14
|
AppRouteSections.GET_SUPPORT,
|
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { IAction } from '@rh-support/types/shared';
|
|
2
2
|
import { AppRouteSections } from './RouteConstNTypes';
|
|
3
|
+
export interface ISectionConfiguration {
|
|
4
|
+
title: string;
|
|
5
|
+
stepName: string;
|
|
6
|
+
futureSections: AppRouteSections[];
|
|
7
|
+
previousSection: AppRouteSections | null;
|
|
8
|
+
nextSection?: AppRouteSections | null;
|
|
9
|
+
showBackToSection: boolean;
|
|
10
|
+
backToSection: AppRouteSections;
|
|
11
|
+
backToSectionLabel: string;
|
|
12
|
+
nextButtonLabel: string;
|
|
13
|
+
previousButtonLabel: string;
|
|
14
|
+
showOpenCaseButton: boolean;
|
|
15
|
+
openCaseButtonLabel: string;
|
|
16
|
+
showNewIssueButton: boolean;
|
|
17
|
+
newIssueButtonLabel: string;
|
|
18
|
+
disableOtherSections: boolean;
|
|
19
|
+
hideAside: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ISectionConfigurations {
|
|
22
|
+
[key: string]: ISectionConfiguration;
|
|
23
|
+
}
|
|
3
24
|
export interface IRouteState {
|
|
4
|
-
|
|
25
|
+
completedSections: AppRouteSections[];
|
|
26
|
+
visitedSections: AppRouteSections[];
|
|
27
|
+
activeSection: AppRouteSections;
|
|
28
|
+
sectionsToHide: AppRouteSections[];
|
|
5
29
|
isCaseCreate: boolean;
|
|
6
30
|
isSearchIntent: boolean;
|
|
7
|
-
|
|
8
|
-
noValidEntitlement: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare enum RouteReducerConstants {
|
|
11
|
-
activeSectionChanged = "activeSectionChanged",
|
|
12
|
-
setRouteFlags = "setRouteFlags",
|
|
13
|
-
setisNextBtnClickedToShowValidationError = "setisNextBtnClickedToShowValidationError",
|
|
14
|
-
setNoValidEntitlement = "setNoValidEntitlement"
|
|
31
|
+
showValidationErrorAlert: boolean;
|
|
15
32
|
}
|
|
16
33
|
export interface IRoutePayloadType extends IRouteState {
|
|
17
34
|
isIdea: boolean;
|
|
@@ -19,12 +36,29 @@ export interface IRoutePayloadType extends IRouteState {
|
|
|
19
36
|
}
|
|
20
37
|
declare type IActionType = IAction<RouteReducerConstants, IRoutePayloadType>;
|
|
21
38
|
export declare type RouteReducerDispatchType = (value: IActionType) => void;
|
|
39
|
+
export declare enum RouteReducerConstants {
|
|
40
|
+
activeSectionChanged = "activeSectionChanged",
|
|
41
|
+
updateSectionsToHide = "updateSectionsToHide",
|
|
42
|
+
setIsCaseCreate = "setIsCaseCreate",
|
|
43
|
+
setIsSearchIntent = "setIsSearchIntent",
|
|
44
|
+
updateAppRouteSectionSequence = "updateAppRouteSectionSequence",
|
|
45
|
+
updateVisitedSections = "updateVisitedSections",
|
|
46
|
+
setShowValidationErrorAlert = "setShowValidationErrorAlert",
|
|
47
|
+
resetRouteState = "resetRouteState"
|
|
48
|
+
}
|
|
49
|
+
export declare const troubleshootingSections: AppRouteSections[];
|
|
50
|
+
export declare const troubleshootRouteSectionsSequence: AppRouteSections[];
|
|
51
|
+
export declare const openCaseRouteSectionSequence: AppRouteSections[];
|
|
52
|
+
export declare const searchIntentRouteSectionSequence: AppRouteSections[];
|
|
53
|
+
export declare const openCaseNonTechnicalSequence: AppRouteSections[];
|
|
54
|
+
export declare const troubleshootNonTechnicalSequence: AppRouteSections[];
|
|
55
|
+
export declare function getAppRouteSectionsSequence(sectionsToHide: AppRouteSections[], isCaseCreate: boolean, isSearchIntent: boolean, isIdea: boolean): AppRouteSections[];
|
|
22
56
|
export declare function isSearchIntent(isCaseCreate: boolean, summary: string): boolean;
|
|
57
|
+
export declare function isNextSectionCaseCreation(activeSection: AppRouteSections, nextSection: AppRouteSections): boolean;
|
|
58
|
+
export declare function getDefaultSection(isCaseCreate: boolean, isSearchIntent: boolean, isIdea: boolean): AppRouteSections;
|
|
59
|
+
export declare function getRouteSequence(isCaseCreate: boolean, isSearchIntent: boolean, isIdea: boolean): AppRouteSections[];
|
|
60
|
+
export declare function getAppRouteConfugurations(isCaseCreate: boolean, isIdea: boolean, product?: string): ISectionConfigurations;
|
|
23
61
|
export declare const initialRouteReducerState: IRouteState;
|
|
24
62
|
export declare const routeReducer: (pState: IRouteState, action: IActionType) => IRouteState;
|
|
25
|
-
export declare const setNoValidEntitlement: (dispatch: RouteReducerDispatchType, noValidEntitlement: boolean) => void;
|
|
26
|
-
export declare const setRouteFlags: (dispatch: RouteReducerDispatchType, isCaseCreate: boolean, isSearchIntent: boolean) => void;
|
|
27
|
-
export declare const setActiveSectionChanged: (dispatch: RouteReducerDispatchType, activeSection: AppRouteSections) => void;
|
|
28
|
-
export declare const updateisNextBtnClickedToShowValidationError: (dispatch: RouteReducerDispatchType, isNextBtnClickedToShowValidationError: boolean) => void;
|
|
29
63
|
export {};
|
|
30
64
|
//# sourceMappingURL=RouteReducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/RouteReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RouteReducer.d.ts","sourceRoot":"","sources":["../../../src/re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rC,YAAY,EAAE,OAAO,EACrB,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,MAAM,GACjB,sBAAsB,CAkGxB;AAGD,eAAO,MAAM,wBAAwB,EAAE,WAQtC,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,WAAW,0BAAwB,WAgFvE,CAAC"}
|
|
@@ -1,61 +1,190 @@
|
|
|
1
|
-
import isEmpty from 'lodash
|
|
1
|
+
import { isEmpty } from 'lodash';
|
|
2
|
+
import difference from 'lodash/difference';
|
|
3
|
+
import forEach from 'lodash/forEach';
|
|
4
|
+
import uniq from 'lodash/uniq';
|
|
5
|
+
import RouteUtils from '../utils/routeUtils';
|
|
6
|
+
import { AppRouteSections } from './RouteConstNTypes';
|
|
2
7
|
// Constants
|
|
3
8
|
export var RouteReducerConstants;
|
|
4
9
|
(function (RouteReducerConstants) {
|
|
5
10
|
RouteReducerConstants["activeSectionChanged"] = "activeSectionChanged";
|
|
6
|
-
RouteReducerConstants["
|
|
7
|
-
RouteReducerConstants["
|
|
8
|
-
RouteReducerConstants["
|
|
11
|
+
RouteReducerConstants["updateSectionsToHide"] = "updateSectionsToHide";
|
|
12
|
+
RouteReducerConstants["setIsCaseCreate"] = "setIsCaseCreate";
|
|
13
|
+
RouteReducerConstants["setIsSearchIntent"] = "setIsSearchIntent";
|
|
14
|
+
RouteReducerConstants["updateAppRouteSectionSequence"] = "updateAppRouteSectionSequence";
|
|
15
|
+
RouteReducerConstants["updateVisitedSections"] = "updateVisitedSections";
|
|
16
|
+
RouteReducerConstants["setShowValidationErrorAlert"] = "setShowValidationErrorAlert";
|
|
17
|
+
RouteReducerConstants["resetRouteState"] = "resetRouteState";
|
|
9
18
|
})(RouteReducerConstants || (RouteReducerConstants = {}));
|
|
19
|
+
export const troubleshootingSections = [AppRouteSections.SUMMARIZE, AppRouteSections.TROUBLESHOOT];
|
|
20
|
+
export const troubleshootRouteSectionsSequence = [
|
|
21
|
+
AppRouteSections.SUMMARIZE,
|
|
22
|
+
AppRouteSections.TROUBLESHOOT,
|
|
23
|
+
AppRouteSections.GET_SUPPORT,
|
|
24
|
+
AppRouteSections.DESCRIBE_MORE,
|
|
25
|
+
AppRouteSections.MANAGEMENT,
|
|
26
|
+
AppRouteSections.REVIEW,
|
|
27
|
+
AppRouteSections.SUBMIT_CASE,
|
|
28
|
+
];
|
|
29
|
+
export const openCaseRouteSectionSequence = [
|
|
30
|
+
AppRouteSections.GET_SUPPORT,
|
|
31
|
+
AppRouteSections.SUMMARIZE,
|
|
32
|
+
AppRouteSections.TROUBLESHOOT,
|
|
33
|
+
AppRouteSections.DESCRIBE_MORE,
|
|
34
|
+
AppRouteSections.MANAGEMENT,
|
|
35
|
+
AppRouteSections.REVIEW,
|
|
36
|
+
AppRouteSections.SUBMIT_CASE,
|
|
37
|
+
];
|
|
38
|
+
export const searchIntentRouteSectionSequence = [
|
|
39
|
+
AppRouteSections.GET_SUPPORT,
|
|
40
|
+
AppRouteSections.SUMMARIZE,
|
|
41
|
+
AppRouteSections.TROUBLESHOOT,
|
|
42
|
+
AppRouteSections.DESCRIBE_MORE,
|
|
43
|
+
AppRouteSections.MANAGEMENT,
|
|
44
|
+
AppRouteSections.REVIEW,
|
|
45
|
+
AppRouteSections.SUBMIT_CASE,
|
|
46
|
+
];
|
|
47
|
+
export const openCaseNonTechnicalSequence = [
|
|
48
|
+
AppRouteSections.GET_SUPPORT,
|
|
49
|
+
AppRouteSections.SUMMARIZE,
|
|
50
|
+
AppRouteSections.DESCRIBE_IDEA,
|
|
51
|
+
AppRouteSections.SUBMIT_CASE,
|
|
52
|
+
];
|
|
53
|
+
export const troubleshootNonTechnicalSequence = [
|
|
54
|
+
AppRouteSections.SUMMARIZE,
|
|
55
|
+
AppRouteSections.TROUBLESHOOT,
|
|
56
|
+
AppRouteSections.GET_SUPPORT,
|
|
57
|
+
AppRouteSections.DESCRIBE_IDEA,
|
|
58
|
+
AppRouteSections.SUBMIT_CASE,
|
|
59
|
+
];
|
|
60
|
+
const defaultRouteConfiguration = {
|
|
61
|
+
title: '',
|
|
62
|
+
stepName: '',
|
|
63
|
+
previousSection: null,
|
|
64
|
+
nextSection: null,
|
|
65
|
+
futureSections: [],
|
|
66
|
+
disableOtherSections: false,
|
|
67
|
+
showBackToSection: false,
|
|
68
|
+
backToSection: AppRouteSections.GET_SUPPORT,
|
|
69
|
+
backToSectionLabel: 'Back to open case',
|
|
70
|
+
nextButtonLabel: 'Continue',
|
|
71
|
+
previousButtonLabel: 'Go back',
|
|
72
|
+
showOpenCaseButton: false,
|
|
73
|
+
openCaseButtonLabel: 'View this case',
|
|
74
|
+
showNewIssueButton: false,
|
|
75
|
+
newIssueButtonLabel: 'Troubleshoot a new issue',
|
|
76
|
+
hideAside: false,
|
|
77
|
+
};
|
|
78
|
+
export function getAppRouteSectionsSequence(sectionsToHide, isCaseCreate, isSearchIntent, isIdea) {
|
|
79
|
+
const routeSequence = getRouteSequence(isCaseCreate, isSearchIntent, isIdea);
|
|
80
|
+
return difference(routeSequence, sectionsToHide);
|
|
81
|
+
}
|
|
10
82
|
export function isSearchIntent(isCaseCreate, summary) {
|
|
11
83
|
return !isCaseCreate && !isEmpty(summary);
|
|
12
84
|
}
|
|
85
|
+
export function isNextSectionCaseCreation(activeSection, nextSection) {
|
|
86
|
+
return troubleshootingSections.includes(activeSection) && !troubleshootingSections.includes(nextSection);
|
|
87
|
+
}
|
|
88
|
+
export function getDefaultSection(isCaseCreate, isSearchIntent, isIdea) {
|
|
89
|
+
return getRouteSequence(isCaseCreate, isSearchIntent, isIdea)[0];
|
|
90
|
+
}
|
|
91
|
+
export function getRouteSequence(isCaseCreate, isSearchIntent, isIdea) {
|
|
92
|
+
let routeSequence = isSearchIntent
|
|
93
|
+
? searchIntentRouteSectionSequence
|
|
94
|
+
: isCaseCreate
|
|
95
|
+
? openCaseRouteSectionSequence
|
|
96
|
+
: troubleshootRouteSectionsSequence;
|
|
97
|
+
if (isIdea) {
|
|
98
|
+
if (isCaseCreate) {
|
|
99
|
+
routeSequence = openCaseNonTechnicalSequence;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
routeSequence = troubleshootNonTechnicalSequence;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return routeSequence || troubleshootRouteSectionsSequence;
|
|
106
|
+
}
|
|
107
|
+
export function getAppRouteConfugurations(isCaseCreate, isIdea, product) {
|
|
108
|
+
const appRouteConfugurations = {
|
|
109
|
+
[AppRouteSections.GET_SUPPORT]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Why are you opening a case?', stepName: 'Get support', previousSection: isCaseCreate ? null : AppRouteSections.TROUBLESHOOT, nextSection: isCaseCreate
|
|
110
|
+
? AppRouteSections.SUMMARIZE
|
|
111
|
+
: isIdea
|
|
112
|
+
? AppRouteSections.DESCRIBE_IDEA
|
|
113
|
+
: AppRouteSections.DESCRIBE_MORE, futureSections: isCaseCreate && isIdea
|
|
114
|
+
? [AppRouteSections.SUMMARIZE, AppRouteSections.DESCRIBE_IDEA]
|
|
115
|
+
: isCaseCreate && !isIdea
|
|
116
|
+
? [AppRouteSections.SUMMARIZE]
|
|
117
|
+
: isIdea
|
|
118
|
+
? [AppRouteSections.DESCRIBE_IDEA]
|
|
119
|
+
: [AppRouteSections.DESCRIBE_MORE, AppRouteSections.MANAGEMENT, AppRouteSections.REVIEW] }),
|
|
120
|
+
[AppRouteSections.SUMMARIZE]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'What are you having an issue with?', stepName: 'Summarize', previousSection: isCaseCreate ? AppRouteSections.GET_SUPPORT : null, nextSection: isCaseCreate && isIdea ? AppRouteSections.DESCRIBE_IDEA : AppRouteSections.TROUBLESHOOT, futureSections: isCaseCreate && isIdea
|
|
121
|
+
? [AppRouteSections.DESCRIBE_IDEA]
|
|
122
|
+
: isCaseCreate && !isIdea
|
|
123
|
+
? []
|
|
124
|
+
: [AppRouteSections.TROUBLESHOOT] }),
|
|
125
|
+
[AppRouteSections.TROUBLESHOOT]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Recommendations', stepName: 'Troubleshoot', nextButtonLabel: isCaseCreate ? 'Continue' : 'Get support', previousSection: AppRouteSections.SUMMARIZE, nextSection: isCaseCreate ? AppRouteSections.DESCRIBE_MORE : AppRouteSections.GET_SUPPORT, futureSections: isCaseCreate
|
|
126
|
+
? [AppRouteSections.DESCRIBE_MORE, AppRouteSections.MANAGEMENT, AppRouteSections.REVIEW]
|
|
127
|
+
: [] }),
|
|
128
|
+
[AppRouteSections.DESCRIBE_MORE]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Case information', stepName: 'Describe more', previousSection: isCaseCreate ? AppRouteSections.TROUBLESHOOT : AppRouteSections.GET_SUPPORT, nextSection: AppRouteSections.MANAGEMENT, futureSections: [AppRouteSections.MANAGEMENT, AppRouteSections.REVIEW] }),
|
|
129
|
+
[AppRouteSections.DESCRIBE_IDEA]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Idea information', stepName: 'Describe more', nextButtonLabel: 'Submit', disableOtherSections: false, previousSection: isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.GET_SUPPORT, nextSection: AppRouteSections.SUBMIT_CASE, futureSections: [], hideAside: false }),
|
|
130
|
+
[AppRouteSections.MANAGEMENT]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Case management', stepName: 'Management', previousSection: AppRouteSections.DESCRIBE_MORE, nextSection: AppRouteSections.REVIEW, futureSections: [AppRouteSections.REVIEW] }),
|
|
131
|
+
[AppRouteSections.REVIEW]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Preview case', stepName: 'Review', nextButtonLabel: 'Submit', previousSection: AppRouteSections.MANAGEMENT, nextSection: AppRouteSections.SUBMIT_CASE, futureSections: [] }),
|
|
132
|
+
[AppRouteSections.SUBMIT_CASE]: Object.assign(Object.assign({}, defaultRouteConfiguration), { title: 'Case has been submitted', stepName: 'Submit', disableOtherSections: true, hideAside: false, previousSection: null, showOpenCaseButton: false, showNewIssueButton: false, showBackToSection: true, backToSection: AppRouteSections.SUMMARIZE, backToSectionLabel: 'Back to open case', nextSection: null, futureSections: [] }),
|
|
133
|
+
};
|
|
134
|
+
return appRouteConfugurations;
|
|
135
|
+
}
|
|
13
136
|
// Reducer
|
|
14
137
|
export const initialRouteReducerState = {
|
|
15
|
-
activeSection:
|
|
138
|
+
activeSection: troubleshootRouteSectionsSequence[0],
|
|
139
|
+
completedSections: [],
|
|
140
|
+
visitedSections: [],
|
|
141
|
+
sectionsToHide: [],
|
|
16
142
|
isCaseCreate: false,
|
|
17
143
|
isSearchIntent: false,
|
|
18
|
-
|
|
19
|
-
noValidEntitlement: false,
|
|
144
|
+
showValidationErrorAlert: false,
|
|
20
145
|
};
|
|
21
146
|
export const routeReducer = (pState, action) => {
|
|
22
|
-
var _a, _b, _c, _d, _e;
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
23
148
|
switch (action.type) {
|
|
24
149
|
case RouteReducerConstants.activeSectionChanged: {
|
|
25
|
-
|
|
150
|
+
const activeSection = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.activeSection;
|
|
151
|
+
const completedSections = RouteUtils.getCompletedSectionsForActiveSection(activeSection, getAppRouteSectionsSequence((_b = action.payload) === null || _b === void 0 ? void 0 : _b.sectionsToHide, (_c = action.payload) === null || _c === void 0 ? void 0 : _c.isCaseCreate, (_d = action.payload) === null || _d === void 0 ? void 0 : _d.isSearchIntent, (_e = action.payload) === null || _e === void 0 ? void 0 : _e.isIdea), (_f = action.payload) === null || _f === void 0 ? void 0 : _f.isCaseCreate, (_g = action.payload) === null || _g === void 0 ? void 0 : _g.isSearchIntent, (_h = action.payload) === null || _h === void 0 ? void 0 : _h.isIdea);
|
|
152
|
+
const visitedSections = !((_j = action.payload) === null || _j === void 0 ? void 0 : _j.visitedSections.includes(activeSection))
|
|
153
|
+
? [...(_k = action.payload) === null || _k === void 0 ? void 0 : _k.visitedSections, activeSection]
|
|
154
|
+
: (_l = action.payload) === null || _l === void 0 ? void 0 : _l.visitedSections;
|
|
155
|
+
return Object.assign(Object.assign({}, pState), { completedSections, activeSection, visitedSections });
|
|
26
156
|
}
|
|
27
|
-
case RouteReducerConstants.
|
|
28
|
-
return Object.assign(Object.assign({}, pState), { isCaseCreate: (
|
|
157
|
+
case RouteReducerConstants.setIsCaseCreate: {
|
|
158
|
+
return Object.assign(Object.assign({}, pState), { isCaseCreate: (_m = action.payload) === null || _m === void 0 ? void 0 : _m.isCaseCreate });
|
|
29
159
|
}
|
|
30
|
-
case RouteReducerConstants.
|
|
31
|
-
return Object.assign(Object.assign({}, pState), {
|
|
160
|
+
case RouteReducerConstants.setIsSearchIntent: {
|
|
161
|
+
return Object.assign(Object.assign({}, pState), { isSearchIntent: (_o = action.payload) === null || _o === void 0 ? void 0 : _o.isSearchIntent });
|
|
32
162
|
}
|
|
33
|
-
case RouteReducerConstants.
|
|
34
|
-
|
|
163
|
+
case RouteReducerConstants.updateAppRouteSectionSequence: {
|
|
164
|
+
const appRouteSectionsSequence = getAppRouteSectionsSequence((_p = action.payload) === null || _p === void 0 ? void 0 : _p.sectionsToHide, (_q = action.payload) === null || _q === void 0 ? void 0 : _q.isCaseCreate, (_r = action.payload) === null || _r === void 0 ? void 0 : _r.isSearchIntent, ((_s = action.payload) === null || _s === void 0 ? void 0 : _s.isIdea) || false);
|
|
165
|
+
const completedSections = RouteUtils.getCompletedSectionsForActiveSection(action.payload.activeSection, appRouteSectionsSequence, (_t = action.payload) === null || _t === void 0 ? void 0 : _t.isCaseCreate, (_u = action.payload) === null || _u === void 0 ? void 0 : _u.isSearchIntent, ((_v = action.payload) === null || _v === void 0 ? void 0 : _v.isIdea) || false);
|
|
166
|
+
return Object.assign(Object.assign({}, pState), { completedSections, activeSection: action.payload.activeSection });
|
|
167
|
+
}
|
|
168
|
+
case RouteReducerConstants.updateSectionsToHide: {
|
|
169
|
+
const updatedSectionsToHide = uniq(action.payload.sectionsToHide);
|
|
170
|
+
const appRouteConfugurations = getAppRouteConfugurations((_w = action.payload) === null || _w === void 0 ? void 0 : _w.isCaseCreate, (_x = action.payload) === null || _x === void 0 ? void 0 : _x.isIdea, (_y = action.payload) === null || _y === void 0 ? void 0 : _y.product);
|
|
171
|
+
forEach(updatedSectionsToHide, (hiddenSection) => {
|
|
172
|
+
var _a, _b, _c;
|
|
173
|
+
appRouteConfugurations[hiddenSection] = getAppRouteConfugurations((_a = action.payload) === null || _a === void 0 ? void 0 : _a.isCaseCreate, (_b = action.payload) === null || _b === void 0 ? void 0 : _b.isIdea, (_c = action.payload) === null || _c === void 0 ? void 0 : _c.product)[hiddenSection];
|
|
174
|
+
});
|
|
175
|
+
return Object.assign(Object.assign({}, pState), { sectionsToHide: updatedSectionsToHide });
|
|
176
|
+
}
|
|
177
|
+
case RouteReducerConstants.updateVisitedSections: {
|
|
178
|
+
return Object.assign(Object.assign({}, pState), { visitedSections: action.payload.visitedSections });
|
|
179
|
+
}
|
|
180
|
+
case RouteReducerConstants.resetRouteState: {
|
|
181
|
+
return Object.assign(Object.assign({}, pState), { sectionsToHide: [], visitedSections: [] });
|
|
182
|
+
}
|
|
183
|
+
case RouteReducerConstants.setShowValidationErrorAlert: {
|
|
184
|
+
return Object.assign(Object.assign({}, pState), { showValidationErrorAlert: action.payload.showValidationErrorAlert });
|
|
35
185
|
}
|
|
36
186
|
default: {
|
|
37
187
|
return pState;
|
|
38
188
|
}
|
|
39
189
|
}
|
|
40
190
|
};
|
|
41
|
-
export const setNoValidEntitlement = (dispatch, noValidEntitlement) => {
|
|
42
|
-
dispatch({ type: RouteReducerConstants.setNoValidEntitlement, payload: { noValidEntitlement } });
|
|
43
|
-
};
|
|
44
|
-
export const setRouteFlags = (dispatch, isCaseCreate, isSearchIntent) => {
|
|
45
|
-
dispatch({
|
|
46
|
-
type: RouteReducerConstants.setRouteFlags,
|
|
47
|
-
payload: { isCaseCreate: isCaseCreate, isSearchIntent: isSearchIntent },
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
export const setActiveSectionChanged = (dispatch, activeSection) => {
|
|
51
|
-
dispatch({
|
|
52
|
-
type: RouteReducerConstants.activeSectionChanged,
|
|
53
|
-
payload: { activeSection },
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
export const updateisNextBtnClickedToShowValidationError = (dispatch, isNextBtnClickedToShowValidationError) => {
|
|
57
|
-
dispatch({
|
|
58
|
-
type: RouteReducerConstants.setisNextBtnClickedToShowValidationError,
|
|
59
|
-
payload: { isNextBtnClickedToShowValidationError },
|
|
60
|
-
});
|
|
61
|
-
};
|