@shopgate/pwa-common 7.29.0-alpha.2 → 7.29.0-alpha.3
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 +3 -3
- package/subscriptions/router.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "7.29.0-alpha.
|
|
3
|
+
"version": "7.29.0-alpha.3",
|
|
4
4
|
"description": "Common library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@redux-devtools/extension": "^3.3.0",
|
|
19
19
|
"@sentry/browser": "6.0.1",
|
|
20
|
-
"@shopgate/pwa-benchmark": "7.29.0-alpha.
|
|
20
|
+
"@shopgate/pwa-benchmark": "7.29.0-alpha.3",
|
|
21
21
|
"@virtuous/conductor": "~2.5.0",
|
|
22
22
|
"@virtuous/react-conductor": "~2.5.0",
|
|
23
23
|
"@virtuous/redux-persister": "1.1.0-beta.7",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"url-search-params": "^0.10.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@shopgate/pwa-core": "7.29.0-alpha.
|
|
46
|
+
"@shopgate/pwa-core": "7.29.0-alpha.3",
|
|
47
47
|
"@types/react-portal": "^3.0.9",
|
|
48
48
|
"lodash": "^4.17.4",
|
|
49
49
|
"prop-types": "~15.8.1",
|
package/subscriptions/router.js
CHANGED
|
@@ -18,7 +18,7 @@ if(location&&!handler.isExternalLink(location)){location=handler.sanitizeLink(lo
|
|
|
18
18
|
if(location){_context.next=31;break;}return _context.abrupt("return");case 31:if(!(historyAction===ACTION_PUSH&&location===currentPathname)){_context.next=33;break;}return _context.abrupt("return");case 33:if(getIsConnected(state)){_context.next=36;break;}showConnectivityError();return _context.abrupt("return");case 36:if(isUserLoggedIn(state)){_context.next=41;break;}// Determine whether or not this location is protected.
|
|
19
19
|
protector=authRoutes.getProtector(location);// If protected then navigate to the protector instead.
|
|
20
20
|
if(!protector){_context.next=41;break;}dispatch(navigate({action:historyAction,pathname:protector,state:{redirect:{location:location,state:routeState}}}));return _context.abrupt("return");case 41:/* eslint-disable prefer-const */ // Check for a redirect and change location if one is found.
|
|
21
|
-
_ref3=redirects.getRedirectExtended(location)||{},redirect=_ref3.handler,matcher=_ref3.matcher,pathParams=_ref3.pathParams,queryParams=_ref3.queryParams;/* eslint-enable prefer-const */if(!redirect){_context.next=67;break;}if(!(typeof redirect==='function'||redirect instanceof Promise)){_context.next=62;break;}_getCurrentRoute2=getCurrentRoute(state),pathname=_getCurrentRoute2.pathname;LoadingProvider.setLoading(pathname);pattern=router.findPattern(location.split('?')[0]);_ref5=router.patterns[pattern]||{},transform=_ref5.transform;route=new Route({pathname:location,pattern:pattern,
|
|
21
|
+
_ref3=redirects.getRedirectExtended(location)||{},redirect=_ref3.handler,matcher=_ref3.matcher,pathParams=_ref3.pathParams,queryParams=_ref3.queryParams;/* eslint-enable prefer-const */if(!redirect){_context.next=67;break;}if(!(typeof redirect==='function'||redirect instanceof Promise)){_context.next=62;break;}_getCurrentRoute2=getCurrentRoute(state),pathname=_getCurrentRoute2.pathname;LoadingProvider.setLoading(pathname);pattern=router.findPattern(location.split('?')[0]);_ref5=router.patterns[pattern]||{},transform=_ref5.transform;route=new Route({pathname:location,pattern:pattern,state:routeState,transform:transform});_context.prev=49;_context.next=52;return redirect(_extends({},params,{action:_extends({},params.action,{params:_extends({},params.action.params,{// Merge the sanitized location into the redirect handler payload.
|
|
22
22
|
pathname:location}),route:route,redirectMeta:{location:location,matcher:matcher,pathParams:pathParams,queryParams:queryParams}})}));case 52:redirect=_context.sent;_context.next=59;break;case 55:_context.prev=55;_context.t1=_context["catch"](49);redirect=null;logger.error(_context.t1);case 59:LoadingProvider.unsetLoading(pathname);if(redirect){_context.next=62;break;}return _context.abrupt("return");case 62:// Add query parameters from the original location to the redirect
|
|
23
23
|
parsedLocation=queryString.parseUrl(location);parsedRedirect=queryString.parseUrl(redirect);stringifiedQuery=queryString.stringify(_extends({},parsedLocation.query,{},parsedRedirect.query));finalRedirect=stringifiedQuery?"".concat(parsedRedirect.url,"?").concat(stringifiedQuery):parsedRedirect.url;location=finalRedirect;case 67:parsed=queryString.parseUrl(location);if(parsed.url){_context.next=71;break;}// The URL is not valid - show a toast message
|
|
24
24
|
showConnectivityError();return _context.abrupt("return");case 71:// Override the location if is Shop link is found.
|