@shopgate/pwa-common 7.5.0-beta.6 → 7.5.0
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,5 +1,5 @@
|
|
|
1
|
-
import{PipelineRequest}from'@shopgate/pwa-core';import{
|
|
1
|
+
import{PipelineRequest}from'@shopgate/pwa-core';import{getDeviceTypeForCms}from'@shopgate/engage/core';import{SHOPGATE_CMS_GET_PAGE_CONFIG}from"../../constants/Pipelines";import{requestPageConfig,receivePageConfig,errorPageConfig}from"../../action-creators/page";import{shouldFetchData,mutable}from"../../helpers/redux";import{getPageConfigById}from"../../selectors/page";/**
|
|
2
2
|
* Retrieves the config for a page.
|
|
3
3
|
* @param {string} pageId The ID of the page to request.
|
|
4
4
|
* @return {Function} The dispatched action.
|
|
5
|
-
*/function fetchPageConfig(pageId){return function(dispatch,getState){var state=getState();var pageConfig=getPageConfigById(state,{pageId:pageId});if(!shouldFetchData(pageConfig)){return Promise.resolve(null);}var
|
|
5
|
+
*/function fetchPageConfig(pageId){return function(dispatch,getState){var state=getState();var pageConfig=getPageConfigById(state,{pageId:pageId});if(!shouldFetchData(pageConfig)){return Promise.resolve(null);}var deviceTypeOfCmsPage=getDeviceTypeForCms();dispatch(requestPageConfig(pageId));var request=new PipelineRequest(SHOPGATE_CMS_GET_PAGE_CONFIG).setInput({pageId:pageId,deviceType:deviceTypeOfCmsPage}).dispatch();request.then(function(result){dispatch(receivePageConfig(pageId,result));})["catch"](function(error){dispatch(errorPageConfig(pageId,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchPageConfig);
|
package/helpers/redux/mutable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isObject}from"../validation";/**
|
|
1
|
+
import noop from'lodash/noop';import{isObject}from"../validation";/**
|
|
2
2
|
* @typedef {Object} MutableFunction
|
|
3
3
|
* @property {Function} replace Replaces the original functionality with a custom function.
|
|
4
4
|
* @property {Function} restore Restores the original function.
|
|
@@ -38,7 +38,8 @@ if(res.action===BEFORE_ACTION_NEXT){if(res.args&&res.args.length>0){res=res.args
|
|
|
38
38
|
if(res.action===BEFORE_ACTION_SKIP_REST){arr.splice(-(arr.length-i));if(res.args&&res.args.length>0){res=res.args;}else{res=args;}}// Check if the step requested to stop any further processing including the action itself
|
|
39
39
|
if(res.action===BEFORE_ACTION_STOP){// Cut off all following step functions including the mutable func
|
|
40
40
|
arr.splice(-(arr.length-i));runAction=false;res=res.args;}// Replace arguments for the next step to get.
|
|
41
|
-
return res;},args);}if(!runAction){return
|
|
41
|
+
return res;},args);}if(!runAction){// the return value here gets passed to the dispatch() so it must be a function or action obj
|
|
42
|
+
return noop;}// Call the actual mutable
|
|
42
43
|
return current.apply(void 0,mutatedArgs);}/**
|
|
43
44
|
* Replaces the original functionality with a custom function.
|
|
44
45
|
* @param {Function} customFunc The function to execute instead of the original one.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "7.5.0
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "Common library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@sentry/browser": "6.0.1",
|
|
19
|
-
"@shopgate/pwa-benchmark": "7.5.0
|
|
19
|
+
"@shopgate/pwa-benchmark": "7.5.0",
|
|
20
20
|
"@virtuous/conductor": "~2.5.0",
|
|
21
21
|
"@virtuous/react-conductor": "~2.5.0",
|
|
22
22
|
"@virtuous/redux-persister": "1.1.0-beta.7",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"url-search-params": "^0.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@shopgate/pwa-core": "7.5.0
|
|
47
|
+
"@shopgate/pwa-core": "7.5.0",
|
|
48
48
|
"lodash": "^4.17.4",
|
|
49
49
|
"prop-types": "~15.7.2",
|
|
50
50
|
"react": "~16.12.0",
|