@shopgate/pwa-webcheckout-shopify 7.26.0 → 7.27.0-beta.2

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/actions/logout.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import{mutable}from'@shopgate/pwa-common/helpers/redux';import HttpRequest from'@shopgate/pwa-core/classes/HttpRequest';import requestShopifyLogout from"../action-creators/requestShopifyLogout";import errorShopifyLogout from"../action-creators/errorShopifyLogout";import successShopifyLogout from"../action-creators/successShopifyLogout";import{getLogoutUrl,getLogoutSuccessUrl}from"../selectors";/**
2
+ * @typedef {Object} LogoutOptions
3
+ * @property {Object.<string, string>} [headers] - Optional request headers.
4
+ */ /**
2
5
  * Log out the current user.
3
- * @return {Function} A redux thunk.
4
- */var webCheckoutLogout=function webCheckoutLogout(){return function(dispatch){var logoutUrl=getLogoutUrl();if(!logoutUrl){// When no logout url is available it doesn't make sense to do the request
5
- return;}dispatch(requestShopifyLogout());new HttpRequest(logoutUrl).dispatch().then(function(response){var _response$headers=response.headers,_response$headers2=_response$headers===void 0?{}:_response$headers,location=_response$headers2.location,statusCode=response.statusCode;var logoutSuccessUrl=getLogoutSuccessUrl();// When a success url is available it needs to be considered at the response evaluation
6
+ * @param {LogoutOptions} [options] - Optional options containing request headers.
7
+ * @returns {Function} A Redux thunk.
8
+ */var webCheckoutLogout=function webCheckoutLogout(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){var logoutUrl=getLogoutUrl();if(!logoutUrl){// When no logout url is available it doesn't make sense to do the request
9
+ return;}dispatch(requestShopifyLogout());var request=new HttpRequest(logoutUrl);if(options.headers)request.setHeaders(options.headers);request.dispatch().then(function(response){var _response$headers=response.headers,_response$headers2=_response$headers===void 0?{}:_response$headers,location=_response$headers2.location,statusCode=response.statusCode;var logoutSuccessUrl=getLogoutSuccessUrl();// When a success url is available it needs to be considered at the response evaluation
6
10
  var urlCheckValid=!logoutSuccessUrl||location&&location.startsWith(logoutSuccessUrl);if(statusCode===302&&urlCheckValid){dispatch(successShopifyLogout());}else{dispatch(errorShopifyLogout());}})["catch"](function(){dispatch(errorShopifyLogout());});};};/** @mixes {MutableFunction} */export default mutable(webCheckoutLogout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-webcheckout-shopify",
3
- "version": "7.26.0",
3
+ "version": "7.27.0-beta.2",
4
4
  "description": "Webcheckout Shopify library for the Shopgate Connect PWA.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -17,8 +17,8 @@
17
17
  "connect"
18
18
  ],
19
19
  "devDependencies": {
20
- "@shopgate/pwa-common": "7.26.0",
21
- "@shopgate/pwa-core": "7.26.0",
20
+ "@shopgate/pwa-common": "7.27.0-beta.2",
21
+ "@shopgate/pwa-core": "7.27.0-beta.2",
22
22
  "react": "~16.14.0"
23
23
  }
24
24
  }