@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
@@ -1,12 +1,75 @@
1
- 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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{ENOTFOUND}from'@shopgate/pwa-core/constants/Pipeline';import{REQUEST_PAGE_CONFIG,RECEIVE_PAGE_CONFIG,ERROR_PAGE_CONFIG,APP_WILL_START}from"../../constants/ActionTypes";/**
1
+ import "core-js/modules/es.array.reduce.js";
2
+ import { ENOTFOUND } from '@shopgate/pwa-core/constants/Pipeline';
3
+ import { REQUEST_PAGE_CONFIG, RECEIVE_PAGE_CONFIG, ERROR_PAGE_CONFIG, APP_WILL_START } from "../../constants/ActionTypes";
4
+
5
+ /**
2
6
  * Enrich the widget data.
3
7
  * @param {Object} action The action that was received.
4
8
  * @return {Object} An enriched set of widgets.
5
- */var enrichWidgets=function enrichWidgets(action){return action.config.widgets.map(function(widget,index){return _extends({},widget,{id:"".concat(action.pageId,"-").concat(index,"-").concat(widget.type)});});};/**
9
+ */
10
+ const enrichWidgets = action => action.config.widgets.map((widget, index) => ({
11
+ ...widget,
12
+ id: `${action.pageId}-${index}-${widget.type}`
13
+ }));
14
+
15
+ /**
6
16
  * The page config reducer.
7
17
  * @param {Object} [state={}] The current application state.
8
18
  * @param {Object} action The action object.
9
19
  * @return {Object} The store data.
10
- */export default function pageReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case REQUEST_PAGE_CONFIG:return _extends({},state,_defineProperty({},action.pageId,_extends({},state[action.pageId],{isFetching:true,expires:0})));case RECEIVE_PAGE_CONFIG:{return _extends({},state,_defineProperty({},action.pageId,{title:action.config.title,widgets:enrichWidgets(action),isFetching:false,expires:Date.now()+3600000// One hour
11
- }));}case ERROR_PAGE_CONFIG:{if(action.errorCode===ENOTFOUND){// Remove the temporary page entry from the state when noting was found for the pageId.
12
- var _action$pageId2=action.pageId,ignore=state[_action$pageId2],rest=_objectWithoutProperties(state,[_action$pageId2].map(_toPropertyKey));return rest;}return _extends({},state,_defineProperty({},action.pageId,_extends({},state[action.pageId],{isFetching:false,expires:0})));}case APP_WILL_START:{return Object.keys(state).reduce(function(acc,pageId){acc[pageId].expires=0;return acc;},_extends({},state));}default:return state;}}
20
+ */
21
+ export default function pageReducer(state = {}, action) {
22
+ switch (action.type) {
23
+ case REQUEST_PAGE_CONFIG:
24
+ return {
25
+ ...state,
26
+ [action.pageId]: {
27
+ ...state[action.pageId],
28
+ isFetching: true,
29
+ expires: 0
30
+ }
31
+ };
32
+ case RECEIVE_PAGE_CONFIG:
33
+ {
34
+ return {
35
+ ...state,
36
+ [action.pageId]: {
37
+ title: action.config.title,
38
+ widgets: enrichWidgets(action),
39
+ isFetching: false,
40
+ expires: Date.now() + 3600000 // One hour
41
+ }
42
+ };
43
+ }
44
+ case ERROR_PAGE_CONFIG:
45
+ {
46
+ if (action.errorCode === ENOTFOUND) {
47
+ // Remove the temporary page entry from the state when noting was found for the pageId.
48
+ const {
49
+ [action.pageId]: ignore,
50
+ ...rest
51
+ } = state;
52
+ return rest;
53
+ }
54
+ return {
55
+ ...state,
56
+ [action.pageId]: {
57
+ ...state[action.pageId],
58
+ isFetching: false,
59
+ expires: 0
60
+ }
61
+ };
62
+ }
63
+ case APP_WILL_START:
64
+ {
65
+ return Object.keys(state).reduce((acc, pageId) => {
66
+ acc[pageId].expires = 0;
67
+ return acc;
68
+ }, {
69
+ ...state
70
+ });
71
+ }
72
+ default:
73
+ return state;
74
+ }
75
+ }
@@ -1,5 +1,51 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import cloneDeep from'lodash/cloneDeep';import{stack}from'@virtuous/conductor';import{ROUTE_WILL_ENTER,ROUTE_DID_LEAVE,ROUTE_WILL_LEAVE,ROUTE_DID_UPDATE,ROUTE_DID_ENTER}from"../../constants/ActionTypes";var defaultState={currentRoute:null,stack:[]};/**
1
+ import cloneDeep from 'lodash/cloneDeep';
2
+ import { stack } from '@virtuous/conductor';
3
+ import { ROUTE_WILL_ENTER, ROUTE_DID_LEAVE, ROUTE_WILL_LEAVE, ROUTE_DID_UPDATE, ROUTE_DID_ENTER } from "../../constants/ActionTypes";
4
+ const defaultState = {
5
+ currentRoute: null,
6
+ stack: []
7
+ };
8
+
9
+ /**
2
10
  * @param {Object} state The current state.
3
11
  * @param {Object} action The action object.
4
12
  * @returns {Object}
5
- */export default function router(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case ROUTE_WILL_LEAVE:case ROUTE_DID_LEAVE:{return _extends({},state,{stack:Array.from(stack.getAll().values())});}case ROUTE_WILL_ENTER:case ROUTE_DID_ENTER:return _extends({},state,{stack:Array.from(stack.getAll().values()),currentRoute:cloneDeep(action.route)});case ROUTE_DID_UPDATE:{var _ref2=state.currentRoute||{},currentId=_ref2.id;var updatedId=action.route.id;if(currentId===updatedId){return _extends({},state,{stack:Array.from(stack.getAll().values()),currentRoute:cloneDeep(action.route)});}return state;}default:return state;}}
13
+ */
14
+ export default function router(state = defaultState, action) {
15
+ switch (action.type) {
16
+ case ROUTE_WILL_LEAVE:
17
+ case ROUTE_DID_LEAVE:
18
+ {
19
+ return {
20
+ ...state,
21
+ stack: Array.from(stack.getAll().values())
22
+ };
23
+ }
24
+ case ROUTE_WILL_ENTER:
25
+ case ROUTE_DID_ENTER:
26
+ return {
27
+ ...state,
28
+ stack: Array.from(stack.getAll().values()),
29
+ currentRoute: cloneDeep(action.route)
30
+ };
31
+ case ROUTE_DID_UPDATE:
32
+ {
33
+ const {
34
+ id: currentId
35
+ } = state.currentRoute || {};
36
+ const {
37
+ id: updatedId
38
+ } = action.route;
39
+ if (currentId === updatedId) {
40
+ return {
41
+ ...state,
42
+ stack: Array.from(stack.getAll().values()),
43
+ currentRoute: cloneDeep(action.route)
44
+ };
45
+ }
46
+ return state;
47
+ }
48
+ default:
49
+ return state;
50
+ }
51
+ }
@@ -1,8 +1,47 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{REQUEST_URL,RECEIVE_URL,ERROR_URL}from"../../constants/ActionTypes";var URL_LIFETIME=300000;// 5 minutes in milliseconds
2
- var defaultState={};/**
1
+ import { REQUEST_URL, RECEIVE_URL, ERROR_URL } from "../../constants/ActionTypes";
2
+ const URL_LIFETIME = 300000; // 5 minutes in milliseconds
3
+ const defaultState = {};
4
+
5
+ /**
3
6
  * Stores the requested urls
4
7
  * This part of the store is stored in the localStorage!
5
8
  * @param {Object} [state] The current state.
6
9
  * @param {Object} action The action object.
7
10
  * @return {Object} The new state.
8
- */export default function urlReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case REQUEST_URL:return _extends({},state,_defineProperty({},action.urlType,_extends({},state[action.urlType],{url:null,isFetching:true,expires:0})));case RECEIVE_URL:return _extends({},state,_defineProperty({},action.urlType,_extends({},state[action.urlType],{url:action.url,isFetching:false,expires:action.expires?Date.parse(action.expires):Date.now()+URL_LIFETIME})));case ERROR_URL:return _extends({},state,_defineProperty({},action.urlType,_extends({},state[action.urlType],{url:null,isFetching:false,expires:0})));default:return state;}}
11
+ */
12
+ export default function urlReducer(state = defaultState, action) {
13
+ switch (action.type) {
14
+ case REQUEST_URL:
15
+ return {
16
+ ...state,
17
+ [action.urlType]: {
18
+ ...state[action.urlType],
19
+ url: null,
20
+ isFetching: true,
21
+ expires: 0
22
+ }
23
+ };
24
+ case RECEIVE_URL:
25
+ return {
26
+ ...state,
27
+ [action.urlType]: {
28
+ ...state[action.urlType],
29
+ url: action.url,
30
+ isFetching: false,
31
+ expires: action.expires ? Date.parse(action.expires) : Date.now() + URL_LIFETIME
32
+ }
33
+ };
34
+ case ERROR_URL:
35
+ return {
36
+ ...state,
37
+ [action.urlType]: {
38
+ ...state[action.urlType],
39
+ url: null,
40
+ isFetching: false,
41
+ expires: 0
42
+ }
43
+ };
44
+ default:
45
+ return state;
46
+ }
47
+ }
@@ -1,6 +1,31 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{REQUEST_USER,RECEIVE_USER,ERROR_USER,SUCCESS_LOGOUT}from"../../constants/ActionTypes";/**
1
+ import { REQUEST_USER, RECEIVE_USER, ERROR_USER, SUCCESS_LOGOUT } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Stores the user data state
3
5
  * @param {Object} [state] The current state.
4
6
  * @param {Object} action The action object.
5
7
  * @return {Object} The new state.
6
- */export default function userDataReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case REQUEST_USER:return _extends({},state,{isFetching:true});case RECEIVE_USER:return _extends({},state,{},action.user,{isFetching:false});case ERROR_USER:return{isFetching:false};case SUCCESS_LOGOUT:return{};default:return state;}}
8
+ */
9
+ export default function userDataReducer(state = {}, action) {
10
+ switch (action.type) {
11
+ case REQUEST_USER:
12
+ return {
13
+ ...state,
14
+ isFetching: true
15
+ };
16
+ case RECEIVE_USER:
17
+ return {
18
+ ...state,
19
+ ...action.user,
20
+ isFetching: false
21
+ };
22
+ case ERROR_USER:
23
+ return {
24
+ isFetching: false
25
+ };
26
+ case SUCCESS_LOGOUT:
27
+ return {};
28
+ default:
29
+ return state;
30
+ }
31
+ }
@@ -1 +1,7 @@
1
- import{combineReducers}from'redux';import login from"./login";import data from"./data";export default combineReducers({login:login,data:data});
1
+ import { combineReducers } from 'redux';
2
+ import login from "./login";
3
+ import data from "./data";
4
+ export default combineReducers({
5
+ login,
6
+ data
7
+ });
@@ -1,6 +1,69 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{APP_DID_START,REQUEST_LOGIN,SUCCESS_LOGIN,TOGGLE_LOGGED_IN,ERROR_LOGIN,SUCCESS_LOGOUT,DISABLE_LOGIN}from"../../constants/ActionTypes";var defaultState={isFetching:false,disabled:false,isLoggedIn:false,errors:null,strategy:null,expires:null};/**
1
+ import { APP_DID_START, REQUEST_LOGIN, SUCCESS_LOGIN, TOGGLE_LOGGED_IN, ERROR_LOGIN, SUCCESS_LOGOUT, DISABLE_LOGIN } from "../../constants/ActionTypes";
2
+ const defaultState = {
3
+ isFetching: false,
4
+ disabled: false,
5
+ isLoggedIn: false,
6
+ errors: null,
7
+ strategy: null,
8
+ expires: null
9
+ };
10
+
11
+ /**
2
12
  * Stores the login state
3
13
  * @param {Object} [state] The current state.
4
14
  * @param {Object} action The action object.
5
15
  * @return {Object} The new state.
6
- */export default function userLoginReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case APP_DID_START:return _extends({},state,{disabled:false});case DISABLE_LOGIN:return _extends({},state,{disabled:action.value});case REQUEST_LOGIN:return _extends({},state,{strategy:action.strategy,isFetching:true});case SUCCESS_LOGIN:return _extends({},state,{isLoggedIn:true,errors:null,isFetching:false,strategy:action.strategy},typeof action.sessionLifetimeInSeconds==='number'?{expires:new Date().getTime()+action.sessionLifetimeInSeconds*1000}:{expires:null});case ERROR_LOGIN:return _extends({},state,{errors:action.messages,isLoggedIn:false,isFetching:false});case TOGGLE_LOGGED_IN:return _extends({},state,{isLoggedIn:action.value,strategy:null},action.value===false?{expires:null}:null);case SUCCESS_LOGOUT:return defaultState;default:return state;}}
16
+ */
17
+ export default function userLoginReducer(state = defaultState, action) {
18
+ switch (action.type) {
19
+ case APP_DID_START:
20
+ return {
21
+ ...state,
22
+ disabled: false
23
+ };
24
+ case DISABLE_LOGIN:
25
+ return {
26
+ ...state,
27
+ disabled: action.value
28
+ };
29
+ case REQUEST_LOGIN:
30
+ return {
31
+ ...state,
32
+ strategy: action.strategy,
33
+ isFetching: true
34
+ };
35
+ case SUCCESS_LOGIN:
36
+ return {
37
+ ...state,
38
+ isLoggedIn: true,
39
+ errors: null,
40
+ isFetching: false,
41
+ strategy: action.strategy,
42
+ ...(typeof action.sessionLifetimeInSeconds === 'number' ? {
43
+ expires: new Date().getTime() + action.sessionLifetimeInSeconds * 1000
44
+ } : {
45
+ expires: null
46
+ })
47
+ };
48
+ case ERROR_LOGIN:
49
+ return {
50
+ ...state,
51
+ errors: action.messages,
52
+ isLoggedIn: false,
53
+ isFetching: false
54
+ };
55
+ case TOGGLE_LOGGED_IN:
56
+ return {
57
+ ...state,
58
+ isLoggedIn: action.value,
59
+ strategy: null,
60
+ ...(action.value === false ? {
61
+ expires: null
62
+ } : null)
63
+ };
64
+ case SUCCESS_LOGOUT:
65
+ return defaultState;
66
+ default:
67
+ return state;
68
+ }
69
+ }
@@ -1,69 +1,186 @@
1
- import{createSelector}from'reselect';import MobileDetect from'mobile-detect';import{hasSGJavaScriptBridge}from'@shopgate/pwa-core/helpers';import{isVersionAtLeast}from'@shopgate/pwa-core/helpers/version';import{SCANNER_MIN_APP_LIB_VERSION}from'@shopgate/pwa-core/constants/Scanner';import{hasWebBridge}from'@shopgate/engage/core/helpers/bridge';import{getAreSimulatedInsetsInjected}from'@shopgate/engage/development/selectors';import{OS_ANDROID,OS_IOS,MODEL_NAMES_IPHONE_X,PAGE_INSETS_ANDROID,PAGE_INSETS_IOS,PAGE_INSETS_IPHONE_X,TYPE_TABLET}from"../constants/Device";var md=new MobileDetect(navigator.userAgent);/**
1
+ import { createSelector } from 'reselect';
2
+ import MobileDetect from 'mobile-detect';
3
+ import { hasSGJavaScriptBridge } from '@shopgate/pwa-core/helpers';
4
+ import { isVersionAtLeast } from '@shopgate/pwa-core/helpers/version';
5
+ import { SCANNER_MIN_APP_LIB_VERSION } from '@shopgate/pwa-core/constants/Scanner';
6
+ import { hasWebBridge } from '@shopgate/engage/core/helpers/bridge';
7
+ import { getAreSimulatedInsetsInjected } from '@shopgate/engage/development/selectors';
8
+ import { OS_ANDROID, OS_IOS, MODEL_NAMES_IPHONE_X, PAGE_INSETS_ANDROID, PAGE_INSETS_IOS, PAGE_INSETS_IPHONE_X, TYPE_TABLET } from "../constants/Device";
9
+ const md = new MobileDetect(navigator.userAgent);
10
+
11
+ /**
2
12
  * Returns the client state (state.client)
3
13
  * @param {Object} state The application state.
4
14
  * @returns {Object}
5
- */export var getClientState=function getClientState(state){return state.client;};/**
15
+ */
16
+ export const getClientState = state => state.client;
17
+
18
+ /**
6
19
  * Returns the client info state (state.client.info)
7
20
  * @param {Object} state The application state.
8
21
  * @returns {Object}
9
- */export var getClientInformation=createSelector(getClientState,function(state){return state.info;});/**
22
+ */
23
+ export const getClientInformation = createSelector(getClientState, state => state.info);
24
+
25
+ /**
10
26
  * Returns the client connectivity state (state.client.connectivity)
11
27
  * @param {Object} state The application state.
12
28
  * @returns {Object}
13
- */export var getClientConnectivity=createSelector(getClientState,function(state){return state.connectivity;});/**
29
+ */
30
+ export const getClientConnectivity = createSelector(getClientState, state => state.connectivity);
31
+
32
+ /**
14
33
  * Returns the device information.
15
34
  * @param {Object} state The application state.
16
35
  * @return {Object|null}
17
- */export var getDeviceInformation=createSelector(getClientInformation,function(clientInformation){var device=clientInformation.device;return device||null;});/**
36
+ */
37
+ export const getDeviceInformation = createSelector(getClientInformation, clientInformation => {
38
+ const {
39
+ device
40
+ } = clientInformation;
41
+ return device || null;
42
+ });
43
+
44
+ /**
18
45
  * Creates the `getSupportedIdentityServices()` selector.
19
46
  * @returns {Function}
20
- */export function makeGetSupportedIdentityServices(){return createSelector(getClientInformation,function(info){return info.supportedIdentityServices||[];});}/**
47
+ */
48
+ export function makeGetSupportedIdentityServices() {
49
+ return createSelector(getClientInformation, info => info.supportedIdentityServices || []);
50
+ }
51
+
52
+ /**
21
53
  * Creates the `supportsIdentityService()` selector.
22
54
  * @param {string} service The identity service to check.
23
55
  * @returns {Function}
24
- */export function makeSupportsIdentityService(service){var getSupportedIdentityServices=makeGetSupportedIdentityServices();return createSelector(getSupportedIdentityServices,function(services){return services.includes(service);});}/**
56
+ */
57
+ export function makeSupportsIdentityService(service) {
58
+ const getSupportedIdentityServices = makeGetSupportedIdentityServices();
59
+ return createSelector(getSupportedIdentityServices, services => services.includes(service));
60
+ }
61
+
62
+ /**
25
63
  * Returns the device platform.
26
64
  * @param {Object} state The application state.
27
65
  * @return {string|null}
28
- */export var getPlatform=createSelector(getDeviceInformation,function(deviceInformation){var _ref=deviceInformation||{},_ref$os=_ref.os,_ref$os2=_ref$os===void 0?{}:_ref$os,_ref$os2$platform=_ref$os2.platform,platform=_ref$os2$platform===void 0?null:_ref$os2$platform;return platform;});/**
66
+ */
67
+ export const getPlatform = createSelector(getDeviceInformation, deviceInformation => {
68
+ const {
69
+ os: {
70
+ platform = null
71
+ } = {}
72
+ } = deviceInformation || {};
73
+ return platform;
74
+ });
75
+
76
+ /**
29
77
  * Returns the os version.
30
78
  * @return {string|null}
31
- */export var getOSVersion=createSelector(getDeviceInformation,function(deviceInformation){var _ref2=deviceInformation||{},_ref2$os=_ref2.os,_ref2$os2=_ref2$os===void 0?{}:_ref2$os,_ref2$os2$ver=_ref2$os2.ver,ver=_ref2$os2$ver===void 0?null:_ref2$os2$ver;return ver;});/**
79
+ */
80
+ export const getOSVersion = createSelector(getDeviceInformation, deviceInformation => {
81
+ const {
82
+ os: {
83
+ ver = null
84
+ } = {}
85
+ } = deviceInformation || {};
86
+ return ver;
87
+ });
88
+
89
+ /**
32
90
  * Returns the device model.
33
91
  * @param {Object} state The application state.
34
92
  * @return {string|null}
35
- */export var getDeviceModel=createSelector(getDeviceInformation,function(deviceInformation){var _ref3=deviceInformation||{},_ref3$model=_ref3.model,model=_ref3$model===void 0?null:_ref3$model;return model;});/**
93
+ */
94
+ export const getDeviceModel = createSelector(getDeviceInformation, deviceInformation => {
95
+ const {
96
+ model = null
97
+ } = deviceInformation || {};
98
+ return model;
99
+ });
100
+
101
+ /**
36
102
  * Check if the platform is Android.
37
103
  * @param {Object} state The application state.
38
104
  * @return {boolean}
39
- */export var isAndroid=createSelector(getPlatform,function(platform){if(hasWebBridge()){return md.os()==='AndroidOS';}return platform===OS_ANDROID;});/**
105
+ */
106
+ export const isAndroid = createSelector(getPlatform, platform => {
107
+ if (hasWebBridge()) {
108
+ return md.os() === 'AndroidOS';
109
+ }
110
+ return platform === OS_ANDROID;
111
+ });
112
+
113
+ /**
40
114
  * Check if the platform is iOS.
41
115
  * @param {Object} state The application state.
42
116
  * @return {boolean}
43
- */export var isIos=createSelector(getPlatform,function(platform){return platform===OS_IOS;});/**
117
+ */
118
+ export const isIos = createSelector(getPlatform, platform => platform === OS_IOS);
119
+
120
+ /**
44
121
  * Checks if the currently stored lib version is one that supports the scanner.
45
122
  * @param {Object} state The application state.
46
123
  * @returns {boolean}
47
- */export var hasScannerSupport=createSelector(getClientInformation,getDeviceInformation,isIos,function(clientInformation,deviceInformation,deviceIsIos){var _ref4=deviceInformation||{},type=_ref4.type;var isIpad=type===TYPE_TABLET&&deviceIsIos;if(isVersionAtLeast('11.0.0',clientInformation.appVersion)){// scanner is supported on all apps based on the react-native based apps
48
- return true;}// scanner is not supported on iPads with the not react-native based app
49
- return isVersionAtLeast(SCANNER_MIN_APP_LIB_VERSION,clientInformation.libVersion)&&!isIpad;});/**
124
+ */
125
+ export const hasScannerSupport = createSelector(getClientInformation, getDeviceInformation, isIos, (clientInformation, deviceInformation, deviceIsIos) => {
126
+ const {
127
+ type
128
+ } = deviceInformation || {};
129
+ const isIpad = type === TYPE_TABLET && deviceIsIos;
130
+ if (isVersionAtLeast('11.0.0', clientInformation.appVersion)) {
131
+ // scanner is supported on all apps based on the react-native based apps
132
+ return true;
133
+ }
134
+
135
+ // scanner is not supported on iPads with the not react-native based app
136
+ return isVersionAtLeast(SCANNER_MIN_APP_LIB_VERSION, clientInformation.libVersion) && !isIpad;
137
+ });
138
+
139
+ /**
50
140
  * Determines page insets for the current device. Used as a fallback for the native insets.
51
141
  * @param {Object} state The application state.
52
142
  * @returns {Object}
53
- */export var getPageInsets=createSelector(getDeviceModel,isIos,getAreSimulatedInsetsInjected,function(model,iOS,injectSimulatedInsets){if(injectSimulatedInsets){// Simulate safe area insets in development when user agent is set to iOS device
54
- return PAGE_INSETS_IPHONE_X;}if(iOS){if(!hasSGJavaScriptBridge()){return PAGE_INSETS_ANDROID;}if(MODEL_NAMES_IPHONE_X.includes(model)){return PAGE_INSETS_IPHONE_X;}return PAGE_INSETS_IOS;}return PAGE_INSETS_ANDROID;});/**
143
+ */
144
+ export const getPageInsets = createSelector(getDeviceModel, isIos, getAreSimulatedInsetsInjected, (model, iOS, injectSimulatedInsets) => {
145
+ if (injectSimulatedInsets) {
146
+ // Simulate safe area insets in development when user agent is set to iOS device
147
+ return PAGE_INSETS_IPHONE_X;
148
+ }
149
+ if (iOS) {
150
+ if (!hasSGJavaScriptBridge()) {
151
+ return PAGE_INSETS_ANDROID;
152
+ }
153
+ if (MODEL_NAMES_IPHONE_X.includes(model)) {
154
+ return PAGE_INSETS_IPHONE_X;
155
+ }
156
+ return PAGE_INSETS_IOS;
157
+ }
158
+ return PAGE_INSETS_ANDROID;
159
+ });
160
+
161
+ /**
55
162
  * Determines what os version handles the insets differently compared to other os versions.
56
163
  * @returns {boolean}
57
- */export var considerNativeInset=createSelector(isIos,getOSVersion,function(ios,ver){return ios&&ver&&ver.indexOf('10.')===0;});/**
164
+ */
165
+ export const considerNativeInset = createSelector(isIos, getOSVersion, (ios, ver) => ios && ver && ver.indexOf('10.') === 0);
166
+
167
+ /**
58
168
  * Checks if the client is connected.
59
169
  * @param {Object} state The application state.
60
170
  * @returns {boolean}
61
- */export var getIsConnected=createSelector(getClientConnectivity,function(connectivity){return connectivity.connected;});/**
171
+ */
172
+ export const getIsConnected = createSelector(getClientConnectivity, connectivity => connectivity.connected);
173
+
174
+ /**
62
175
  * Determines the network type of the client connection e.g. LTE or UMTS.
63
176
  * @param {Object} state The application state.
64
177
  * @returns {string}
65
- */export var getClientConnectivityNetwork=createSelector(getClientConnectivity,function(connectivity){return connectivity.network;});/**
178
+ */
179
+ export const getClientConnectivityNetwork = createSelector(getClientConnectivity, connectivity => connectivity.network);
180
+
181
+ /**
66
182
  * Determines the type of the client connection e.g. WIFI or 4G.
67
183
  * @param {Object} state The application state.
68
184
  * @returns {string}
69
- */export var getClientConnectivityType=createSelector(getClientConnectivity,function(connectivity){return connectivity.type;});
185
+ */
186
+ export const getClientConnectivityType = createSelector(getClientConnectivity, connectivity => connectivity.type);
@@ -1,43 +1,81 @@
1
- import{createSelector}from'reselect';import{makeGetDefaultSortOrder}from'@shopgate/engage/filter/selectors';import{getCurrentPathname,getCurrentQuery,getRouterStack}from"./router";import{parseObjectToQueryString}from"../helpers/router";/**
1
+ import { createSelector } from 'reselect';
2
+ import { makeGetDefaultSortOrder } from '@shopgate/engage/filter/selectors';
3
+ import { getCurrentPathname, getCurrentQuery, getRouterStack } from "./router";
4
+ import { parseObjectToQueryString } from "../helpers/router";
5
+
6
+ /**
2
7
  * @deprecated
3
- */ /**
8
+ */
9
+
10
+ /**
4
11
  * Selects the history state.
5
12
  * @param {Object} state The global state.
6
13
  * @deprecated
7
14
  * @return {Object}
8
- */export var getHistoryState=function getHistoryState(state){return state.history;};/**
15
+ */
16
+ export const getHistoryState = state => state.history;
17
+
18
+ /**
9
19
  * Retrieves a single url parameter from the query parameters object.
10
20
  * @param {Object} state The global state.
11
21
  * @param {string} param The dedicated url parameter.
12
22
  * @return {*} The URL parameter value.
13
- */export var getQueryParam=createSelector(getCurrentQuery,function(state,props,param){return param;},function(params,param){if(!params||!params[param]){return null;}return params[param];});var getDefaultSortOrder=makeGetDefaultSortOrder();/**
23
+ */
24
+ export const getQueryParam = createSelector(getCurrentQuery, (state, props, param) => param, (params, param) => {
25
+ if (!params || !params[param]) {
26
+ return null;
27
+ }
28
+ return params[param];
29
+ });
30
+ const getDefaultSortOrder = makeGetDefaultSortOrder();
31
+
32
+ /**
14
33
  * Retrieves the sort order from the URL query parameters.
15
34
  * @param {Object} state The global state.
16
35
  * @returns {string} The current sort order.
17
- */export var getSortOrder=createSelector(function(state,props){return getQueryParam(state,props,'sort');},getDefaultSortOrder,function(sortParam,defaultSort){return sortParam||defaultSort;});/**
36
+ */
37
+ export const getSortOrder = createSelector((state, props) => getQueryParam(state, props, 'sort'), getDefaultSortOrder, (sortParam, defaultSort) => sortParam || defaultSort);
38
+
39
+ /**
18
40
  * Retrieves the search phrase from the URL query parameters.
19
41
  * @param {Object} state The global state.
20
42
  * @returns {string|null} The current search phrase.
21
- */export var getSearchPhrase=createSelector(function(state,props){return getQueryParam(state,props,'s');},function(param){return param?param.trim():null;});/**
43
+ */
44
+ export const getSearchPhrase = createSelector((state, props) => getQueryParam(state, props, 's'), param => param ? param.trim() : null);
45
+
46
+ /**
22
47
  * Gets the current history pathname.
23
48
  * @deprecated
24
49
  * @param {Object} state The current application state.
25
50
  * @returns {string}
26
- */export var getHistoryPathname=getCurrentPathname;/**
51
+ */
52
+ export const getHistoryPathname = getCurrentPathname;
53
+
54
+ /**
27
55
  * Gets the length of the current history stack.
28
56
  * @param {Object} state The current application state.
29
57
  * @return {number}
30
- */export var getHistoryLength=createSelector(getRouterStack,function(stack){return stack.length;});/**
58
+ */
59
+ export const getHistoryLength = createSelector(getRouterStack, stack => stack.length);
60
+
61
+ /**
31
62
  * Gets the current query params from history state as a preformatted string.
32
63
  * @param {Object} state The global state.
33
64
  * @return {string}
34
- */export var getQueryParamsAsString=createSelector(getCurrentQuery,function(queryParams){return parseObjectToQueryString(queryParams);});/**
65
+ */
66
+ export const getQueryParamsAsString = createSelector(getCurrentQuery, queryParams => parseObjectToQueryString(queryParams));
67
+
68
+ /**
35
69
  * Gets the current history location from the history state.
36
70
  * @param {Object} state The current application state.
37
71
  * @return {string|null}
38
- */export var getHistoryLocation=createSelector(getHistoryPathname,getQueryParamsAsString,function(pathname,params){return"".concat(pathname).concat(params);});/**
72
+ */
73
+ export const getHistoryLocation = createSelector(getHistoryPathname, getQueryParamsAsString, (pathname, params) => `${pathname}${params}`);
74
+
75
+ /**
39
76
  * Gets the current redirectLocation from the history state.
40
77
  * @param {Object} state The current application state.
41
78
  * @deprecated
42
79
  * @return {string|null}
43
- */export var getRedirectLocation=createSelector(getHistoryState,function(historyState){return historyState.redirectLocation||null;});
80
+ */
81
+ export const getRedirectLocation = createSelector(getHistoryState, historyState => historyState.redirectLocation || null);