@shopgate/pwa-common 7.30.0-alpha.7 → 7.30.0-alpha.8

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.
Files changed (306) hide show
  1. package/App.js +48 -6
  2. package/action-creators/app/index.js +75 -12
  3. package/action-creators/app/spec.js +96 -1
  4. package/action-creators/client/index.js +27 -5
  5. package/action-creators/client/spec.js +44 -1
  6. package/action-creators/error/index.js +15 -3
  7. package/action-creators/index.js +9 -1
  8. package/action-creators/menu/index.js +23 -4
  9. package/action-creators/menu/spec.js +37 -1
  10. package/action-creators/modal/index.js +15 -3
  11. package/action-creators/modal/spec.js +26 -1
  12. package/action-creators/page/index.js +24 -4
  13. package/action-creators/page/spec.js +38 -1
  14. package/action-creators/router/index.js +48 -7
  15. package/action-creators/url/index.js +24 -4
  16. package/action-creators/url/spec.js +45 -1
  17. package/action-creators/user/index.js +90 -13
  18. package/action-creators/user/spec.js +186 -2
  19. package/actions/app/handleDeepLink.js +11 -2
  20. package/actions/app/handleLink.js +62 -6
  21. package/actions/app/handlePushNotification.js +32 -4
  22. package/actions/app/handleUniversalLink.js +11 -2
  23. package/actions/app/registerLinkEvents.js +24 -3
  24. package/actions/client/fetchClientInformation.js +26 -2
  25. package/actions/menu/fetchMenu.js +23 -2
  26. package/actions/modal/closeModal.js +18 -2
  27. package/actions/modal/promiseMap.js +3 -1
  28. package/actions/modal/showModal.js +54 -8
  29. package/actions/page/fetchPageConfig.js +69 -2
  30. package/actions/page/getPageConfig.js +6 -2
  31. package/actions/page/index.js +1 -1
  32. package/actions/router/historyPop.js +12 -2
  33. package/actions/router/historyPopToRoute.js +27 -2
  34. package/actions/router/historyPush.js +12 -2
  35. package/actions/router/historyRedirect.js +21 -2
  36. package/actions/router/historyReplace.js +20 -3
  37. package/actions/router/historyReset.js +11 -2
  38. package/actions/router/historyResetTo.js +12 -2
  39. package/actions/router/index.js +17 -1
  40. package/actions/router/routeDidPop.js +11 -2
  41. package/actions/router/routeDidPush.js +13 -2
  42. package/actions/router/routeDidReplace.js +11 -2
  43. package/actions/router/routeDidReset.js +11 -2
  44. package/actions/router/routeDidUpdate.js +10 -2
  45. package/actions/router/routeWillPop.js +11 -2
  46. package/actions/router/routeWillPush.js +13 -2
  47. package/actions/router/routeWillReplace.js +11 -2
  48. package/actions/router/routeWillReset.js +11 -2
  49. package/actions/router/windowOpenOverride.js +10 -2
  50. package/actions/user/fetchRegisterUrl.js +36 -2
  51. package/actions/user/fetchUser.js +29 -3
  52. package/actions/user/getUser.js +6 -2
  53. package/actions/user/index.js +1 -1
  54. package/actions/user/login.js +76 -9
  55. package/actions/user/logout.js +30 -2
  56. package/collections/AuthRoutes.js +73 -14
  57. package/collections/Configuration.js +54 -7
  58. package/collections/EmbeddedMedia.js +84 -11
  59. package/collections/PersistedReducers.js +41 -6
  60. package/collections/Redirects.js +103 -17
  61. package/collections/index.js +5 -1
  62. package/collections/media-providers/MediaProvider.js +151 -26
  63. package/collections/media-providers/Vimeo.js +113 -19
  64. package/collections/media-providers/YouTube.js +74 -14
  65. package/collections/media-providers/index.js +3 -1
  66. package/collections/media-providers/style.js +52 -2
  67. package/components/Backdrop/index.js +95 -6
  68. package/components/Backdrop/spec.js +23 -1
  69. package/components/Backdrop/style.js +11 -2
  70. package/components/Button/index.js +47 -5
  71. package/components/Button/spec.js +36 -1
  72. package/components/Button/style.js +6 -1
  73. package/components/Checkbox/index.js +126 -32
  74. package/components/Checkbox/spec.js +94 -3
  75. package/components/Consume/helpers/buildParams.js +13 -2
  76. package/components/Consume/index.js +14 -2
  77. package/components/CountdownTimer/index.js +115 -17
  78. package/components/CountdownTimer/spec.js +126 -12
  79. package/components/Drawer/index.js +131 -16
  80. package/components/Drawer/spec.js +76 -1
  81. package/components/Drawer/style.js +37 -1
  82. package/components/Dropdown/index.js +65 -6
  83. package/components/Dropdown/style.js +4 -1
  84. package/components/Dropdown/transitions.js +34 -1
  85. package/components/Ellipsis/index.js +16 -2
  86. package/components/Ellipsis/spec.js +13 -1
  87. package/components/EmbeddedMedia/index.js +56 -6
  88. package/components/EmbeddedMedia/spec.js +52 -3
  89. package/components/ErrorBoundary/connector.js +9 -2
  90. package/components/ErrorBoundary/index.js +43 -7
  91. package/components/Grid/components/Item/index.js +40 -4
  92. package/components/Grid/components/Item/spec.js +23 -1
  93. package/components/Grid/components/Item/style.js +17 -3
  94. package/components/Grid/index.js +36 -4
  95. package/components/Grid/spec.js +23 -1
  96. package/components/Grid/style.js +11 -2
  97. package/components/HtmlSanitizer/connector.js +24 -3
  98. package/components/HtmlSanitizer/index.js +104 -12
  99. package/components/HtmlSanitizer/spec.js +207 -6
  100. package/components/I18n/components/FormatDate/index.js +26 -2
  101. package/components/I18n/components/FormatDate/spec.js +46 -1
  102. package/components/I18n/components/FormatNumber/index.js +34 -2
  103. package/components/I18n/components/FormatNumber/spec.js +41 -2
  104. package/components/I18n/components/FormatPrice/index.js +32 -2
  105. package/components/I18n/components/FormatPrice/spec.js +46 -1
  106. package/components/I18n/components/FormatTime/index.js +26 -2
  107. package/components/I18n/components/FormatTime/spec.js +43 -2
  108. package/components/I18n/components/I18nProvider/index.js +52 -9
  109. package/components/I18n/components/I18nProvider/spec.js +39 -1
  110. package/components/I18n/components/Placeholder/index.js +8 -2
  111. package/components/I18n/components/Placeholder/spec.js +30 -1
  112. package/components/I18n/components/Translate/index.js +68 -7
  113. package/components/I18n/components/Translate/spec.js +30 -1
  114. package/components/I18n/index.js +16 -1
  115. package/components/Icon/index.js +25 -2
  116. package/components/Icon/style.js +6 -1
  117. package/components/Image/Image.js +176 -19
  118. package/components/Image/ImageInner.js +48 -2
  119. package/components/Image/index.js +1 -1
  120. package/components/Image/style.js +29 -2
  121. package/components/InfiniteContainer/index.js +381 -49
  122. package/components/InfiniteContainer/spec.js +199 -10
  123. package/components/Input/components/DateInput.js +262 -6
  124. package/components/Input/components/MultiLineInput.js +98 -12
  125. package/components/Input/components/SimpleInput.js +207 -31
  126. package/components/Input/index.js +32 -3
  127. package/components/Input/spec.js +122 -1
  128. package/components/KeyboardConsumer/index.js +48 -7
  129. package/components/Link/connector.js +7 -1
  130. package/components/Link/index.js +96 -11
  131. package/components/Link/spec.js +56 -1
  132. package/components/Link/style.js +10 -1
  133. package/components/List/components/Item/index.js +35 -3
  134. package/components/List/components/Item/style.js +16 -1
  135. package/components/List/index.js +20 -2
  136. package/components/List/spec.js +31 -1
  137. package/components/Loading/index.js +6 -2
  138. package/components/Modal/index.js +38 -3
  139. package/components/Modal/style.js +36 -1
  140. package/components/ModalContainer/connector.js +17 -3
  141. package/components/ModalContainer/index.js +36 -3
  142. package/components/ModalContainer/spec.js +105 -5
  143. package/components/Picker/components/Button/index.js +34 -2
  144. package/components/Picker/components/Button/style.js +19 -1
  145. package/components/Picker/components/List/index.js +33 -2
  146. package/components/Picker/components/List/style.js +17 -1
  147. package/components/Picker/components/Modal/index.js +60 -7
  148. package/components/Picker/components/Modal/style.js +78 -1
  149. package/components/Picker/index.js +167 -21
  150. package/components/Picker/spec.js +83 -2
  151. package/components/Portal/index.js +130 -19
  152. package/components/ProductCharacteristics/connector.js +33 -4
  153. package/components/ProductCharacteristics/context.js +2 -1
  154. package/components/ProductCharacteristics/helpers/index.js +135 -21
  155. package/components/ProductCharacteristics/index.js +266 -31
  156. package/components/RangeSlider/components/Handle/index.js +25 -2
  157. package/components/RangeSlider/components/Handle/style.js +14 -1
  158. package/components/RangeSlider/helper.js +43 -8
  159. package/components/RangeSlider/index.js +228 -38
  160. package/components/RangeSlider/style.js +14 -1
  161. package/components/Route/RouteNotFound.js +46 -3
  162. package/components/Route/index.js +78 -10
  163. package/components/Router/connector.js +9 -2
  164. package/components/Router/index.js +237 -31
  165. package/components/ScannerContainer/connector.js +9 -2
  166. package/components/ScannerContainer/index.js +42 -6
  167. package/components/Select/components/Item/index.js +20 -4
  168. package/components/Select/components/Item/style.js +4 -1
  169. package/components/Select/index.js +149 -28
  170. package/components/Select/spec.js +86 -2
  171. package/components/Select/style.js +17 -1
  172. package/components/SelectBox/components/Item/index.js +47 -5
  173. package/components/SelectBox/components/Item/style.js +7 -1
  174. package/components/SelectBox/index.js +173 -17
  175. package/components/SelectBox/spec.js +59 -3
  176. package/components/SelectBox/style.js +18 -1
  177. package/components/Slider/index.js +6 -2
  178. package/components/SurroundPortals/index.js +26 -2
  179. package/components/Swiper/components/SwiperItem/index.js +28 -4
  180. package/components/Swiper/components/SwiperItem/spec.js +17 -1
  181. package/components/Swiper/components/SwiperItem/styles.js +5 -1
  182. package/components/Swiper/index.js +210 -18
  183. package/components/Swiper/styles.js +75 -7
  184. package/components/Toaster/index.js +10 -2
  185. package/components/Transition/index.js +89 -13
  186. package/components/Widgets/components/Widget/index.js +52 -4
  187. package/components/Widgets/components/Widget/spec.js +68 -3
  188. package/components/Widgets/components/Widget/style.js +21 -3
  189. package/components/Widgets/components/WidgetGrid/index.js +52 -7
  190. package/components/Widgets/components/WidgetGrid/spec.js +46 -2
  191. package/components/Widgets/components/WidgetGrid/style.js +8 -1
  192. package/components/Widgets/helpers/shouldShowWidget.js +44 -7
  193. package/components/Widgets/index.js +127 -15
  194. package/components/Widgets/spec.js +213 -6
  195. package/components/index.js +9 -1
  196. package/constants/ActionTypes.js +97 -19
  197. package/constants/Configuration.js +12 -2
  198. package/constants/Device.js +29 -2
  199. package/constants/DisplayOptions.js +8 -1
  200. package/constants/MenuIDs.js +2 -1
  201. package/constants/ModalTypes.js +1 -1
  202. package/constants/PageIDs.js +1 -1
  203. package/constants/Pipelines.js +7 -1
  204. package/constants/Portals.js +136 -3
  205. package/constants/Registration.js +3 -1
  206. package/constants/RoutePaths.js +13 -2
  207. package/constants/Tracking.js +3 -1
  208. package/constants/client.js +6 -1
  209. package/constants/ui.js +2 -1
  210. package/constants/user.js +6 -2
  211. package/context/index.js +33 -3
  212. package/helpers/config/index.js +139 -21
  213. package/helpers/config/mock.js +200 -8
  214. package/helpers/config/theme.js +50 -4
  215. package/helpers/data/index.js +204 -29
  216. package/helpers/data/spec.js +187 -7
  217. package/helpers/date/index.js +58 -6
  218. package/helpers/date/spec.js +92 -1
  219. package/helpers/dom/index.js +48 -11
  220. package/helpers/environment/index.js +14 -2
  221. package/helpers/html/decodeHTML.js +7 -1
  222. package/helpers/html/handleDOM.js +172 -21
  223. package/helpers/html/parseHTML.js +67 -12
  224. package/helpers/i18n/getDateFormatter.js +23 -4
  225. package/helpers/i18n/getNumberFormatter.js +32 -4
  226. package/helpers/i18n/getPriceFormatter.js +38 -4
  227. package/helpers/i18n/getTimeFormatter.js +23 -4
  228. package/helpers/i18n/getTranslator.js +62 -8
  229. package/helpers/i18n/index.js +5 -1
  230. package/helpers/i18n/mergeTranslations.js +36 -9
  231. package/helpers/i18n/messageCache.js +3 -1
  232. package/helpers/legacy/index.js +47 -9
  233. package/helpers/modal/withShowModal.js +13 -2
  234. package/helpers/portals/portalCollection.js +28 -6
  235. package/helpers/portals/routePortals.js +12 -1
  236. package/helpers/redux/compareObjects.js +7 -2
  237. package/helpers/redux/generateResultHash.js +36 -3
  238. package/helpers/redux/generateSortedHash.js +7 -2
  239. package/helpers/redux/hasExpired.js +10 -2
  240. package/helpers/redux/index.js +7 -1
  241. package/helpers/redux/mutable.js +143 -24
  242. package/helpers/redux/shouldFetchData.js +46 -10
  243. package/helpers/redux/shouldFetchFilters.js +17 -4
  244. package/helpers/router/index.js +49 -5
  245. package/helpers/style/index.js +43 -4
  246. package/helpers/style/spec.js +108 -2
  247. package/helpers/tracking/index.js +52 -9
  248. package/helpers/validation/index.js +39 -12
  249. package/helpers/validation/spec.js +10 -1
  250. package/package.json +3 -3
  251. package/providers/index.js +4 -1
  252. package/providers/loading/context.js +2 -1
  253. package/providers/loading/index.js +137 -22
  254. package/providers/toast/context.js +2 -1
  255. package/providers/toast/index.js +105 -11
  256. package/reducers/client/connectivity.js +22 -2
  257. package/reducers/client/index.js +7 -1
  258. package/reducers/client/info.js +27 -2
  259. package/reducers/index.js +23 -4
  260. package/reducers/menu/index.js +5 -1
  261. package/reducers/menu/menusById.js +41 -2
  262. package/reducers/modal/index.js +14 -2
  263. package/reducers/page/index.js +68 -5
  264. package/reducers/router/index.js +48 -2
  265. package/reducers/url/index.js +42 -3
  266. package/reducers/user/data.js +27 -2
  267. package/reducers/user/index.js +7 -1
  268. package/reducers/user/login.js +65 -2
  269. package/selectors/client.js +138 -21
  270. package/selectors/history.js +49 -11
  271. package/selectors/menu.js +34 -6
  272. package/selectors/modal.js +15 -4
  273. package/selectors/page.js +25 -4
  274. package/selectors/router.js +154 -30
  275. package/selectors/url.js +25 -4
  276. package/selectors/user.js +90 -13
  277. package/store/index.js +60 -6
  278. package/store/middelwares/logger.js +7 -1
  279. package/store/middelwares/streams.js +19 -2
  280. package/streams/app.js +60 -8
  281. package/streams/client.js +8 -2
  282. package/streams/error.js +14 -3
  283. package/streams/index.js +6 -1
  284. package/streams/interval.js +6 -2
  285. package/streams/main.js +27 -2
  286. package/streams/router.js +45 -8
  287. package/streams/user.js +89 -15
  288. package/streams/view.js +97 -25
  289. package/styles/reset/form.js +57 -5
  290. package/styles/reset/index.js +6 -1
  291. package/styles/reset/media.js +22 -1
  292. package/styles/reset/root.js +33 -1
  293. package/styles/reset/table.js +10 -1
  294. package/styles/reset/typography.js +26 -1
  295. package/subscriptions/app.js +148 -17
  296. package/subscriptions/error.js +292 -13
  297. package/subscriptions/helpers/buildRegisterUrl.js +25 -6
  298. package/subscriptions/helpers/clearUpInAppBrowser.js +14 -3
  299. package/subscriptions/helpers/handleLinks.js +267 -25
  300. package/subscriptions/helpers/pipeline.js +12 -1
  301. package/subscriptions/history.js +34 -6
  302. package/subscriptions/index.js +25 -4
  303. package/subscriptions/menu.js +22 -5
  304. package/subscriptions/mock.js +39 -7
  305. package/subscriptions/router.js +336 -23
  306. package/subscriptions/user.js +93 -3
