@rh-support/components 2.1.65 → 2.1.66
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":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;
|
|
1
|
+
{"version":3,"file":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC7B,cAAmB,EACnB,2BAA6C,EAC7C,QAAQ,EACR,cAAc,EACd,mBAA2B,EAC3B,SAAS,EACT,WAAgB,EAChB,cAAc,GACjB,EAAE,MAAM,qBAkHR"}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import './topContentSearch.scss';
|
|
11
11
|
import { SearchInput } from '@patternfly/react-core';
|
|
12
|
-
import {
|
|
12
|
+
import { getAccessHostname } from '@rh-support/utils';
|
|
13
13
|
import SearchApi, { INDEX_MODES } from 'js-worker-search';
|
|
14
14
|
import debounce from 'lodash/debounce';
|
|
15
15
|
import flatMap from 'lodash/flatMap';
|
|
@@ -26,11 +26,6 @@ export const getTopContentUrl = (contentUrl) => {
|
|
|
26
26
|
}
|
|
27
27
|
return contentUrl;
|
|
28
28
|
};
|
|
29
|
-
var CustomEvents;
|
|
30
|
-
(function (CustomEvents) {
|
|
31
|
-
CustomEvents["inputChange"] = "top-content-filter-input-change";
|
|
32
|
-
CustomEvents["inputClear"] = "top-content-filter-input-clear";
|
|
33
|
-
})(CustomEvents || (CustomEvents = {}));
|
|
34
29
|
export function TopContentSearch({ topContentData = [], topContentResultsWrapperRef = { current: {} }, onSearch, dataTrackingId, enableEventTracking = false, className, searchQuery = '', setSearchQuery, }) {
|
|
35
30
|
const [searchText, setSearchText] = useState(searchQuery);
|
|
36
31
|
const { t } = useTranslation();
|
|
@@ -49,12 +44,6 @@ export function TopContentSearch({ topContentData = [], topContentResultsWrapper
|
|
|
49
44
|
searchText && handleSearch(searchText);
|
|
50
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
46
|
}, [topContentData]);
|
|
52
|
-
// to log custom events for dtm tracking.
|
|
53
|
-
const logCustomEvent = (eventName, event) => {
|
|
54
|
-
if (!enableEventTracking || !searchWrapperRef.current || !event || !eventName)
|
|
55
|
-
return;
|
|
56
|
-
dtmTrackEvent(searchWrapperRef, eventName, event);
|
|
57
|
-
};
|
|
58
47
|
const highlightSearchResults = useCallback((searchTerm) => {
|
|
59
48
|
var _a;
|
|
60
49
|
// highlight search term present in contents only. Contents are present within <dd> tag
|
|
@@ -68,11 +57,10 @@ export function TopContentSearch({ topContentData = [], topContentResultsWrapper
|
|
|
68
57
|
},
|
|
69
58
|
});
|
|
70
59
|
}, [topContentResultsWrapperRef]);
|
|
71
|
-
const onSearchInputClear = useCallback((
|
|
60
|
+
const onSearchInputClear = useCallback(() => {
|
|
72
61
|
setSearchText('');
|
|
73
62
|
setSearchQuery && setSearchQuery('');
|
|
74
63
|
onSearch('', topContentData);
|
|
75
|
-
logCustomEvent(CustomEvents.inputClear, event);
|
|
76
64
|
highlightSearchResults('');
|
|
77
65
|
},
|
|
78
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -98,7 +86,6 @@ export function TopContentSearch({ topContentData = [], topContentResultsWrapper
|
|
|
98
86
|
});
|
|
99
87
|
onSearch(query, filteredData);
|
|
100
88
|
highlightSearchResults(query);
|
|
101
|
-
logCustomEvent(CustomEvents.inputChange, { bubbles: true, detail: { query } });
|
|
102
89
|
}),
|
|
103
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
91
|
[highlightSearchResults, topContentData, onSearchInputClear]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.66",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@patternfly/react-core": "5.1.1",
|
|
69
69
|
"@patternfly/react-table": "5.1.1",
|
|
70
70
|
"@rh-support/types": "2.0.4",
|
|
71
|
-
"@rh-support/user-permissions": "2.1.
|
|
72
|
-
"@rh-support/utils": "2.1.
|
|
71
|
+
"@rh-support/user-permissions": "2.1.47",
|
|
72
|
+
"@rh-support/utils": "2.1.36",
|
|
73
73
|
"dompurify": "^2.2.6",
|
|
74
74
|
"downshift": "^6.0.5",
|
|
75
75
|
"js-worker-search": "^1.4.1",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"defaults and supports es6-module",
|
|
110
110
|
"maintained node versions"
|
|
111
111
|
],
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "fc8601c40a613c50ddac01f11fc79c9f26544aa5"
|
|
113
113
|
}
|