@rh-support/troubleshoot 2.6.103 → 2.6.118

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 (50) hide show
  1. package/lib/esm/components/AccountInfo/AccountSelector.js +1 -1
  2. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  3. package/lib/esm/components/CaseEditView/Case.js +1 -1
  4. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +3 -3
  5. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummaryErrorMessage.js +1 -1
  6. package/lib/esm/components/CaseInformation/Description.d.ts.map +1 -1
  7. package/lib/esm/components/CaseInformation/Description.js +3 -1
  8. package/lib/esm/components/OpenCase/OpenCase.d.ts.map +1 -1
  9. package/lib/esm/components/OpenCase/OpenCase.js +2 -8
  10. package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
  11. package/lib/esm/components/ProductSelector/AllProductsSelector.js +6 -18
  12. package/lib/esm/components/ProductSelector/ProductSelector.d.ts.map +1 -1
  13. package/lib/esm/components/ProductSelector/ProductSelector.js +5 -12
  14. package/lib/esm/components/Recommendations/Recommendations.d.ts.map +1 -1
  15. package/lib/esm/components/Recommendations/Recommendations.js +38 -38
  16. package/lib/esm/components/RemoteRider/RemoteRiderAcceptanceModal.d.ts.map +1 -1
  17. package/lib/esm/components/Review/Review.d.ts.map +1 -1
  18. package/lib/esm/components/Review/Review.js +1 -5
  19. package/lib/esm/components/Suggestions/TopContentSidebar.d.ts +3 -0
  20. package/lib/esm/components/Suggestions/TopContentSidebar.d.ts.map +1 -0
  21. package/lib/esm/components/Suggestions/TopContentSidebar.js +26 -0
  22. package/lib/esm/components/TroubleshootSection/AskRedHat.js +1 -1
  23. package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts +9 -0
  24. package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts.map +1 -1
  25. package/lib/esm/components/TroubleshootSection/TroubleshootSection.js +150 -44
  26. package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
  27. package/lib/esm/components/shared/useIsSectionValid.js +26 -65
  28. package/lib/esm/components/wizardLayout/WizardAside.d.ts.map +1 -1
  29. package/lib/esm/components/wizardLayout/WizardAside.js +18 -9
  30. package/lib/esm/components/wizardLayout/WizardMain.d.ts.map +1 -1
  31. package/lib/esm/components/wizardLayout/WizardMain.js +110 -64
  32. package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
  33. package/lib/esm/components/wizardLayout/WizardNavigation.js +59 -53
  34. package/lib/esm/css/AskRedHat.css +9 -2
  35. package/lib/esm/hooks/useAB.d.ts +22 -0
  36. package/lib/esm/hooks/useAB.d.ts.map +1 -0
  37. package/lib/esm/hooks/useAB.js +37 -0
  38. package/lib/esm/hooks/useWizard.d.ts +4 -0
  39. package/lib/esm/hooks/useWizard.d.ts.map +1 -1
  40. package/lib/esm/hooks/useWizard.js +20 -6
  41. package/lib/esm/reducers/AIResponseConstNTypes.d.ts +17 -2
  42. package/lib/esm/reducers/AIResponseConstNTypes.d.ts.map +1 -1
  43. package/lib/esm/reducers/AIResponseConstNTypes.js +3 -0
  44. package/lib/esm/reducers/AIResponseReducer.d.ts +2 -0
  45. package/lib/esm/reducers/AIResponseReducer.d.ts.map +1 -1
  46. package/lib/esm/reducers/AIResponseReducer.js +17 -0
  47. package/lib/esm/reducers/CaseDiscussionTabReducer.js +1 -1
  48. package/lib/esm/reducers/RouteConstNTypes.d.ts.map +1 -1
  49. package/lib/esm/reducers/RouteConstNTypes.js +0 -1
  50. package/package.json +7 -7
@@ -22,9 +22,10 @@ import { Env } from '@cee-eng/hydrajs';
22
22
  import { getRHDirectHealthCheck, getRHDirectStatusCheck, } from '@ifd-ui/ask-redhat-core';
23
23
  import { Wizard, WizardNav, WizardNavItem, WizardStep, } from '@patternfly/react-core';
24
24
  import { LoadingIndicator } from '@rh-support/components';
25
+ import isEmpty from 'lodash/isEmpty';
25
26
  import isEqual from 'lodash/isEqual';
26
27
  import trim from 'lodash/trim';
27
- import React, { Suspense, useContext, useEffect, useRef, useState } from 'react';
28
+ import React, { Suspense, useCallback, useContext, useEffect, useRef, useState } from 'react';
28
29
  import { useTranslation } from 'react-i18next';
29
30
  import { Route } from 'react-router-dom';
30
31
  import { useAIResponseState } from '../../context/AIResponseContext';
@@ -32,6 +33,7 @@ import { useCaseSelector } from '../../context/CaseContext';
32
33
  import { RecommendationDispatchContext } from '../../context/RecommendationContext';
33
34
  import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
34
35
  import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
36
+ import { useAB } from '../../hooks/useAB';
35
37
  import { useARHResponse } from '../../hooks/useARHResponse';
36
38
  import { useWizard } from '../../hooks/useWizard';
37
39
  import { appSourceId_ARH, excludedCaseTypesforARH } from '../../reducers/CaseConstNTypes';
@@ -88,7 +90,8 @@ export const generateAIQuestion = (activeSection, product, version, summary, iss
88
90
  return `${prefix} ${baseMessageMap[lang] || baseMessageMap.en}`;
89
91
  };
