@rh-support/troubleshoot 2.6.146 → 2.6.149

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.
@@ -21,6 +21,7 @@ interface IProps {
21
21
  hasConfirmedStatesideSupport?: boolean;
22
22
  onBack?: (e: React.MouseEvent<HTMLButtonElement>) => void;
23
23
  haveARHFieldsChanged?: boolean;
24
+ haveNewARHFieldsChangedRef?: React.MutableRefObject<boolean>;
24
25
  resetARHFieldsChanged?: () => void;
25
26
  onSeeMoreResources?: () => void;
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TroubleshootSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/TroubleshootSection.tsx"],"names":[],"mappings":"AAAA,OAAO,6CAA6C,CAAC;AAkBrD,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AA0BpF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACzE,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7D,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IA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IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7D,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC;AAWD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBA2czC;kBA3cQ,mBAAmB;;;AA8c5B,eAAe,mBAAmB,CAAC"}
@@ -49,6 +49,14 @@ const getSessResFromAISources = (sources, visibilityStatus) => {
49
49
  return;
50
50
  return sources.map((source, index) => getSessResFromARHSource(source, visibilityStatus, index + 1));
51
51
  };
52
+ // Flag to track if streaming error occurred - persists until fields change
53
+ const setStreamingErrorOccurred = () => {
54
+ window.__arhStreamingErrorOccurred = true;
55
+ };
56
+ const getStreamingErrorFlag = () => window.__arhStreamingErrorOccurred === true;
57
+ const clearStreamingErrorFlag = () => {
58
+ window.__arhStreamingErrorOccurred = false;
59
+ };
52
60
  const defaultProps = {
53
61
  initialIsEditing: false,
54
62
  required: false,
@@ -59,12 +67,19 @@ const defaultProps = {
59
67
  haveARHFieldsChanged: false,
60
68
  };
61
69
  function TroubleshootSection(props) {
62
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
63
71
  const { t } = useTranslation();
64
72
  const { isVariationA } = useAB();
65
73
  const { isAIChatMode } = props;
66
74
  const lastDispatchedConversationIdRef = useRef(null);
67
- const hasFirstMessageSentRef = useRef(false);
75
+ if ((_a = props.haveNewARHFieldsChangedRef) === null || _a === void 0 ? void 0 : _a.current) {
76
+ clearStreamingErrorFlag();
77
+ }
78
+ const streamingErrorOccurred = getStreamingErrorFlag();
79
+ const hasFirstMessageSentRef = useRef(streamingErrorOccurred);
80
+ if (streamingErrorOccurred) {
81
+ hasFirstMessageSentRef.current = true;
82
+ }
68
83
  const sourcesRef = useRef(null);
69
84
  const clickedSourcesRef = useRef(new Set());
70
85
  const engagementTimerRef = useRef(null);
@@ -79,7 +94,7 @@ function TroubleshootSection(props) {
79
94
  const aiResponseState = useAIResponseState();
80
95
  const aiResponseDispatch = useAIResponseDispatch();
81
96
  const session = window === null || window === void 0 ? void 0 : window.sessionjs;
82
- const keycloakSession = (_b = (_a = session === null || session === void 0 ? void 0 : session._state) === null || _a === void 0 ? void 0 : _a.keycloak) !== null && _b !== void 0 ? _b : null;
97
+ const keycloakSession = (_c = (_b = session === null || session === void 0 ? void 0 : session._state) === null || _b === void 0 ? void 0 : _b.keycloak) !== null && _c !== void 0 ? _c : null;
83
98
  const { product, version, summary, issue, isCreatingCase, caseType } = useCaseSelector((state) => ({
84
99
  product: state.caseDetails.product,
85
100
  version: state.caseDetails.version,
@@ -91,7 +106,7 @@ function TroubleshootSection(props) {
91
106
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
92
107
  const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
93
108
  const canShowTopProducts = isEmpty(product);
94
- const canShowTopContent = !canShowTopProducts && ((_c = topContent === null || topContent === void 0 ? void 0 : topContent.data) === null || _c === void 0 ? void 0 : _c.length) > 0;
109
+ const canShowTopContent = !canShowTopProducts && ((_d = topContent === null || topContent === void 0 ? void 0 : topContent.data) === null || _d === void 0 ? void 0 : _d.length) > 0;
95
110
  const isNotAnIdea = caseType !== PreviousCaseTypes.FEATURE_ENHANCEMENT;
96
111
  const clearEngagementTimer = useCallback(() => {
97
112
  if (engagementTimerRef.current) {
@@ -153,6 +168,11 @@ function TroubleshootSection(props) {
153
168
  const source = { url: sourceUrl, link: sourceUrl, sourceUrl, sourceText };
154
169
  callResourceAPI([source], SessionResourceVisibility.VISITED);
155
170
  }
171
+ if (eventData.eventName === 'arh:streaming:error') {
172
+ hasFirstMessageSentRef.current = true;
173
+ setStreamingErrorOccurred();
174
+ aiResponseDispatch(setHasChunkReceived(true));
175
+ }
156
176
  // Count characters from DOM when answer is fully received
157
177
  if (eventData.eventName === ARHEventName.AnswerReceived) {
158
178
  setTimeout(() => {
@@ -193,16 +213,22 @@ function TroubleshootSection(props) {
193
213
  }
194
214
  });
195
215
  const detailedQuestion = generateAIQuestion(activeSection || '', caseDetails.product, caseDetails.version, caseDetails.summary, caseDetails.issue, caseDetails.caseType || '', i18next.language || 'en');
196
- const latestUserMessage = isVariationA && ((_d = aiResponseState.aiResponse) === null || _d === void 0 ? void 0 : _d.conversationId) && props.haveARHFieldsChanged
216
+ const latestUserMessage = isVariationA && ((_e = aiResponseState.aiResponse) === null || _e === void 0 ? void 0 : _e.conversationId) && props.haveARHFieldsChanged
197
217
  ? detailedQuestion
198
218
  : '';
199
- const firstUserMessage = isVariationA && !((_e = aiResponseState.aiResponse) === null || _e === void 0 ? void 0 : _e.conversationId) && !hasFirstMessageSentRef.current
219
+ const firstUserMessage = isVariationA && !((_f = aiResponseState.aiResponse) === null || _f === void 0 ? void 0 : _f.conversationId) && !hasFirstMessageSentRef.current
200
220
  ? detailedQuestion
201
221
  : '';
202
- // Reset the flag when component unmounts
222
+ // Reset haveNewARHFieldsChangedRef after 100ms on mount
203
223
  useEffect(() => {
224
+ const timer = setTimeout(() => {
225
+ if (props.haveNewARHFieldsChangedRef) {
226
+ props.haveNewARHFieldsChangedRef.current = false;
227
+ }
228
+ }, 100);
204
229
  return () => {
205
230
  var _a;
231
+ clearTimeout(timer);
206
232
  (_a = props.resetARHFieldsChanged) === null || _a === void 0 ? void 0 : _a.call(props);
207
233
  };
208
234
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -221,14 +247,14 @@ function TroubleshootSection(props) {
221
247
  }
222
248
  }, [hasAnswerReceived, isVariationA, callResourceAPI, clearEngagementTimer]);
223
249
  const initConfig = {
224
- packageVersion: (_f = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _f === void 0 ? void 0 : _f.packageVersion,
250
+ packageVersion: (_g = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _g === void 0 ? void 0 : _g.packageVersion,
225
251
  appSourceId: appSourceId_ARH,
226
252
  enableDebugLogging: false,
227
253
  headerTitle: isCaseCreate ? t('Resolve your issue now with AI insights') : t('Troubleshoot with AI insights'),
228
254
  appEnv: Env.getEnvName(),
229
255
  showWelcomeMessage: false,
230
256
  firstUserMessage: firstUserMessage,
231
- conversationId: (_h = (_g = aiResponseState.aiResponse) === null || _g === void 0 ? void 0 : _g.conversationId) !== null && _h !== void 0 ? _h : '',
257
+ conversationId: (_j = (_h = aiResponseState.aiResponse) === null || _h === void 0 ? void 0 : _h.conversationId) !== null && _j !== void 0 ? _j : '',
232
258
  latestUserMessage: latestUserMessage,
233
259
  enableHeaderMenu: false,
234
260
  enableTheme: false,
@@ -240,8 +266,8 @@ function TroubleshootSection(props) {
240
266
  } })),
241
267
  tokenAuth: {
242
268
  auth: {
243
- userInfo: (_l = (_k = (_j = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _j === void 0 ? void 0 : _j.getToken) === null || _k === void 0 ? void 0 : _k.call(_j)) !== null && _l !== void 0 ? _l : {},
244
- authToken: (_o = (_m = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _m === void 0 ? void 0 : _m.getEncodedToken()) !== null && _o !== void 0 ? _o : '',
269
+ userInfo: (_m = (_l = (_k = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _k === void 0 ? void 0 : _k.getToken) === null || _l === void 0 ? void 0 : _l.call(_k)) !== null && _m !== void 0 ? _m : {},
270
+ authToken: (_p = (_o = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _o === void 0 ? void 0 : _o.getEncodedToken()) !== null && _p !== void 0 ? _p : '',
245
271
  },
246
272
  events: {
247
273
  preprocessRequest,
@@ -1 +1 @@
1
- {"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAkE,MAAM,OAAO,CAAC;AAExH,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAY9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAcpF,eAAO,MAAM,iBAAiB,aAAc,MAAM,KAAG,MAEpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,kBAAmB,MAAM,YAAY,MAAM,QAAQ,MAAM,KAAG,MAqB9F,CAAC;AAGF,eAAO,MAAM,kBAAkB,kBACZ,MAAM,WACZ,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,SACpB,MAAM,GAAG,SAAS,YACf,MAAM,QACV,MAAM,KACb,MAwCF,CAAC;AACF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,qBAAqB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cA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,qBAwchC;AACD,eAAe,UAAU,CAAC"}
@@ -124,6 +124,7 @@ function WizardMain(props) {
124
124
  caseType: '',
125
125
  });
126
126
  const haveARHFieldsChangedRef = useRef(false);
127
+ const haveNewARHFieldsChangedRef = useRef(false);
127
128
  const handleChatWithAIClick = () => {
128
129
  props.setIsAIChatMode(true);
129
130
  };
@@ -171,6 +172,9 @@ function WizardMain(props) {
171
172
  if (previousHadValues && hasExistingConversation) {
172
173
  haveARHFieldsChangedRef.current = true;
173
174
  }
175
+ if (previousHadValues) {
176
+ haveNewARHFieldsChangedRef.current = true;
177
+ }
174
178
  previousARHFieldsRef.current = {
175
179
  product: curr.product,
176
180
  version: curr.version,
@@ -202,6 +206,7 @@ function WizardMain(props) {
202
206
  hasConfirmedStatesideSupport: props.hasConfirmedStatesideSupport,
203
207
  onBack: handleOnBackForExpandedARH,
204
208
  haveARHFieldsChanged: haveARHFieldsChangedRef.current,
209
+ haveNewARHFieldsChangedRef,
205
210
  resetARHFieldsChanged,
206
211
  onSeeMoreResources: handleSeeMoreResources,
207
212
  });
@@ -334,7 +339,9 @@ function WizardMain(props) {
334
339
  const isWizardNavClick = !isNextButtonClickedRef.current && !isBackButtonClickedRef.current;
335
340
  const isBackNavigation = isBackButtonClickedRef.current;
336
341
  if ((isWizardNavClick || isBackNavigation) &&
337
- (currentStep.id === AppRouteSections.SUMMARIZE || currentStep.id === AppRouteSections.TROUBLESHOOT)) {
342
+ (currentStep.id === AppRouteSections.SUMMARIZE ||
343
+ currentStep.id === AppRouteSections.TROUBLESHOOT ||
344
+ currentStep.id === AppRouteSections.GET_SUPPORT)) {
338
345
  recommendationDispatch({
339
346
  type: RecommendationsConstants.setIsLoadingRecommendations,
340
347
  payload: { isLoadingRecommendations: false },
@@ -17,6 +17,7 @@ export declare enum ABEnum {
17
17
  A = "A",
18
18
  B = "B"
19
19
  }
20
+ export declare function getVariationByAccountNumber(accountNumber: string | undefined): ABEnum;
20
21
  export declare function useAB(options?: IUseABOptions): IUseABReturn;
21
22
  export declare function useABComponent(options: IUseABComponentOptions): IUseABComponentReturn;
22
23
  //# sourceMappingURL=useAB.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAB.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAB.ts"],"names":[],"mappings":"AAQA,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,CA2D/D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAMrF"}
1
+ {"version":3,"file":"useAB.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAB.ts"],"names":[],"mappings":"AAQA,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,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAerF;AAED,wBAAgB,KAAK,CAAC,OAAO,GAAE,aAAkB,GAAG,YAAY,CA2D/D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAMrF"}
@@ -9,6 +9,19 @@ export var ABEnum;
9
9
  ABEnum["A"] = "A";
10
10
  ABEnum["B"] = "B";
11
11
  })(ABEnum || (ABEnum = {}));
12
+ export function getVariationByAccountNumber(accountNumber) {
13
+ if (!accountNumber || accountNumber.length === 0) {
14
+ return ABEnum.B;
15
+ }
16
+ const lastChar = accountNumber.charAt(accountNumber.length - 1);
17
+ const lastDigit = parseInt(lastChar, 10);
18
+ // If lastDigit is not a valid number, default to B
19
+ if (isNaN(lastDigit)) {
20
+ return ABEnum.B;
21
+ }
22
+ // Even last digit → Experience A, Odd last digit → Experience B
23
+ return lastDigit % 2 === 0 ? ABEnum.A : ABEnum.B;
24
+ }
12
25
  export function useAB(options = {}) {
13
26
  const { globalMetadataState: { pcmConfig, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
14
27
  const [testVariation, setTestVariation] = useState((options === null || options === void 0 ? void 0 : options.defaultVariation) || ABEnum.A);
@@ -31,11 +44,11 @@ export function useAB(options = {}) {
31
44
  newVariation = ABEnum.B;
32
45
  }
33
46
  else {
34
- const variantAAccountNumbers = getConfigField(pcmConfig.data, 'askRedHatAccountsA', PCM_CONFIG_FIELD_TYPE.STRING);
47
+ const askRedHatAccountsA = getConfigField(pcmConfig.data, 'askRedHatAccountsA', PCM_CONFIG_FIELD_TYPE.STRING);
35
48
  const userAccountNumber = loggedInUsersAccount.data.accountNumber;
36
- const isUserInVariantAAccountNumbers = variantAAccountNumbers === null || variantAAccountNumbers === void 0 ? void 0 : variantAAccountNumbers.includes(userAccountNumber);
37
- if ((variantAAccountNumbers === null || variantAAccountNumbers === void 0 ? void 0 : variantAAccountNumbers.length) && userAccountNumber && isUserInVariantAAccountNumbers) {
38
- newVariation = ABEnum.A;
49
+ const isUserInABTestList = askRedHatAccountsA === null || askRedHatAccountsA === void 0 ? void 0 : askRedHatAccountsA.includes(userAccountNumber);
50
+ if ((askRedHatAccountsA === null || askRedHatAccountsA === void 0 ? void 0 : askRedHatAccountsA.length) && userAccountNumber && isUserInABTestList) {
51
+ newVariation = getVariationByAccountNumber(userAccountNumber);
39
52
  }
40
53
  else {
41
54
  newVariation = ABEnum.B;
@@ -14,6 +14,7 @@ interface IProps {
14
14
  hasConfirmedStatesideSupport?: boolean;
15
15
  onBack?: (e: React.MouseEvent<HTMLButtonElement>) => void;
16
16
  haveARHFieldsChanged?: boolean;
17
+ haveNewARHFieldsChangedRef?: React.MutableRefObject<boolean>;
17
18
  resetARHFieldsChanged?: () => void;
18
19
  onSeeMoreResources?: () => void;
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useWizard.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWizard.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA+B,MAAM,OAAO,CAAC;AA4BpD,UAAU,MAAM;IACZ,yBAAyB,CAAC,EAAE,GAAG,CAAC;IAChC,4BAA4B,EAAE,OAAO,CAAC;IACtC,6BAA6B,EAAE,OAAO,CAAC;IACvC,qCAAqC,EAAE,OAAO,CAAC;IAC/C,aAAa,EAAE,GAAG,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,CA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ACnC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,wBAAgB,SAAS,CAAC,UAAU,KAAA,EAAE,KAAK,CAAC,EAAE,MAAM;iCA0Tb,OAAO;EAwC7C"}
@@ -81,7 +81,7 @@ export function useWizard(routeProps, props) {
81
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') },
82
82
  React.createElement(Suspense, { fallback: React.createElement(LoadingIndicator, { size: "sm" }) },
83
83
  alertMessage(),
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, onSeeMoreResources: props.onSeeMoreResources, routeProps: routeProps, userSeenRecommendations: props.userSeenRecommendationsfn, userClickedNextonRecommendations: props.userClickedNextonRecommendationsValue, resultsRowRef: props.resultsRowRef, haveARHFieldsChanged: props.haveARHFieldsChanged, resetARHFieldsChanged: props.resetARHFieldsChanged })))), 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, onSeeMoreResources: props.onSeeMoreResources, routeProps: routeProps, userSeenRecommendations: props.userSeenRecommendationsfn, userClickedNextonRecommendations: props.userClickedNextonRecommendationsValue, resultsRowRef: props.resultsRowRef, haveARHFieldsChanged: props.haveARHFieldsChanged, haveNewARHFieldsChangedRef: props.haveNewARHFieldsChangedRef, resetARHFieldsChanged: props.resetARHFieldsChanged })))), canJumpTo: isSectionValidFn(AppRouteSections.RESOURCES || activeSection === AppRouteSections.RESOURCES) &&
85
85
  (props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) &&
86
86
  (props === null || props === void 0 ? void 0 : props.userCanNavigateToTroubleshoot), nextButtonLabel: isVariationA
87
87
  ? ((summarizeNextButtonLabelLogic() || ((props === null || props === void 0 ? void 0 : props.userSeenRecommendationsValue) && numFound < 3)) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.6.146",
3
+ "version": "2.6.149",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -133,5 +133,5 @@
133
133
  "defaults and supports es6-module",
134
134
  "maintained node versions"
135
135
  ],
136
- "gitHead": "f5adf9c787b3716d47c6ee2b634b171c365f03ad"
136
+ "gitHead": "b91e62bc261ac74067ea90d48b1870b7934ad79b"
137
137
  }