@shopgate/pwa-tracking 7.31.9-beta.2 → 7.31.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/package.json +5 -5
- package/streams/search.js +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-tracking",
|
|
3
|
-
"version": "7.31.9
|
|
3
|
+
"version": "7.31.9",
|
|
4
4
|
"description": "Tracking library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"connect"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@shopgate/pwa-common": "7.31.9
|
|
19
|
-
"@shopgate/pwa-common-commerce": "7.31.9
|
|
20
|
-
"@shopgate/pwa-core": "7.31.9
|
|
21
|
-
"@shopgate/tracking-core": "7.31.9
|
|
18
|
+
"@shopgate/pwa-common": "7.31.9",
|
|
19
|
+
"@shopgate/pwa-common-commerce": "7.31.9",
|
|
20
|
+
"@shopgate/pwa-core": "7.31.9",
|
|
21
|
+
"@shopgate/tracking-core": "7.31.9",
|
|
22
22
|
"reselect": "^4.1.8",
|
|
23
23
|
"rxjs": "~5.5.12"
|
|
24
24
|
}
|
package/streams/search.js
CHANGED
|
@@ -8,12 +8,23 @@ import { getIsAppWebViewVisible, getCurrentSearchQuery } from '@shopgate/engage/
|
|
|
8
8
|
import { SEARCH_PATTERN, RECEIVE_SEARCH_RESULTS } from '@shopgate/engage/search/constants';
|
|
9
9
|
import { searchDidEnter$ } from '@shopgate/engage/search/streams';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether the current route contains a search query. Searches without a query don't
|
|
13
|
+
* request any results, so they are not tracked.
|
|
14
|
+
* @param {Object} params The stream params.
|
|
15
|
+
* @param {Function} params.getState The getState function.
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
const hasSearchQuery = ({
|
|
19
|
+
getState
|
|
20
|
+
}) => !!getCurrentSearchQuery(getState());
|
|
21
|
+
|
|
11
22
|
/**
|
|
12
23
|
* Emits when the search route comes active again after a legacy page was active.
|
|
13
24
|
*/
|
|
14
25
|
const searchRouteReappeared$ = pwaDidAppear$.filter(({
|
|
15
26
|
action
|
|
16
|
-
}) => action.route.pattern === SEARCH_PATTERN);
|
|
27
|
+
}) => action.route.pattern === SEARCH_PATTERN).filter(hasSearchQuery);
|
|
17
28
|
|
|
18
29
|
/**
|
|
19
30
|
* Emits when search results are received.
|
|
@@ -29,7 +40,7 @@ export const searchIsReady$ = searchDidEnter$
|
|
|
29
40
|
// Do not track while PWA webview is in the background
|
|
30
41
|
.filter(({
|
|
31
42
|
getState
|
|
32
|
-
}) => getIsAppWebViewVisible(getState())).switchMap(data => {
|
|
43
|
+
}) => getIsAppWebViewVisible(getState())).filter(hasSearchQuery).switchMap(data => {
|
|
33
44
|
const {
|
|
34
45
|
getState
|
|
35
46
|
} = data;
|