90
92
  function WizardMain(props) {
91
- var _a, _b, _c;
93
+ var _a, _b, _c, _d;
94
+ const { isVariationA } = useAB();
92
95
  const [showRestFlag, setShowRestFlag] = useState(false);
93
96
  const [aiServicesAvailable, setAIServicesAvailable] = useState(false); // default to false until services are confirmed available
94
97
  const recommendationDispatch = useContext(RecommendationDispatchContext);
@@ -101,24 +104,6 @@ function WizardMain(props) {
101
104
  }), isEqual);
102
105
  const { routeState: { isCaseCreate, activeSection }, } = useContext(RouteContext);
103
106
  const aiResponseState = useAIResponseState();
104
- const config = {
105
- appSourceId: appSourceId_ARH,
106
- authToken: (_b = (_a = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _a === void 0 ? void 0 : _a.getEncodedToken()) !== null && _b !== void 0 ? _b : '',
107
- packageVersion: (_c = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _c === void 0 ? void 0 : _c.packageVersion,
108
- appEnv: Env.getEnvName(),
109
- };
110
- const { fetchARHResponse } = useARHResponse({
111
- activeSection,
112
- product: caseDetails.product,
113
- version: caseDetails.version,
114
- summary: caseDetails.summary,
115
- issue: caseDetails.issue,
116
- caseType: caseDetails.caseType,
117
- config,
118
- });
119
- const isTroubleshootSection = activeSection === AppRouteSections.TROUBLESHOOT;
120
- const isResourcesSection = activeSection === AppRouteSections.RESOURCES;
121
- const isSummarizeSection = activeSection === AppRouteSections.SUMMARIZE;
122
107
  const [userSeenRecommendations, setUserSeenRecommendations] = useState(false);
123
108
  const [userClickedNextonRecommendations, setUserClickedNextonRecommendations] = useState(false);
124
109
  const [userScrolledLabel, setUserScrolledLabel] = useState(false);
@@ -127,17 +112,68 @@ function WizardMain(props) {
127
112
  const isNextButtonClickedRef = useRef(false);
128
113
  const isBackButtonClickedRef = useRef(false);
129
114
  const resultsRowRef = useRef(null);
115
+ const goToPrevStepRef = useRef(null);
116
+ //to track the previous ARH fields
130
117
  const previousARHFieldsRef = useRef({
131
- product: caseDetails.product,
132
- version: caseDetails.version,
133
- summary: caseDetails.summary,
134
- issue: caseDetails.issue,
135
- caseType: caseDetails.caseType,
118
+ product: '',
119
+ version: '',
120
+ summary: '',
121
+ issue: '',
122
+ caseType: '',
136
123
  });
137
124
  const haveARHFieldsChangedRef = useRef(false);
138
125
  const handleChatWithAIClick = () => {
139
126
  props.setIsAIChatMode(true);
140
127
  };
128
+ const handleOnBackForExpandedARH = (e) => {
129
+ if (goToPrevStepRef.current) {
130
+ isBackButtonClickedRef.current = true;
131
+ goToPrevStepRef.current(e);
132
+ focusWizardMainPanel();
133
+ }
134
+ };
135
+ // Callback for TroubleshootSection to reset the flag on unmount
136
+ const resetARHFieldsChanged = useCallback(() => {
137
+ haveARHFieldsChangedRef.current = false;
138
+ }, []);
139
+ // Check if any of the ARH-related fields have changed
140
+ useEffect(() => {
141
+ var _a;
142
+ const prev = previousARHFieldsRef.current;
143
+ const curr = {
144
+ product: caseDetails.product,
145
+ version: caseDetails.version,
146
+ summary: trim(caseDetails.summary),
147
+ issue: trim(caseDetails.issue),
148
+ caseType: caseDetails.caseType,
149
+ };
150
+ const hasChanged = prev.product !== curr.product ||
151
+ prev.version !== curr.version ||
152
+ prev.summary !== curr.summary ||
153
+ prev.issue !== curr.issue ||
154
+ prev.caseType !== curr.caseType;
155
+ if (hasChanged) {
156
+ const previousHadValues = !isEmpty(prev.product) || !isEmpty(prev.version) || !isEmpty(prev.summary) || !isEmpty(prev.issue);
157
+ const hasExistingConversation = !isEmpty((_a = aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId);
158
+ if (previousHadValues && hasExistingConversation) {
159
+ haveARHFieldsChangedRef.current = true;
160
+ }
161
+ previousARHFieldsRef.current = {
162
+ product: curr.product,
163
+ version: curr.version,
164
+ summary: curr.summary,
165
+ issue: curr.issue,
166
+ caseType: curr.caseType,
167
+ };
168
+ }
169
+ }, [
170
+ caseDetails.product,
171
+ caseDetails.version,
172
+ caseDetails.summary,
173
+ caseDetails.issue,
174
+ caseDetails.caseType,
175
+ (_a = aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId,
176
+ ]);
141
177
  const { getStepsSequece } = useWizard(props.routeProps, {
142
178
  userSeenRecommendationsfn: setUserSeenRecommendations,
143
179
  userSeenRecommendationsValue: userSeenRecommendations,
@@ -151,47 +187,15 @@ function WizardMain(props) {
151
187
  aiServicesAvailable: aiServicesAvailable,
152
188
  isSecureSupport: props.isSecureSupport,
153
189
  hasConfirmedStatesideSupport: props.hasConfirmedStatesideSupport,
190
+ onBack: handleOnBackForExpandedARH,
191
+ haveARHFieldsChanged: haveARHFieldsChangedRef.current,
192
+ resetARHFieldsChanged,
154
193
  });
155
194
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
156
195
  const { t } = useTranslation();
157
196
  useEffect(() => {
158
197
  setActiveSectionChanged(dispatchToRouteReducer, isCaseCreate ? AppRouteSections.GET_SUPPORT : AppRouteSections.TROUBLESHOOT, '');
159
198
  }, [isCaseCreate, dispatchToRouteReducer]);
160
- const shouldEnableARHServices = () => {
161
- // Check if the current section is relevant for AI services
162
- const isRelevantSection = isTroubleshootSection || isSummarizeSection || isResourcesSection;
163
- // Check if the case type is allowed (not in the excluded list)
164
- const isCaseTypeAllowed = !excludedCaseTypesforARH.includes(caseDetails.caseType || '');
165
- // Check if user is not a secure support or confirmed stateside support user
166
- const isNotSecureOrStatesideUser = !props.isSecureSupport && !props.hasConfirmedStatesideSupport;
167
- // Check if the ARH fields have changed
168
- const isARHFieldsChanged = haveARHFieldsChangedRef.current;
169
- // Check if user is external and has invalid entitlements
170
- const isNotUnentitledExternalUser = !(props.isUserExternal && props.hasInvalidEntitlements);
171
- return (isRelevantSection &&
172
- isCaseTypeAllowed &&
173
- isNotSecureOrStatesideUser &&
174
- isARHFieldsChanged &&
175
- isNotUnentitledExternalUser);
176
- };
177
- // Check if any of the ARH-related fields have changed
178
- useEffect(() => {
179
- const hasChanged = previousARHFieldsRef.current.product !== caseDetails.product ||
180
- previousARHFieldsRef.current.version !== caseDetails.version ||
181
- previousARHFieldsRef.current.summary !== trim(caseDetails.summary) ||
182
- previousARHFieldsRef.current.issue !== trim(caseDetails.issue) ||
183
- previousARHFieldsRef.current.caseType !== caseDetails.caseType;
184
- if (hasChanged) {
185
- previousARHFieldsRef.current = {
186
- product: caseDetails.product,
187
- version: caseDetails.version,
188
- summary: caseDetails.summary,
189
- issue: caseDetails.issue,
190
- caseType: caseDetails.caseType,
191
- };
192
- haveARHFieldsChangedRef.current = true;
193
- }
194
- }, [caseDetails.product, caseDetails.version, caseDetails.summary, caseDetails.issue, caseDetails.caseType]);
195
199
  useEffect(() => {
196
200
  if (!activeSection) {
197
201
  return;
@@ -247,10 +251,10 @@ function WizardMain(props) {
247
251
  RouteUtils.navigateToSection(props.routeProps, `${props.routeProps.location.pathname}/${step.id}`, false);
248
252
  };
249
253
  const onBack = (step, prevStep) => {
250
- // isLoadingRecommendations needs to be set to false on back when the previous step is the summary
251
- // step because it can cause the next button to be permanently disabled if the debounce is not called
254
+ // isLoadingRecommendations needs to be set to false when going back TO the summary step
255
+ // because it can cause the next button to be permanently disabled if the debounce is not called
252
256
  // before going back a step. This can be caused if navigating quickly to then away from the recommendations page.
253
- if (prevStep.id === AppRouteSections.SUMMARIZE) {
257
+ if (step.id === AppRouteSections.SUMMARIZE) {
254
258
  recommendationDispatch({
255
259
  type: RecommendationsConstants.setIsLoadingRecommendations,
256
260
  payload: { isLoadingRecommendations: false },
@@ -264,6 +268,47 @@ function WizardMain(props) {
264
268
  props.submitCaseAndNavigate(false);
265
269
  return;
266
270
  };
271
+ const config = {
272
+ appSourceId: appSourceId_ARH,
273
+ authToken: (_c = (_b = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _b === void 0 ? void 0 : _b.getEncodedToken()) !== null && _c !== void 0 ? _c : '',
274
+ packageVersion: (_d = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _d === void 0 ? void 0 : _d.packageVersion,
275
+ appEnv: Env.getEnvName(),
276
+ };
277
+ const { fetchARHResponse } = useARHResponse({
278
+ activeSection,
279
+ product: caseDetails.product,
280
+ version: caseDetails.version,
281
+ summary: caseDetails.summary,
282
+ issue: caseDetails.issue,
283
+ caseType: caseDetails.caseType,
284
+ config,
285
+ });
286
+ const isTroubleshootSection = activeSection === AppRouteSections.TROUBLESHOOT;
287
+ const isResourcesSection = activeSection === AppRouteSections.RESOURCES;
288
+ const isSummarizeSection = activeSection === AppRouteSections.SUMMARIZE;
289
+ const shouldEnableARHServices = () => {
290
+ // Check if the current section is relevant for AI services
291
+ const isRelevantSection = isTroubleshootSection || isSummarizeSection || isResourcesSection;
292
+ // Check if the case type is allowed (not in the excluded list)
293
+ const isCaseTypeAllowed = !excludedCaseTypesforARH.includes(caseDetails.caseType || '');
294
+ // Check if user is not a secure support or confirmed stateside support user
295
+ const isNotSecureOrStatesideUser = !props.isSecureSupport && !props.hasConfirmedStatesideSupport;
296
+ // Check if the ARH fields have changed
297
+ const isARHFieldsChanged = haveARHFieldsChangedRef.current;
298
+ // Check if user is external and has invalid entitlements
299
+ const isNotUnentitledExternalUser = !(props.isUserExternal && props.hasInvalidEntitlements);
300
+ // For variation B, check if we have valid fields to make the API call (even if fields haven't changed)
301
+ const hasValidFieldsForVariationB = !isVariationA &&
302
+ !isEmpty(caseDetails.product) &&
303
+ !isEmpty(caseDetails.version) &&
304
+ !isEmpty(trim(caseDetails.summary)) &&
305
+ !isEmpty(trim(caseDetails.issue));
306
+ return (isRelevantSection &&
307
+ isCaseTypeAllowed &&
308
+ isNotSecureOrStatesideUser &&
309
+ (isARHFieldsChanged || hasValidFieldsForVariationB) &&
310
+ isNotUnentitledExternalUser);
311
+ };
267
312
  const onCurrentStepChanged = (event, currentStep, prevStep, scope) => {
268
313
  if (isNextButtonClickedRef.current) {
269
314
  onNext(currentStep);
@@ -292,6 +337,7 @@ function WizardMain(props) {
292
337
  return (React.createElement(WizardNavItem, { key: step.id, id: step.id, content: step.name, isCurrent: activeStep.id === step.id, isDisabled: !step.canJumpTo, stepIndex: step.index, onClick: () => goToStepByIndex(step.index) }));
293
338
  })));
294
339
  const CustomFooter = (activeStep, goToNextStep, goToPrevStep) => {
340
+ goToPrevStepRef.current = goToPrevStep;
295
341
  useEffect(() => {
296
342
  if (steps.length > 2 && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.index) === 2 && isNextButtonClicked) {
297
343
  goToNextStep({});
@@ -305,7 +351,7 @@ function WizardMain(props) {
305
351
  goToNextStep({});
306
352
  focusWizardMainPanel();
307
353
  // Fetch ARH response if conditions are met
308
- if (shouldEnableARHServices() && aiServicesAvailable) {
354
+ if (shouldEnableARHServices() && aiServicesAvailable && !isVariationA) {
309
355
  yield fetchARHResponse();
310
356
  haveARHFieldsChangedRef.current = false;
311
357
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"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AE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACjF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAqatC;kBAraQ,gBAAgB;;;AAuazB,eAAe,gBAAgB,CAAC"}
@@ -17,10 +17,12 @@ import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
18
18
  import React, { useContext, useEffect, useRef, useState } from 'react';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
+ import { useAIResponseState } from '../../context/AIResponseContext';
20
21
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
21
22
  import { RecommendationStateContext } from '../../context/RecommendationContext';
22
23
  import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
23
24
  import { SessionRestoreStateContext } from '../../context/SessionRestoreContext';
25
+ import { useAB } from '../../hooks/useAB';
24
26
  import { excludedCaseTypesforARH } from '../../reducers/CaseConstNTypes';
25
27
  import { setCaseState } from '../../reducers/CaseReducer';
26
28
  import { AppRouteSections } from '../../reducers/RouteConstNTypes';
@@ -32,22 +34,21 @@ const defaultProps = {};
32
34
  function WizardNavigation(props) {
33
35
  var _a, _b;
34
36
  const { t } = useTranslation();
37
+ const { isVariationA } = useAB();
35
38
  const canCreateCase = useCanCreateCase();
36
39
  const { recommendationState } = useContext(RecommendationStateContext);
40
+ const aiResponseState = useAIResponseState();
37
41
  const { routeState: { activeSection, isNextBtnClickedToShowValidationError, noValidEntitlement, isSearchIntent, isCaseCreate, }, } = useContext(RouteContext);
38
42
  const { globalMetadataState: { loggedInUsersAccount, allProducts, navBarRef }, } = useContext(GlobalMetadataStateContext);
39
- const { caseState, ABTestVariation, issue, summary, product, version, caseType, manageSupportCases } = useCaseSelector((state) => ({
43
+ const { caseState, issue, summary, product, version, caseType } = useCaseSelector((state) => ({
40
44
  caseState: state,
41
45
  issue: state.caseDetails.issue,
42
46
  summary: state.caseDetails.summary,
43
- ABTestVariation: state.ABTestVariation,
44
47
  product: state.caseDetails.product,
45
48
  version: state.caseDetails.version,
46
49
  caseType: state.caseDetails.caseType,
47
50
  manageSupportCases: state.selectedOwner.data.manageSupportCases,
48
51
  }), isEqual);
49
- const isATestvariation = ABTestVariation === 'A';
50
- const isBTestvariation = ABTestVariation === 'B' || isEmpty(ABTestVariation);
51
52
  // To check if the user is entitled or not
52
53
  const isEntitledProduct = (_b = find((_a = allProducts === null || allProducts === void 0 ? void 0 : allProducts.data) === null || _a === void 0 ? void 0 : _a.productsResult, (p) => p.product === caseState.caseDetails.product)) === null || _b === void 0 ? void 0 : _b.isEntitledProduct;
53
54
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
@@ -78,18 +79,37 @@ function WizardNavigation(props) {
78
79
  behavior: 'instant',
79
80
  });
80
81
  }
82
+ // Reset scroll state when navigating based on isVariationA
83
+ const resetScrollSection = isVariationA
84
+ ? AppRouteSections.RESOURCES
85
+ : isCaseCreate
86
+ ? AppRouteSections.SUMMARIZE
87
+ : AppRouteSections.TROUBLESHOOT;
88
+ if (props.activeStep.id === resetScrollSection) {
89
+ setHasUserScrolled(false);
90
+ }
81
91
  // eslint-disable-next-line react-hooks/exhaustive-deps
82
92
  }, [previousStep === null || previousStep === void 0 ? void 0 : previousStep.id, props.activeStep.id]);
83
93
  const [hasUserScrolled, setHasUserScrolled] = useState(false);
94
+ const [shouldOpenChatbot, setShouldOpenChatbot] = useState(false);
84
95
  useEffect(() => {
85
- var _a;
96
+ var _a, _b;
86
97
  if (activeSection !== AppRouteSections.RESOURCES && props.isAIChatMode) {
87
98
  (_a = props.setIsAIChatMode) === null || _a === void 0 ? void 0 : _a.call(props, false);
88
99
  }
100
+ if (activeSection === AppRouteSections.RESOURCES && shouldOpenChatbot) {
101
+ (_b = props.setIsAIChatMode) === null || _b === void 0 ? void 0 : _b.call(props, true);
102
+ setShouldOpenChatbot(false);
103
+ }
89
104
  // eslint-disable-next-line react-hooks/exhaustive-deps
90
- }, [activeSection]);
105
+ }, [activeSection, shouldOpenChatbot]);
91
106
  useEffect(() => {
92
- if (props.activeStep.id !== (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) {
107
+ const validSteps = isVariationA
108
+ ? [AppRouteSections.RESOURCES]
109
+ : isCaseCreate
110
+ ? [AppRouteSections.SUMMARIZE]
111
+ : [AppRouteSections.TROUBLESHOOT];
112
+ if (!validSteps.includes(props.activeStep.id)) {
93
113
  return;
94
114
  }
95
115
  const observer = new IntersectionObserver(([entry]) => {
@@ -147,13 +167,21 @@ function WizardNavigation(props) {
147
167
  observer.unobserve(resultsRowElement);
148
168
  }
149
169
  };
150
- }, [recommendationState.numFound, hasUserScrolled, props, isCaseCreate]);
170
+ }, [recommendationState.numFound, hasUserScrolled, props, isCaseCreate, isVariationA]);
151
171
  const onNext = (e) => {
152
172
  var _a;
153
173
  updateisNextBtnClickedToShowValidationError(dispatchToRouteReducer, true);
154
- //handle the new changes for 13406:
155
- if (props.activeStep.id === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT) &&
156
- recommendationState.numFound > 2) {
174
+ if (isVariationA &&
175
+ activeSection === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) {
176
+ setShouldOpenChatbot(true);
177
+ }
178
+ // Handle scroll behavior based on isVariationA
179
+ const scrollSection = isVariationA
180
+ ? AppRouteSections.RESOURCES
181
+ : isCaseCreate
182
+ ? AppRouteSections.SUMMARIZE
183
+ : AppRouteSections.TROUBLESHOOT;
184
+ if (props.activeStep.id === scrollSection && recommendationState.numFound > 2) {
157
185
  if (!hasUserScrolled) {
158
186
  scrollIntoView(props.resultsRowRef, {
159
187
  navBarRef,
@@ -223,60 +251,38 @@ function WizardNavigation(props) {
223
251
  const isLoadingARH = props.isLoadingARH &&
224
252
  props.activeStep.id === AppRouteSections.RESOURCES &&
225
253
  !excludedCaseTypesforARH.includes(caseType || '');
226
- if (isBTestvariation) {
227
- let value = isLoadingARH ||
228
- ((isEmpty(summary) || isEmpty(issue) || isEmpty(product) || isEmpty(version)) &&
229
- props.activeStep.id ===
230
- (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) ||
231
- (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
232
- props.activeStep.nextButtonLabel === 'Troubleshoot' ||
233
- (!isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
234
- (noValidEntitlement && props.activeStep.id != AppRouteSections.TROUBLESHOOT) ||
235
- (!manageSupportCases && props.activeStep.id === AppRouteSections.GET_SUPPORT) ||
236
- recommendationState.isLoadingRecommendations;
237
- return value;
238
- }
239
- else if (isATestvariation) {
240
- let value = isLoadingARH ||
241
- ((isEmpty(summary) || isEmpty(issue) || isEmpty(product) || isEmpty(version)) &&
242
- props.activeStep.id ===
243
- (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) ||
244
- (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
245
- props.activeStep.nextButtonLabel === 'Troubleshoot' ||
246
- (!isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
247
- (noValidEntitlement && props.activeStep.id != AppRouteSections.TROUBLESHOOT) ||
248
- (!manageSupportCases && props.activeStep.id === AppRouteSections.GET_SUPPORT) ||
249
- recommendationState.isLoadingRecommendations;
250
- return value;
251
- }
252
- else if (isATestvariation && !isCaseCreate) {
253
- let value = isLoadingARH ||
254
- isEmpty(summary) ||
255
- isEmpty(issue) ||
256
- (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
257
- (!isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
258
- (noValidEntitlement && props.activeStep.id != AppRouteSections.TROUBLESHOOT) ||
259
- (!manageSupportCases && props.activeStep.id === AppRouteSections.GET_SUPPORT) ||
260
- recommendationState.isLoadingRecommendations;
261
- return value;
262
- }
254
+ const shouldCheckRecommendationsLoading = !isVariationA && recommendationState.isLoadingRecommendations;
255
+ let value = isLoadingARH ||
256
+ ((isEmpty(summary) || isEmpty(issue) || isEmpty(product) || isEmpty(version)) &&
257
+ props.activeStep.id === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT)) ||
258
+ (!isEntitledProductLocal && props.activeStep.nextButtonLabel === 'Get support') ||
259
+ props.activeStep.nextButtonLabel === 'Troubleshoot' ||
260
+ (isSectionValidFn && !isSectionValidFn(props.activeStep.id) && isNextBtnClickedToShowValidationError) ||
261
+ noValidEntitlement ||
262
+ shouldCheckRecommendationsLoading;
263
+ return value;
263
264
  };
264
265
  const isDisabledGoBack = () => {
265
- if (isBTestvariation || isEmpty(ABTestVariation))
266
- return false;
267
- if (isATestvariation && props.activeStep.id === 'get-support') {
266
+ if (props.activeStep.id === 'get-support') {
268
267
  return isEmpty(product) || isEmpty(version);
269
268
  }
269
+ return false;
270
270
  };
271
+ const shouldShowNewARHFlowFooterButtons = isVariationA && props.isAIChatMode && activeSection === AppRouteSections.RESOURCES;
272
+ const shouldShowBackToAIButton = isVariationA && !props.isAIChatMode && activeSection === AppRouteSections.RESOURCES;
271
273
  // To handle entitled products
272
274
  return (React.createElement(React.Fragment, null,
273
275
  React.createElement(WizardFooterWrapper, null,
274
- props.isAIChatMode && activeSection === AppRouteSections.RESOURCES ? (isCaseCreate ? (React.createElement("span", null,
276
+ shouldShowNewARHFlowFooterButtons ? (React.createElement(React.Fragment, null,
277
+ props.activeStep.order !== 0 && (React.createElement("button", { onClick: () => onBack({}), className: "btn btn-app btn-open-white main-nav-button", "data-tracking-id": `prev-of-${activeSection}`, type: "button" }, t('Go back'))),
278
+ React.createElement("button", { onClick: () => { var _a; return (_a = props.setIsAIChatMode) === null || _a === void 0 ? void 0 : _a.call(props, false); }, className: "btn btn-app btn-primary main-nav-button", type: "button", disabled: !aiResponseState.hasChunkReceived }, t('See more resources')))) : props.isAIChatMode && activeSection === AppRouteSections.RESOURCES ? (isCaseCreate ? (React.createElement("span", null,
275
279
  React.createElement(Trans, { i18nKey: "<span>Return to</span> <button>case creation</button>", components: {
276
280
  span: React.createElement("span", { className: "return-to-case-text" }),
277
281
  button: (React.createElement(Button, { className: "return-to-case-btn", variant: "link", component: "a", onClick: props.onReturnToCaseCreation })),
278
282
  } }))) : (React.createElement(Button, { onClick: props.onReturnToCaseCreation, variant: "link", className: "return-to-resources-btn" }, t('Back to resources')))) : (React.createElement(React.Fragment, null,
279
- props.activeStep.order !== 0 && (React.createElement("button", { onClick: () => onBack({}), className: "btn btn-app btn-open-white main-nav-button", "data-tracking-id": `prev-of-${activeSection}`, type: "button", disabled: isDisabledGoBack() }, t('Go back'))),
283
+ props.activeStep.order !== 0 && (React.createElement("button", { onClick: shouldShowBackToAIButton
284
+ ? () => { var _a; return (_a = props.setIsAIChatMode) === null || _a === void 0 ? void 0 : _a.call(props, true); }
285
+ : () => onBack({}), className: "btn btn-app btn-open-white main-nav-button", "data-tracking-id": `prev-of-${activeSection}`, type: "button", disabled: !shouldShowBackToAIButton && isDisabledGoBack() }, shouldShowBackToAIButton ? t('Back to AI') : t('Go back'))),
280
286
  React.createElement("button", { disabled: nextButtonDisabledLogic(), onClick: onNext, className: "btn btn-app btn-primary main-nav-button", "data-tracking-id": `next-of-${activeSection}`, type: "button" }, t(props.activeStep.nextButtonLabel)),
281
287
  activeSection === AppRouteSections.RESOURCES && isFileRecommendationsTriggered && (React.createElement(Button, { onClick: handleFileRecsSelfSolved, variant: ButtonVariant.secondary, className: "issue-solved-button solved-issue-button", "data-tracking-id": "troubleshoot-self-solved-issue" }, t('I solved my issue'))))),
282
288
  React.createElement(RecommendationFeedbackModal, { isModalOpen: isRecsModalVisible, handleModalToggle: onRecsFeedbackModalToggle, modalContent: t(`Great, we're glad that resolved your issue`) }),
@@ -331,7 +331,7 @@
331
331
  }
332
332
 
333
333
  .pf-chatbot--fullscreen .pf-chatbot-container {
334
- height: calc(100vh - 255px) !important;
334
+ height: calc(100vh - 277px) !important;
335
335
  }
336
336
 
337
337
  .fullscreen-chat-footer {
@@ -339,7 +339,7 @@
339
339
  bottom: 0 !important;
340
340
  left: 0 !important;
341
341
  right: 0 !important;
342
- height: 42px !important;
342
+ height: 57px !important;
343
343
  background: #f6f6f6 !important;
344
344
  border-top: 1px solid #d1d1d1 !important;
345
345
  align-items: center !important;
@@ -354,6 +354,13 @@ body:has(.pf-chatbot--fullscreen) .pf-v6-c-wizard__footer {
354
354
 
355
355
  body:has(.pf-chatbot--fullscreen) .fullscreen-chat-footer {
356
356
  display: flex !important;
357
+ gap: 10px;
358
+ }
359
+
360
+ .fullscreen-chat-footer .btn.btn-app {
361
+ padding: 0.375rem 1rem;
362
+ border-radius: var(--global-border-radius-pill, 999px);
363
+ border: var(--global-border-width-regular, 1px) solid var(--global-border-color-brand-default, #06c);
357
364
  }
358
365
 
359
366
  body:has(.pf-chatbot--fullscreen) .main-section {
@@ -0,0 +1,22 @@
1
+ export interface IUseABOptions {
2
+ defaultVariation?: ABEnum;
3
+ }
4
+ export interface IUseABReturn {
5
+ variation: ABEnum;
6
+ isVariationA: boolean;
7
+ isVariationB: boolean;
8
+ }
9
+ export interface IUseABComponentOptions extends IUseABOptions {
10
+ A: JSX.Element | null;
11
+ B: JSX.Element | null;
12
+ }
13
+ export interface IUseABComponentReturn extends IUseABReturn {
14
+ component: JSX.Element | null;
15
+ }
16
+ export declare enum ABEnum {
17
+ A = "A",
18
+ B = "B"
19
+ }
20
+ export declare function useAB(options?: IUseABOptions): IUseABReturn;
21
+ export declare function useABComponent(options: IUseABComponentOptions): IUseABComponentReturn;
22
+ //# sourceMappingURL=useAB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAB.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAB.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IACzD,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACvD,SAAS,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;CACjC;AAED,oBAAY,MAAM;IACd,CAAC,MAAM;IACP,CAAC,MAAM;CACV;AAED,wBAAgB,KAAK,CAAC,OAAO,GAAE,aAAkB,GAAG,YAAY,CAkC/D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAMrF"}
@@ -0,0 +1,37 @@
1
+ import { GlobalMetadataStateContext } from '@rh-support/react-context';
2
+ import { getConfigField, PCM_CONFIG_FIELD_TYPE } from '@rh-support/utils';
3
+ import { useContext, useEffect, useState } from 'react';
4
+ export var ABEnum;
5
+ (function (ABEnum) {
6
+ ABEnum["A"] = "A";
7
+ ABEnum["B"] = "B";
8
+ })(ABEnum || (ABEnum = {}));
9
+ export function useAB(options = {}) {
10
+ const { globalMetadataState: { pcmConfig, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
11
+ const [testVariation, setTestVariation] = useState((options === null || options === void 0 ? void 0 : options.defaultVariation) || ABEnum.A);
12
+ useEffect(() => {
13
+ if (loggedInUsersAccount.data.hasConfirmedStatesideSupport || loggedInUsersAccount.data.secureSupport) {
14
+ setTestVariation(ABEnum.B);
15
+ return;
16
+ }
17
+ const variantAAccountNumbers = getConfigField(pcmConfig.data, 'askRedHatAccountsA', PCM_CONFIG_FIELD_TYPE.STRING);
18
+ const userAccountNumber = loggedInUsersAccount.data.accountNumber;
19
+ const isUserInVariantAAccountNumbers = variantAAccountNumbers === null || variantAAccountNumbers === void 0 ? void 0 : variantAAccountNumbers.includes(userAccountNumber);
20
+ if ((variantAAccountNumbers === null || variantAAccountNumbers === void 0 ? void 0 : variantAAccountNumbers.length) && userAccountNumber && isUserInVariantAAccountNumbers) {
21
+ setTestVariation(ABEnum.A);
22
+ }
23
+ else {
24
+ setTestVariation(ABEnum.B);
25
+ }
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, [pcmConfig.data, loggedInUsersAccount.data.accountNumber]);
28
+ return {
29
+ variation: testVariation,
30
+ isVariationA: testVariation === ABEnum.A,
31
+ isVariationB: testVariation === ABEnum.B,
32
+ };
33
+ }
34
+ export function useABComponent(options) {
35
+ const variationObject = useAB(options);
36
+ return Object.assign(Object.assign({}, variationObject), { component: variationObject.isVariationA ? options.A : options.B });
37
+ }
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  interface IProps {
2
3
  userSeenRecommendationsfn?: any;
3
4
  userSeenRecommendationsValue: boolean;
@@ -11,6 +12,9 @@ interface IProps {
11
12
  aiServicesAvailable: boolean;
12
13
  isSecureSupport?: boolean;
13
14
  hasConfirmedStatesideSupport?: boolean;
15
+ onBack?: (e: React.MouseEvent<HTMLButtonElement>) => void;
16
+ haveARHFieldsChanged?: boolean;
17
+ resetARHFieldsChanged?: () => void;
14
18
  }
15
19
  export declare function useWizard(routeProps: any, props?: IProps): {
16
20
  getStepsSequece: (showRest?: boolean) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"useWizard.d.ts","sourceRoot":"","sources":["../../../src/h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AC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,wBAAgB,SAAS,CAAC,UAAU,KAAA,EAAE,KAAK,CAAC,EAAE,MAAM;iCAwTb,OAAO;EAwC7C"}
@@ -20,7 +20,9 @@ import { RouteContext } from '../context/RouteContext';
20
20
  import { TCStateContext } from '../context/TopContentContext';
21
21
  import { AppRouteSections, openCaseNonTechnicalSequence, openCaseRouteSectionSequence, searchIntentRouteSectionSequence, troubleshootNonTechnicalSequence, troubleshootRouteSectionsSequence, } from '../reducers/RouteConstNTypes';
22
22
  import RouteUtils from '../utils/routeUtils';
23
+ import { useAB } from './useAB';
23
24
  export function useWizard(routeProps, props) {
25
+ const { isVariationA } = useAB();
24
26
  const { routeState: { activeSection, isSearchIntent, isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
25
27
  // state value was available later - reading dirctly from url
26
28
  const isCaseCreate = RouteUtils.getQueryParams(routeProps).caseCreate === 'true';
@@ -69,17 +71,29 @@ export function useWizard(routeProps, props) {
69
71
  alertMessage(),
70
72
  !props.isSecureSupport && !props.hasConfirmedStatesideSupport && aiInformationAlert(),
71
73
  React.createElement(ProductSelector, { routeProps: routeProps, userSeenRecommendations: props.userSeenRecommendationsfn, userClickedNextonRecommendations: props.userClickedNextonRecommendationsValue, resultsRowRef: props.resultsRowRef, isOnGetSupportPage: false, caseCreateExperience: isCaseCreate })))), canJumpTo: isSectionValidFn(isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT) ||
72
- activeSection === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT), nextButtonLabel: ((summarizeNextButtonLabelLogic() || ((props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) && numFound < 3)) &&
73
- !isEmpty(issue)) ||
74
- numFound === 0 // do this so that when user refreshes tab and state persists we don't cause edge 'continue' render
74
+ activeSection === (isCaseCreate ? AppRouteSections.SUMMARIZE : AppRouteSections.TROUBLESHOOT), nextButtonLabel: isVariationA
75
75
  ? t('Continue')
76
- : t('See more options') }),
76
+ : ((summarizeNextButtonLabelLogic() || ((props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) && numFound < 3)) &&
77
+ !isEmpty(issue)) ||
78
+ numFound === 0
79
+ ? t('Continue')
80
+ : t('See more options') }),
77
81
  [AppRouteSections.RESOURCES]: Object.assign(Object.assign({}, defaultRouteConfiguration), { id: AppRouteSections.RESOURCES, name: isCaseCreate ? t('Resources') : t('Resources'), component: (React.createElement(MainSection, { stepNumber: 3, totalSteps: 6, section: AppRouteSections.RESOURCES, title: t('Recommendations') },
78
82
  React.createElement(Suspense, { fallback: React.createElement(LoadingIndicator, { size: "sm" }) },
79
83
  alertMessage(),
80
- React.createElement(TroubleshootSection, { isAIChatMode: props.isAIChatMode, setIsAIChatMode: props.setIsAIChatMode, onChatWithAIClick: props.onChatWithAIClick, aiServicesAvailable: props.aiServicesAvailable, isSecureSupport: props.isSecureSupport, hasConfirmedStatesideSupport: props.hasConfirmedStatesideSupport })))), canJumpTo: isSectionValidFn(AppRouteSections.RESOURCES || activeSection === AppRouteSections.RESOURCES) &&
84
+ React.createElement(TroubleshootSection, { isAIChatMode: props.isAIChatMode, setIsAIChatMode: props.setIsAIChatMode, onChatWithAIClick: props.onChatWithAIClick, aiServicesAvailable: props.aiServicesAvailable, isSecureSupport: props.isSecureSupport, hasConfirmedStatesideSupport: props.hasConfirmedStatesideSupport, onBack: props.onBack, routeProps: routeProps, userSeenRecommendations: props.userSeenRecommendationsfn, userClickedNextonRecommendations: props.userClickedNextonRecommendationsValue, resultsRowRef: props.resultsRowRef, haveARHFieldsChanged: props.haveARHFieldsChanged, resetARHFieldsChanged: props.resetARHFieldsChanged })))), canJumpTo: isSectionValidFn(AppRouteSections.RESOURCES || activeSection === AppRouteSections.RESOURCES) &&
81
85
  (props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) &&
82
- (props === null || props === void 0 ? void 0 : props.userCanNavigateToTroubleshoot), nextButtonLabel: isCaseCreate ? t('Continue') : t('Convert to case') }),
86
+ (props === null || props === void 0 ? void 0 : props.userCanNavigateToTroubleshoot), nextButtonLabel: isVariationA
87
+ ? ((summarizeNextButtonLabelLogic() || ((props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) && numFound < 3)) &&
88
+ !isEmpty(issue)) ||
89
+ numFound === 0
90
+ ? t('Continue')
91
+ : isCaseCreate
92
+ ? t('See more options')
93
+ : t('Convert to case')
94
+ : isCaseCreate
95
+ ? t('Continue')
96
+ : t('Convert to case') }),
83
97
  [AppRouteSections.ADDITIONAL_INFORMATION]: Object.assign(Object.assign({}, defaultRouteConfiguration), { id: AppRouteSections.ADDITIONAL_INFORMATION, name: t('Additional information'), component: (React.createElement(MainSection, { stepNumber: 4, totalSteps: 6, section: AppRouteSections.ADDITIONAL_INFORMATION, title: React.createElement(React.Fragment, null,
84
98
  t('Case information'),
85
99
  isEmpty(RouteUtils.seBasePath) && isSelectedAccounntSecureSupport && (React.createElement("span", { className: "secured-support" },