package/App.js CHANGED
@@ -1,14 +1,56 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}import React,{Component}from'react';import PropTypes from'prop-types';import{Provider}from'react-redux';import{CookiesProvider}from'react-cookie';import{loadCustomStyles}from'@shopgate/engage/styles';import ErrorBoundary from"./components/ErrorBoundary";import{appDidStart}from"./action-creators/app";import I18n from"./components/I18n";import{getIsSessionExpired}from"./selectors/user";import logout from"./actions/user/logout";/**
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Provider } from 'react-redux';
4
+ import { CookiesProvider } from 'react-cookie';
5
+ import { loadCustomStyles } from '@shopgate/engage/styles';
6
+ import ErrorBoundary from "./components/ErrorBoundary";
7
+ import { appDidStart } from "./action-creators/app";
8
+ import I18n from "./components/I18n";
9
+ import { getIsSessionExpired } from "./selectors/user";
10
+ import logout from "./actions/user/logout";
11
+
12
+ /**
2
13
  * The application component.
3
14
  * It sets up the store and the react router. The router's children (routes) come from
4
15
  * the theme's Main.jsx file which uses this component as the root element.
5
16
  * @returns {JSX}
6
- */var App=/*#__PURE__*/function(_Component){function App(){_classCallCheck(this,App);return _callSuper(this,App,arguments);}_inherits(App,_Component);return _createClass(App,[{key:"componentDidMount",value:/**
17
+ */
18
+ class App extends Component {
19
+ /**
7
20
  * Registers the component for the native events and fires the onload AppCommand.
8
- */function componentDidMount(){var _this2=this;/**
21
+ */
22
+ componentDidMount() {
23
+ /**
9
24
  * Async helper function that performs optional steps before appDidStart action is dispatched
10
- */var performAppStart=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!getIsSessionExpired(_this2.props.store.getState())){_context.next=9;break;}_context.prev=1;_context.next=4;return _this2.props.store.dispatch(logout(undefined,true));case 4:_context.next=9;break;case 6:_context.prev=6;_context.t0=_context["catch"](1);// Noting to do here
11
- console.error('AppStartLogout failed',_context.t0);case 9:_this2.props.store.dispatch(appDidStart("".concat(window.location.pathname).concat(window.location.search)));case 10:case"end":return _context.stop();}},_callee,null,[[1,6]]);}));return function performAppStart(){return _ref.apply(this,arguments);};}();performAppStart();loadCustomStyles();}/**
25
+ */
26
+ const performAppStart = async () => {
27
+ if (getIsSessionExpired(this.props.store.getState())) {
28
+ // Logout the user before appDidStart when session is expired
29
+ try {
30
+ await this.props.store.dispatch(logout(undefined, true));
31
+ } catch (e) {
32
+ // Noting to do here
33
+ console.error('AppStartLogout failed', e);
34
+ }
35
+ }
36
+ this.props.store.dispatch(appDidStart(`${window.location.pathname}${window.location.search}`));
37
+ };
38
+ performAppStart();
39
+ loadCustomStyles();
40
+ }
41
+
42
+ /**
12
43
  * Renders the component.
13
44
  * @returns {JSX}
14
- */},{key:"render",value:function render(){return React.createElement(CookiesProvider,null,React.createElement(ErrorBoundary,{key:"error.root",store:this.props.store,isRoot:true},React.createElement(Provider,{store:this.props.store},React.createElement(I18n.Provider,null,React.createElement("div",null,this.props.children)))));}}]);}(Component);export default App;
45
+ */
46
+ render() {
47
+ return /*#__PURE__*/React.createElement(CookiesProvider, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
48
+ key: "error.root",
49
+ store: this.props.store,
50
+ isRoot: true
51
+ }, /*#__PURE__*/React.createElement(Provider, {
52
+ store: this.props.store
53
+ }, /*#__PURE__*/React.createElement(I18n.Provider, null, /*#__PURE__*/React.createElement("div", null, this.props.children)))));
54
+ }
55
+ }
56
+ export default App;
@@ -1,42 +1,105 @@
1
- import{APP_WILL_INIT,APP_WILL_START,APP_DID_START,PWA_DID_APPEAR,PWA_DID_DISAPPEAR,RESET_APP,WILL_REGISTER_LINK_EVENTS,DID_REGISTER_LINK_EVENTS,OPEN_DEEP_LINK,OPEN_PUSH_NOTIFICATION,OPEN_UNIVERSAL_LINK}from"../../constants/ActionTypes";/**
1
+ import { APP_WILL_INIT, APP_WILL_START, APP_DID_START, PWA_DID_APPEAR, PWA_DID_DISAPPEAR, RESET_APP, WILL_REGISTER_LINK_EVENTS, DID_REGISTER_LINK_EVENTS, OPEN_DEEP_LINK, OPEN_PUSH_NOTIFICATION, OPEN_UNIVERSAL_LINK } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched APP_WILL_INIT action object.
3
5
  * @param {Object} location The initial history entry location.
4
6
  * @return {Object} The dispatched action object.
5
- */export var appWillInit=function appWillInit(location){return{type:APP_WILL_INIT,location:location};};/**
7
+ */
8
+ export const appWillInit = location => ({
9
+ type: APP_WILL_INIT,
10
+ location
11
+ });
12
+
13
+ /**
6
14
  * Creates the dispatched APP_WILL_START action object.
7
15
  * @param {Object} location The initial history entry location.
8
16
  * @return {Object} The dispatched action object.
9
- */export var appWillStart=function appWillStart(location){return{type:APP_WILL_START,location:location};};/**
17
+ */
18
+ export const appWillStart = location => ({
19
+ type: APP_WILL_START,
20
+ location
21
+ });
22
+
23
+ /**
10
24
  * Creates the dispatched APP_DID_START action object.
11
25
  * @param {Object} location The initial history entry location.
12
26
  * @return {Object} The dispatched action object.
13
- */export var appDidStart=function appDidStart(location){return{type:APP_DID_START,location:location};};/**
27
+ */
28
+ export const appDidStart = location => ({
29
+ type: APP_DID_START,
30
+ location
31
+ });
32
+
33
+ /**
14
34
  * Creates the dispatched RESET_APP action object.
15
35
  * @param {string[]} [reducers=undefined] The list of reducers to reset.
16
36
  * @return {Object} The dispatched action object.
17
- */export var resetApp=function resetApp(reducers){return{type:RESET_APP,reducers:reducers};};/**
37
+ */
38
+ export const resetApp = reducers => ({
39
+ type: RESET_APP,
40
+ reducers
41
+ });
42
+
43
+ /**
18
44
  * Creates the dispatched PWA_DID_APPEAR action object.
19
45
  * @return {Object} The dispatched action object.
20
- */export var pwaDidAppear=function pwaDidAppear(){return{type:PWA_DID_APPEAR};};/**
46
+ */
47
+ export const pwaDidAppear = () => ({
48
+ type: PWA_DID_APPEAR
49
+ });
50
+
51
+ /**
21
52
  * Creates the dispatched PWA_DID_DISAPPEAR action
22
53
  * @return {Object} The dispatched action object.
23
- */export var pwaDidDisappear=function pwaDidDisappear(){return{type:PWA_DID_DISAPPEAR};};/**
54
+ */
55
+ export const pwaDidDisappear = () => ({
56
+ type: PWA_DID_DISAPPEAR
57
+ });
58
+
59
+ /**
24
60
  * Creates the dispatched WILL_REGISTER_LINK_EVENTS action object.
25
61
  * @return {Object} The dispatched action object.
26
- */export var willRegisterLinkEvents=function willRegisterLinkEvents(){return{type:WILL_REGISTER_LINK_EVENTS};};/**
62
+ */
63
+ export const willRegisterLinkEvents = () => ({
64
+ type: WILL_REGISTER_LINK_EVENTS
65
+ });
66
+
67
+ /**
27
68
  * Creates the dispatched DID_REGISTER_LINK_EVENTS action object.
28
69
  * @return {Object} The dispatched action object.
29
- */export var didRegisterLinkEvents=function didRegisterLinkEvents(){return{type:DID_REGISTER_LINK_EVENTS};};/**
70
+ */
71
+ export const didRegisterLinkEvents = () => ({
72
+ type: DID_REGISTER_LINK_EVENTS
73
+ });
74
+
75
+ /**
30
76
  * Creates the dispatched OPEN_DEEP_LINK action object.
31
77
  * @param {Object} payload The payload of the deeplink
32
78
  * @return {Object} The dispatched action object.
33
- */export var openDeepLink=function openDeepLink(payload){return{type:OPEN_DEEP_LINK,payload:payload};};/**
79
+ */
80
+ export const openDeepLink = payload => ({
81
+ type: OPEN_DEEP_LINK,
82
+ payload
83
+ });
84
+
85
+ /**
34
86
  * Creates the dispatched OPEN_PUSH_NOTIFICATION action object.
35
87
  * @param {string} notificationId The notification ID.
36
88
  * @param {string} [link] The link of the notification.
37
89
  * @return {Object} The dispatched action object.
38
- */export var openPushNotification=function openPushNotification(notificationId){var link=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';return{type:OPEN_PUSH_NOTIFICATION,notificationId:notificationId,link:link};};/**
90
+ */
91
+ export const openPushNotification = (notificationId, link = '') => ({
92
+ type: OPEN_PUSH_NOTIFICATION,
93
+ notificationId,
94
+ link
95
+ });
96
+
97
+ /**
39
98
  * Creates the dispatched OPEN_UNIVERSAL_LINK action object.
40
99
  * @param {Object} payload The payload of the universal link.
41
100
  * @return {Object} The dispatched action object.
42
- */export var openUniversalLink=function openUniversalLink(payload){return{type:OPEN_UNIVERSAL_LINK,payload:payload};};
101
+ */
102
+ export const openUniversalLink = payload => ({
103
+ type: OPEN_UNIVERSAL_LINK,
104
+ payload
105
+ });
@@ -1 +1,96 @@
1
- import{APP_WILL_START,APP_DID_START,PWA_DID_APPEAR,PWA_DID_DISAPPEAR,WILL_REGISTER_LINK_EVENTS,DID_REGISTER_LINK_EVENTS,OPEN_DEEP_LINK,OPEN_PUSH_NOTIFICATION,OPEN_UNIVERSAL_LINK}from"../../constants/ActionTypes";import{appWillStart,appDidStart,pwaDidAppear,pwaDidDisappear,willRegisterLinkEvents,didRegisterLinkEvents,openDeepLink,openPushNotification,openUniversalLink}from"./index";var dataMock={some:'data'};describe('Action Creators: app',function(){describe('appWillStart()',function(){it('should work as expected',function(){var expected={type:APP_WILL_START,location:dataMock};expect(appWillStart(dataMock)).toEqual(expected);});});describe('appDidStart()',function(){it('should work as expected',function(){var expected={type:APP_DID_START};expect(appDidStart()).toEqual(expected);});});describe('pwaDidAppear()',function(){it('should work as expected',function(){var expected={type:PWA_DID_APPEAR};expect(pwaDidAppear()).toEqual(expected);});});describe('pwaDidDisappear()',function(){it('should work as expected',function(){var expected={type:PWA_DID_DISAPPEAR};expect(pwaDidDisappear()).toEqual(expected);});});describe('willRegisterLinkEvents()',function(){it('should work as expected',function(){var expected={type:WILL_REGISTER_LINK_EVENTS};expect(willRegisterLinkEvents()).toEqual(expected);});});describe('didRegisterLinkEvents()',function(){it('should work as expected',function(){var expected={type:DID_REGISTER_LINK_EVENTS};expect(didRegisterLinkEvents()).toEqual(expected);});});describe('openDeepLink()',function(){it('should work as expected',function(){var expected={type:OPEN_DEEP_LINK,payload:dataMock};expect(openDeepLink(dataMock)).toEqual(expected);});});describe('openPushNotification()',function(){var notificationId='abc123';var link='/link/to/somewhere';it('should work as expected',function(){var expected={type:OPEN_PUSH_NOTIFICATION,notificationId:notificationId,link:link};expect(openPushNotification(notificationId,link)).toEqual(expected);});it('should work as expected when the link is empty',function(){var expected={type:OPEN_PUSH_NOTIFICATION,notificationId:notificationId,link:''};expect(openPushNotification(notificationId)).toEqual(expected);});});describe('openUniversalLink()',function(){var expected={type:OPEN_UNIVERSAL_LINK,payload:{link:'https://testshop.shopgate.com/item/313131313132',wasOpenedFromSearchIndex:true,linkSerial:1003}};expect(openUniversalLink(expected.payload)).toEqual(expected);});});
1
+ import { APP_WILL_START, APP_DID_START, PWA_DID_APPEAR, PWA_DID_DISAPPEAR, WILL_REGISTER_LINK_EVENTS, DID_REGISTER_LINK_EVENTS, OPEN_DEEP_LINK, OPEN_PUSH_NOTIFICATION, OPEN_UNIVERSAL_LINK } from "../../constants/ActionTypes";
2
+ import { appWillStart, appDidStart, pwaDidAppear, pwaDidDisappear, willRegisterLinkEvents, didRegisterLinkEvents, openDeepLink, openPushNotification, openUniversalLink } from "./index";
3
+ const dataMock = {
4
+ some: 'data'
5
+ };
6
+ describe('Action Creators: app', () => {
7
+ describe('appWillStart()', () => {
8
+ it('should work as expected', () => {
9
+ const expected = {
10
+ type: APP_WILL_START,
11
+ location: dataMock
12
+ };
13
+ expect(appWillStart(dataMock)).toEqual(expected);
14
+ });
15
+ });
16
+ describe('appDidStart()', () => {
17
+ it('should work as expected', () => {
18
+ const expected = {
19
+ type: APP_DID_START
20
+ };
21
+ expect(appDidStart()).toEqual(expected);
22
+ });
23
+ });
24
+ describe('pwaDidAppear()', () => {
25
+ it('should work as expected', () => {
26
+ const expected = {
27
+ type: PWA_DID_APPEAR
28
+ };
29
+ expect(pwaDidAppear()).toEqual(expected);
30
+ });
31
+ });
32
+ describe('pwaDidDisappear()', () => {
33
+ it('should work as expected', () => {
34
+ const expected = {
35
+ type: PWA_DID_DISAPPEAR
36
+ };
37
+ expect(pwaDidDisappear()).toEqual(expected);
38
+ });
39
+ });
40
+ describe('willRegisterLinkEvents()', () => {
41
+ it('should work as expected', () => {
42
+ const expected = {
43
+ type: WILL_REGISTER_LINK_EVENTS
44
+ };
45
+ expect(willRegisterLinkEvents()).toEqual(expected);
46
+ });
47
+ });
48
+ describe('didRegisterLinkEvents()', () => {
49
+ it('should work as expected', () => {
50
+ const expected = {
51
+ type: DID_REGISTER_LINK_EVENTS
52
+ };
53
+ expect(didRegisterLinkEvents()).toEqual(expected);
54
+ });
55
+ });
56
+ describe('openDeepLink()', () => {
57
+ it('should work as expected', () => {
58
+ const expected = {
59
+ type: OPEN_DEEP_LINK,
60
+ payload: dataMock
61
+ };
62
+ expect(openDeepLink(dataMock)).toEqual(expected);
63
+ });
64
+ });
65
+ describe('openPushNotification()', () => {
66
+ const notificationId = 'abc123';
67
+ const link = '/link/to/somewhere';
68
+ it('should work as expected', () => {
69
+ const expected = {
70
+ type: OPEN_PUSH_NOTIFICATION,
71
+ notificationId,
72
+ link
73
+ };
74
+ expect(openPushNotification(notificationId, link)).toEqual(expected);
75
+ });
76
+ it('should work as expected when the link is empty', () => {
77
+ const expected = {
78
+ type: OPEN_PUSH_NOTIFICATION,
79
+ notificationId,
80
+ link: ''
81
+ };
82
+ expect(openPushNotification(notificationId)).toEqual(expected);
83
+ });
84
+ });
85
+ describe('openUniversalLink()', () => {
86
+ const expected = {
87
+ type: OPEN_UNIVERSAL_LINK,
88
+ payload: {
89
+ link: 'https://testshop.shopgate.com/item/313131313132',
90
+ wasOpenedFromSearchIndex: true,
91
+ linkSerial: 1003
92
+ }
93
+ };
94
+ expect(openUniversalLink(expected.payload)).toEqual(expected);
95
+ });
96
+ });
@@ -1,15 +1,37 @@
1
- import{REQUEST_CLIENT_INFORMATION,RECEIVE_CLIENT_INFORMATION,ERROR_CLIENT_INFORMATION,RECEIVE_CLIENT_CONNECTIVITY}from"../../constants/ActionTypes";/**
1
+ import { REQUEST_CLIENT_INFORMATION, RECEIVE_CLIENT_INFORMATION, ERROR_CLIENT_INFORMATION, RECEIVE_CLIENT_CONNECTIVITY } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched REQUEST_CLIENT_INFORMATION action object.
3
5
  * @returns {Object} The dispatched action object.
4
- */export var requestClientInformation=function requestClientInformation(){return{type:REQUEST_CLIENT_INFORMATION};};/**
6
+ */
7
+ export const requestClientInformation = () => ({
8
+ type: REQUEST_CLIENT_INFORMATION
9
+ });
10
+
11
+ /**
5
12
  * Creates the dispatched RECEIVE_CLIENT_INFORMATION action object.
6
13
  * @param {Object} data The received client information data.
7
14
  * @returns {Object} The dispatched action object.
8
- */export var receiveClientInformation=function receiveClientInformation(data){return{type:RECEIVE_CLIENT_INFORMATION,data:data};};/**
15
+ */
16
+ export const receiveClientInformation = data => ({
17
+ type: RECEIVE_CLIENT_INFORMATION,
18
+ data
19
+ });
20
+
21
+ /**
9
22
  * Creates the dispatched ERROR_CLIENT_INFORMATION action object.
10
23
  * @returns {Object} The dispatched action object.
11
- */export var errorClientInformation=function errorClientInformation(){return{type:ERROR_CLIENT_INFORMATION};};/**
24
+ */
25
+ export const errorClientInformation = () => ({
26
+ type: ERROR_CLIENT_INFORMATION
27
+ });
28
+
29
+ /**
12
30
  * Creates the dispatched RECEIVE_CLIENT_CONNECTIVITY action object.
13
31
  * @param {Object} data The received client connectivity data.
14
32
  * @returns {Object} The dispatched action object.
15
- */export var receiveClientConnectivity=function receiveClientConnectivity(data){return{type:RECEIVE_CLIENT_CONNECTIVITY,data:data};};
33
+ */
34
+ export const receiveClientConnectivity = data => ({
35
+ type: RECEIVE_CLIENT_CONNECTIVITY,
36
+ data
37
+ });
@@ -1 +1,44 @@
1
- import{requestClientInformation,receiveClientInformation,errorClientInformation,receiveClientConnectivity}from"./index";import{REQUEST_CLIENT_INFORMATION,RECEIVE_CLIENT_INFORMATION,ERROR_CLIENT_INFORMATION,RECEIVE_CLIENT_CONNECTIVITY}from"../../constants/ActionTypes";describe('Action Creators: client',function(){describe('requestClientInformation()',function(){it('should work as expected',function(){var expected={type:REQUEST_CLIENT_INFORMATION};expect(requestClientInformation()).toEqual(expected);});});describe('receiveClientInformation()',function(){it('should work as expected',function(){var data={some:'data'};var expected={type:RECEIVE_CLIENT_INFORMATION,data:data};expect(receiveClientInformation(data)).toEqual(expected);});});describe('errorClientInformation()',function(){it('should work as expected',function(){var expected={type:ERROR_CLIENT_INFORMATION};expect(errorClientInformation()).toEqual(expected);});});describe('receiveClientConnectivity()',function(){it('should work as expected',function(){var data={some:'data'};var expected={type:RECEIVE_CLIENT_CONNECTIVITY,data:data};expect(receiveClientConnectivity(data)).toEqual(expected);});});});
1
+ import { requestClientInformation, receiveClientInformation, errorClientInformation, receiveClientConnectivity } from "./index";
2
+ import { REQUEST_CLIENT_INFORMATION, RECEIVE_CLIENT_INFORMATION, ERROR_CLIENT_INFORMATION, RECEIVE_CLIENT_CONNECTIVITY } from "../../constants/ActionTypes";
3
+ describe('Action Creators: client', () => {
4
+ describe('requestClientInformation()', () => {
5
+ it('should work as expected', () => {
6
+ const expected = {
7
+ type: REQUEST_CLIENT_INFORMATION
8
+ };
9
+ expect(requestClientInformation()).toEqual(expected);
10
+ });
11
+ });
12
+ describe('receiveClientInformation()', () => {
13
+ it('should work as expected', () => {
14
+ const data = {
15
+ some: 'data'
16
+ };
17
+ const expected = {
18
+ type: RECEIVE_CLIENT_INFORMATION,
19
+ data
20
+ };
21
+ expect(receiveClientInformation(data)).toEqual(expected);
22
+ });
23
+ });
24
+ describe('errorClientInformation()', () => {
25
+ it('should work as expected', () => {
26
+ const expected = {
27
+ type: ERROR_CLIENT_INFORMATION
28
+ };
29
+ expect(errorClientInformation()).toEqual(expected);
30
+ });
31
+ });
32
+ describe('receiveClientConnectivity()', () => {
33
+ it('should work as expected', () => {
34
+ const data = {
35
+ some: 'data'
36
+ };
37
+ const expected = {
38
+ type: RECEIVE_CLIENT_CONNECTIVITY,
39
+ data
40
+ };
41
+ expect(receiveClientConnectivity(data)).toEqual(expected);
42
+ });
43
+ });
44
+ });
@@ -1,9 +1,21 @@
1
- import{APP_ERROR,PIPELINE_ERROR}from"../../constants/ActionTypes";/**
1
+ import { APP_ERROR, PIPELINE_ERROR } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched APP_ERROR action object.
3
5
  * @param {Object} error The error object.
4
6
  * @return {Object} The dispatched action object.
5
- */export var appError=function appError(error){return{type:APP_ERROR,error:error};};/**
7
+ */
8
+ export const appError = error => ({
9
+ type: APP_ERROR,
10
+ error
11
+ });
12
+
13
+ /**
6
14
  * Creates the dispatched PIPELINE_ERROR action object.
7
15
  * @param {Object} error The error object.
8
16
  * @return {Object} The dispatched action object.
9
- */export var pipelineError=function pipelineError(error){return{type:PIPELINE_ERROR,error:error};};
17
+ */
18
+ export const pipelineError = error => ({
19
+ type: PIPELINE_ERROR,
20
+ error
21
+ });
@@ -1 +1,9 @@
1
- export*from"./app";export*from"./client";export*from"./error";export*from"./menu";export*from"./modal";export*from"./page";export*from"./router";export*from"./url";export*from"./user";
1
+ export * from "./app";
2
+ export * from "./client";
3
+ export * from "./error";
4
+ export * from "./menu";
5
+ export * from "./modal";
6
+ export * from "./page";
7
+ export * from "./router";
8
+ export * from "./url";
9
+ export * from "./user";
@@ -1,14 +1,33 @@
1
- import{REQUEST_MENU,RECEIVE_MENU,ERROR_MENU}from"../../constants/ActionTypes";/**
1
+ import { REQUEST_MENU, RECEIVE_MENU, ERROR_MENU } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched REQUEST_MENU action object.
3
5
  * @param {string} id The menu id.
4
6
  * @return {Object} The dispatched action object.
5
- */export var requestMenu=function requestMenu(id){return{type:REQUEST_MENU,id:id};};/**
7
+ */
8
+ export const requestMenu = id => ({
9
+ type: REQUEST_MENU,
10
+ id
11
+ });
12
+
13
+ /**
6
14
  * Creates the dispatched RECEIVE_MENU action object
7
15
  * @param {string} id The menu id.
8
16
  * @param {Array} entries The menu entries.
9
17
  * @return {Object} The dispatched action object.
10
- */export var receiveMenu=function receiveMenu(id,entries){return{type:RECEIVE_MENU,id:id,entries:entries};};/**
18
+ */
19
+ export const receiveMenu = (id, entries) => ({
20
+ type: RECEIVE_MENU,
21
+ id,
22
+ entries
23
+ });
24
+
25
+ /**
11
26
  * Creates the dispatched ERROR_MENU action object.
12
27
  * @param {string} id The menu id.
13
28
  * @return {Object} The dispatched action object.
14
- */export var errorMenu=function errorMenu(id){return{type:ERROR_MENU,id:id};};
29
+ */
30
+ export const errorMenu = id => ({
31
+ type: ERROR_MENU,
32
+ id
33
+ });
@@ -1 +1,37 @@
1
- import{REQUEST_MENU,RECEIVE_MENU,ERROR_MENU}from"../../constants/ActionTypes";import{requestMenu,receiveMenu,errorMenu}from"./index";var entries=[{url:'/',label:'Page Label'}];var id='quicklinks';describe('Action Creators: menu',function(){describe('requestMenu()',function(){it('should work as expected',function(){var expected={type:REQUEST_MENU,id:id};expect(requestMenu(id)).toEqual(expected);});});describe('receiveMenu()',function(){it('should work as expected',function(){var expected={type:RECEIVE_MENU,id:id,entries:entries};expect(receiveMenu(id,entries)).toEqual(expected);});});describe('errorMenu()',function(){it('should work as expected',function(){var expected={type:ERROR_MENU,id:id};expect(errorMenu(id)).toEqual(expected);});});});
1
+ import { REQUEST_MENU, RECEIVE_MENU, ERROR_MENU } from "../../constants/ActionTypes";
2
+ import { requestMenu, receiveMenu, errorMenu } from "./index";
3
+ const entries = [{
4
+ url: '/',
5
+ label: 'Page Label'
6
+ }];
7
+ const id = 'quicklinks';
8
+ describe('Action Creators: menu', () => {
9
+ describe('requestMenu()', () => {
10
+ it('should work as expected', () => {
11
+ const expected = {
12
+ type: REQUEST_MENU,
13
+ id
14
+ };
15
+ expect(requestMenu(id)).toEqual(expected);
16
+ });
17
+ });
18
+ describe('receiveMenu()', () => {
19
+ it('should work as expected', () => {
20
+ const expected = {
21
+ type: RECEIVE_MENU,
22
+ id,
23
+ entries
24
+ };
25
+ expect(receiveMenu(id, entries)).toEqual(expected);
26
+ });
27
+ });
28
+ describe('errorMenu()', () => {
29
+ it('should work as expected', () => {
30
+ const expected = {
31
+ type: ERROR_MENU,
32
+ id
33
+ };
34
+ expect(errorMenu(id)).toEqual(expected);
35
+ });
36
+ });
37
+ });
@@ -1,9 +1,21 @@
1
- import{CREATE_MODAL,REMOVE_MODAL}from"../../constants/ActionTypes";/**
1
+ import { CREATE_MODAL, REMOVE_MODAL } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched CREATE_MODAL action object.
3
5
  * @param {Object} options The modal options.
4
6
  * @return {Object} The dispatched action object.
5
- */export var createModal=function createModal(options){return{type:CREATE_MODAL,options:options};};/**
7
+ */
8
+ export const createModal = options => ({
9
+ type: CREATE_MODAL,
10
+ options
11
+ });
12
+
13
+ /**
6
14
  * Creates the dispatched REMOVE_MODAL action object.
7
15
  * @param {string} id The modal id to remove.
8
16
  * @return {Object} The dispatched action object.
9
- */export var removeModal=function removeModal(id){return{type:REMOVE_MODAL,id:id};};
17
+ */
18
+ export const removeModal = id => ({
19
+ type: REMOVE_MODAL,
20
+ id
21
+ });
@@ -1 +1,26 @@
1
- import{CREATE_MODAL,REMOVE_MODAL}from"../../constants/ActionTypes";import{createModal,removeModal}from"./index";var options={some:'data'};var id='modalId';describe('Action Creators: modal',function(){describe('createModal()',function(){it('should work as expected',function(){var expected={type:CREATE_MODAL,options:options};expect(createModal(options)).toEqual(expected);});});describe('removeModal()',function(){it('should work as expected',function(){var expected={type:REMOVE_MODAL,id:id};expect(removeModal(id)).toEqual(expected);});});});
1
+ import { CREATE_MODAL, REMOVE_MODAL } from "../../constants/ActionTypes";
2
+ import { createModal, removeModal } from "./index";
3
+ const options = {
4
+ some: 'data'
5
+ };
6
+ const id = 'modalId';
7
+ describe('Action Creators: modal', () => {
8
+ describe('createModal()', () => {
9
+ it('should work as expected', () => {
10
+ const expected = {
11
+ type: CREATE_MODAL,
12
+ options
13
+ };
14
+ expect(createModal(options)).toEqual(expected);
15
+ });
16
+ });
17
+ describe('removeModal()', () => {
18
+ it('should work as expected', () => {
19
+ const expected = {
20
+ type: REMOVE_MODAL,
21
+ id
22
+ };
23
+ expect(removeModal(id)).toEqual(expected);
24
+ });
25
+ });
26
+ });
@@ -1,15 +1,35 @@
1
- import{REQUEST_PAGE_CONFIG,RECEIVE_PAGE_CONFIG,ERROR_PAGE_CONFIG}from"../../constants/ActionTypes";/**
1
+ import { REQUEST_PAGE_CONFIG, RECEIVE_PAGE_CONFIG, ERROR_PAGE_CONFIG } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Creates the dispatched REQUEST_PAGE_CONFIG action object.
3
5
  * @param {Object} pageId The page to get the widgets for.
4
6
  * @returns {Object} The dispatched action object.
5
- */export var requestPageConfig=function requestPageConfig(pageId){return{type:REQUEST_PAGE_CONFIG,pageId:pageId};};/**
7
+ */
8
+ export const requestPageConfig = pageId => ({
9
+ type: REQUEST_PAGE_CONFIG,
10
+ pageId
11
+ });
12
+
13
+ /**
6
14
  * Creates the dispatched RECEIVE_PAGE_CONFIG action object.
7
15
  * @param {Object} pageId The page id.
8
16
  * @param {Object} config The page configuration.
9
17
  * @returns {Object} The dispatched action object.
10
- */export var receivePageConfig=function receivePageConfig(pageId,config){return{type:RECEIVE_PAGE_CONFIG,pageId:pageId,config:config};};/**
18
+ */
19
+ export const receivePageConfig = (pageId, config) => ({
20
+ type: RECEIVE_PAGE_CONFIG,
21
+ pageId,
22
+ config
23
+ });
24
+
25
+ /**
11
26
  * Creates the dispatched ERROR_PAGE_CONFIG action object.
12
27
  * @param {Object} pageId The page id.
13
28
  * @param {string} errorCode The error code.
14
29
  * @returns {Object} The dispatched action object.
15
- */export var errorPageConfig=function errorPageConfig(pageId,errorCode){return{type:ERROR_PAGE_CONFIG,pageId:pageId,errorCode:errorCode};};
30
+ */
31
+ export const errorPageConfig = (pageId, errorCode) => ({
32
+ type: ERROR_PAGE_CONFIG,
33
+ pageId,
34
+ errorCode
35
+ });
@@ -1 +1,38 @@
1
- import{REQUEST_PAGE_CONFIG,RECEIVE_PAGE_CONFIG,ERROR_PAGE_CONFIG}from"../../constants/ActionTypes";import{requestPageConfig,receivePageConfig,errorPageConfig}from"./index";var pageId='index';var config={some:'data'};describe('Action Creators: page',function(){describe('requestPageConfig()',function(){it('should work as expected',function(){var expected={type:REQUEST_PAGE_CONFIG,pageId:pageId};expect(requestPageConfig(pageId)).toEqual(expected);});});describe('receivePageConfig()',function(){it('should work as expected',function(){var expected={type:RECEIVE_PAGE_CONFIG,pageId:pageId,config:config};expect(receivePageConfig(pageId,config)).toEqual(expected);});});describe('errorPageConfig()',function(){it('should work as expected',function(){var errorCode='error';var expected={type:ERROR_PAGE_CONFIG,errorCode:errorCode,pageId:pageId};expect(errorPageConfig(pageId,errorCode)).toEqual(expected);});});});
1
+ import { REQUEST_PAGE_CONFIG, RECEIVE_PAGE_CONFIG, ERROR_PAGE_CONFIG } from "../../constants/ActionTypes";
2
+ import { requestPageConfig, receivePageConfig, errorPageConfig } from "./index";
3
+ const pageId = 'index';
4
+ const config = {
5
+ some: 'data'
6
+ };
7
+ describe('Action Creators: page', () => {
8
+ describe('requestPageConfig()', () => {
9
+ it('should work as expected', () => {
10
+ const expected = {
11
+ type: REQUEST_PAGE_CONFIG,
12
+ pageId
13
+ };
14
+ expect(requestPageConfig(pageId)).toEqual(expected);
15
+ });
16
+ });
17
+ describe('receivePageConfig()', () => {
18
+ it('should work as expected', () => {
19
+ const expected = {
20
+ type: RECEIVE_PAGE_CONFIG,
21
+ pageId,
22
+ config
23
+ };
24
+ expect(receivePageConfig(pageId, config)).toEqual(expected);
25
+ });
26
+ });
27
+ describe('errorPageConfig()', () => {
28
+ it('should work as expected', () => {
29
+ const errorCode = 'error';
30
+ const expected = {
31
+ type: ERROR_PAGE_CONFIG,
32
+ errorCode,
33
+ pageId
34
+ };
35
+ expect(errorPageConfig(pageId, errorCode)).toEqual(expected);
36
+ });
37
+ });
38
+ });