@shopgate/pwa-tracking 7.29.0-alpha.2 → 7.29.0-alpha.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-tracking",
3
- "version": "7.29.0-alpha.2",
3
+ "version": "7.29.0-alpha.4",
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.29.0-alpha.2",
19
- "@shopgate/pwa-common-commerce": "7.29.0-alpha.2",
20
- "@shopgate/pwa-core": "7.29.0-alpha.2",
21
- "@shopgate/tracking-core": "7.29.0-alpha.2",
18
+ "@shopgate/pwa-common": "7.29.0-alpha.4",
19
+ "@shopgate/pwa-common-commerce": "7.29.0-alpha.4",
20
+ "@shopgate/pwa-core": "7.29.0-alpha.4",
21
+ "@shopgate/tracking-core": "7.29.0-alpha.4",
22
22
  "reselect": "^4.1.8",
23
23
  "rxjs": "~5.5.12"
24
24
  }
package/selectors/page.js CHANGED
@@ -1,4 +1,4 @@
1
- import{createSelector}from'reselect';import{getCurrentPathname,makeGetRouteParam}from'@shopgate/engage/core/selectors';import{isDev}from'@shopgate/engage/core/helpers';import{getPageConfigById}from'@shopgate/engage/page/selectors';import{shopNumber}from'@shopgate/pwa-common/helpers/config';/**
1
+ import{createSelector}from'reselect';import{getCurrentPathname,makeGetRouteParam}from'@shopgate/engage/core/selectors';import{isDev}from'@shopgate/engage/core/helpers';import{makeGetUnifiedCMSPageData}from'@shopgate/engage/page/selectors';import{shopNumber}from'@shopgate/pwa-common/helpers/config';/**
2
2
  * The tracking base URL.
3
3
  * @type {string}
4
4
  */var baseUrl="https://rapid.shopgate.com".concat(isDev?'/php/shopgate':'',"/sg_app_resources");/**
@@ -20,7 +20,7 @@ import{createSelector}from'reselect';import{getCurrentPathname,makeGetRouteParam
20
20
  * Creates a selector that retrieves a page config for the current route from the store.
21
21
  * @param {string} name The name of the desired parameter.
22
22
  * @returns {Function}
23
- */export var makeGetRoutePageConfig=function makeGetRoutePageConfig(){var getPageIdRouteParam=makeGetRouteParam('pageId');return createSelector(function(state){return state;},getPageIdRouteParam,function(state,pageId){return pageId?getPageConfigById(state,{pageId:pageId}):null;});};/**
23
+ */export var makeGetRoutePageConfig=function makeGetRoutePageConfig(){var getPageIdRouteParam=makeGetRouteParam('pageId');return createSelector(function(state){return state;},getPageIdRouteParam,function(state,pageId){return pageId?makeGetUnifiedCMSPageData({slug:pageId})(state):null;});};/**
24
24
  * Selects the page information.
25
25
  * @param {Object} state The current state.
26
26
  * @returns {Object} The page information.
package/streams/page.js CHANGED
@@ -1,10 +1,10 @@
1
- import'rxjs/add/operator/switchMap';import'rxjs/add/observable/of';import{Observable}from'rxjs/Observable';import{RECEIVE_PAGE_CONFIG}from'@shopgate/engage/core/constants';import{main$,routeDidEnter$,pwaDidAppear$}from'@shopgate/engage/core/streams';import{getIsAppWebViewVisible}from'@shopgate/engage/core/selectors';import{PAGE_PATTERN}from'@shopgate/engage/page/constants';import{getPageConfigById}from'@shopgate/engage/page/selectors';/**
1
+ import'rxjs/add/operator/switchMap';import'rxjs/add/observable/of';import{Observable}from'rxjs/Observable';import{RECEIVE_PAGE_CONFIG}from'@shopgate/engage/core/constants';import{main$,routeDidEnter$,pwaDidAppear$}from'@shopgate/engage/core/streams';import{getIsAppWebViewVisible}from'@shopgate/engage/core/selectors';import{PAGE_PATTERN,RECEIVE_PAGE_CONFIG_V2}from'@shopgate/engage/page/constants';import{makeGetUnifiedCMSPageData}from'@shopgate/engage/page/selectors';/**
2
2
  * Emits when a "page" was entered.
3
3
  */var pageDidEnter$=routeDidEnter$.filter(function(_ref){var action=_ref.action;return action.route.pattern===PAGE_PATTERN;});/**
4
4
  * Emits when the page route comes active again after a legacy page was active.
5
- */var pageRouteReappeared$=pwaDidAppear$.filter(function(_ref2){var action=_ref2.action;return action.route.pattern===PAGE_PATTERN;});var pageConfigReceived$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===RECEIVE_PAGE_CONFIG;});/**
5
+ */var pageRouteReappeared$=pwaDidAppear$.filter(function(_ref2){var action=_ref2.action;return action.route.pattern===PAGE_PATTERN;});var pageConfigReceived$=main$.filter(function(_ref3){var action=_ref3.action;return[RECEIVE_PAGE_CONFIG,RECEIVE_PAGE_CONFIG_V2].includes(action.type);});/**
6
6
  * Emits when a "page" was opened, and its config is available.
7
7
  */export var pageIsReady$=pageDidEnter$// Do not track while PWA webview is in the background
8
8
  .filter(function(_ref4){var getState=_ref4.getState;return getIsAppWebViewVisible(getState());}).switchMap(function(data){var action=data.action,getState=data.getState;var pageId=action.route.params.pageId;// Check if the page config for the current route is already available within Redux.
9
- var pageConfig=getPageConfigById(getState(),{pageId:pageId});if(!pageConfig||pageConfig.isFetching){// Wait for incoming page data if it's not available yet.
9
+ var pageConfig=makeGetUnifiedCMSPageData({slug:pageId})(getState());if(!pageConfig||pageConfig.isFetching){// Wait for incoming page data if it's not available yet.
10
10
  return pageConfigReceived$.first().switchMap(function(){return Observable.of(data);});}return Observable.of(data);}).merge(pageRouteReappeared$);