@rh-support/troubleshoot 2.4.5-beta.21-user-agent-hotfix → 2.4.5-beta.22-user-agent-hotfix

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOvD,OAAO,EAAoB,eAAe,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAK3G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0BAA0B,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5E,kCAAkC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACpF,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gCAAgC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACjF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,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C,OAAO,CAAC,KAAK,IAAI,CAAC;CACxE;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBA4TtC;kBA5TQ,gBAAgB;;;AA8TzB,eAAe,gBAAgB,CAAC"}
@@ -15,7 +15,7 @@ import { dtmTrackEventCaseStartStopped, getResTypeFromUrl, scrollIntoView } from
15
15
  import find from 'lodash/find';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
18
- import React, { useContext, useEffect, useState } from 'react';
18
+ import React, { useContext, useEffect, useRef, useState } from 'react';
19
19
  import { useTranslation } from 'react-i18next';
20
20
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
21
21
  import { RecommendationStateContext } from '../../context/RecommendationContext';
@@ -49,6 +49,7 @@ function WizardNavigation(props) {
49
49
  const dispatchToRouteReducer = useContext(RouteDispatchContext);
50
50
  const { activeSectionError, isSectionValidFn } = useIsSectionValid(activeSection);
51
51
  const [isRecsModalVisible, setIsRecsModalVisible] = useState(false);
52
+ const previousRecommendationTop = useRef(0);
52
53
  const { request: resolveSessionRequest } = useFetch(pcm.preCase.session.resolveSession);
53
54
  const { sessionRestore: { activeSessionId, sessionResourceTracking }, } = useContext(SessionRestoreStateContext);
54
55
  const { SessionResourceSource } = pcm.preCase.session;
@@ -83,24 +84,39 @@ function WizardNavigation(props) {
83
84
  // console.log('Intersection ratio:', entry.intersectionRatio);
84
85
  // console.log({ hasUserScrolled });
85
86
  const boundingRect = entry.boundingClientRect;
86
- const isScrollingUp = boundingRect.top > 0;
87
- const isAboveThreshold = entry.intersectionRatio >= 0.6;
87
+ if (props.userClickedNextonRecommendationsValue) {
88
+ if (previousRecommendationTop.current > boundingRect.top ||
89
+ previousRecommendationTop.current === 0) {
90
+ previousRecommendationTop.current = boundingRect.top + 50;
91
+ }
92
+ else {
93
+ props.userClickedNextonRecommendationsFn && props.userClickedNextonRecommendationsFn(false);
94
+ previousRecommendationTop.current = 0;
95
+ }
96
+ }
97
+ const offsetValue = props.userClickedNextonRecommendationsValue
98
+ ? previousRecommendationTop.current
99
+ : 100;
100
+ const isScrollingUp = boundingRect.top > offsetValue;
101
+ const isAboveThreshold = boundingRect.top < 100;
88
102
  isAboveThreshold && props.setUserCanNavigateToTroubleshoot(true);
89
103
  isAboveThreshold && props.setUserSeenRecommendations(true);
90
104
  // If scrolling up, always use the threshold check
91
105
  if (isScrollingUp) {
92
106
  setHasUserScrolled(isAboveThreshold);
93
107
  props.setUserScrolledLabel(isAboveThreshold);
108
+ props.userClickedNextonRecommendationsFn && props.userClickedNextonRecommendationsFn(false);
94
109
  return;
95
110
  }
96
111
  // If scrolling down and we hit the threshold, set to true
97
112
  if (isAboveThreshold) {
113
+ setHasUserScrolled(true);
98
114
  props.setUserScrolledLabel(true);
99
115
  props.userClickedNextonRecommendationsFn && props.userClickedNextonRecommendationsFn(true);
100
116
  }
101
117
  }, {
102
118
  root: null,
103
- threshold: [0, 0.6], // Changing threshold value to have its effect on pagination when page size is more than 10.
119
+ threshold: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1], // Changing threshold value to have its effect on pagination when page size is more than 10.
104
120
  rootMargin: '0px',
105
121
  });
106
122
  const resultsRowElement = props.resultsRowRef.current;
@@ -125,6 +141,8 @@ function WizardNavigation(props) {
125
141
  onlyIfNotInViewport: true,
126
142
  offset: 120,
127
143
  });
144
+ setHasUserScrolled(true);
145
+ props.setUserScrolledLabel(true);
128
146
  props.userClickedNextonRecommendationsFn && props.userClickedNextonRecommendationsFn(true);
129
147
  return;
130
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "2.4.5-beta.21-user-agent-hotfix",
3
+ "version": "2.4.5-beta.22-user-agent-hotfix",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -135,5 +135,5 @@
135
135
  "defaults and supports es6-module",
136
136
  "maintained node versions"
137
137
  ],
138
- "gitHead": "7be36a960f4732483745f6216ff2bdc682b30b0c"
138
+ "gitHead": "4f6c5d78abfe2633bb24dea62e8ac2353caca920"
139
139
  }