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

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 +214 -7
  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 +21 -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 +228 -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 -4
  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,5 +1,14 @@
1
- import{openUniversalLink}from"../../action-creators/app";import handleLink from"./handleLink";/**
1
+ import { openUniversalLink } from "../../action-creators/app";
2
+ import handleLink from "./handleLink";
3
+
4
+ /**
2
5
  * Opens an universal link.
3
6
  * @param {Object} [payload={}] The universal link event payload.
4
7
  * @return {Function} A redux thunk.
5
- */export default function handleUniversalLink(payload){return function(dispatch){dispatch(openUniversalLink(payload));dispatch(handleLink(payload));};}
8
+ */
9
+ export default function handleUniversalLink(payload) {
10
+ return dispatch => {
11
+ dispatch(openUniversalLink(payload));
12
+ dispatch(handleLink(payload));
13
+ };
14
+ }
@@ -1,5 +1,26 @@
1
- import{event,registerEvents}from'@shopgate/pwa-core';import{willRegisterLinkEvents,didRegisterLinkEvents}from"../../action-creators/app";import handlePushNotification from"./handlePushNotification";import handleDeepLink from"./handleDeepLink";import handleUniversalLink from"./handleUniversalLink";/**
1
+ import { event, registerEvents } from '@shopgate/pwa-core';
2
+ import { willRegisterLinkEvents, didRegisterLinkEvents } from "../../action-creators/app";
3
+ import handlePushNotification from "./handlePushNotification";
4
+ import handleDeepLink from "./handleDeepLink";
5
+ import handleUniversalLink from "./handleUniversalLink";
6
+
7
+ /**
2
8
  * Registers all link events.
3
9
  * @return {Function} A redux thunk.
4
- */export default function registerLinkEvents(){return function(dispatch){dispatch(willRegisterLinkEvents());registerEvents(['openPushNotification','openDeepLink','openUniversalLink']);event.addCallback('openPushNotification',function(payload){return dispatch(handlePushNotification(payload));});event.addCallback('openDeepLink',function(payload){// Payment links are handled using the new app event system.
5
- if((payload===null||payload===void 0?void 0:payload.link.indexOf('//payment'))!==-1){return;}dispatch(handleDeepLink(payload));});event.addCallback('openUniversalLink',function(payload){return dispatch(handleUniversalLink(payload));});dispatch(didRegisterLinkEvents());};}
10
+ */
11
+ export default function registerLinkEvents() {
12
+ return dispatch => {
13
+ dispatch(willRegisterLinkEvents());
14
+ registerEvents(['openPushNotification', 'openDeepLink', 'openUniversalLink']);
15
+ event.addCallback('openPushNotification', payload => dispatch(handlePushNotification(payload)));
16
+ event.addCallback('openDeepLink', payload => {
17
+ // Payment links are handled using the new app event system.
18
+ if (payload?.link.indexOf('//payment') !== -1) {
19
+ return;
20
+ }
21
+ dispatch(handleDeepLink(payload));
22
+ });
23
+ event.addCallback('openUniversalLink', payload => dispatch(handleUniversalLink(payload)));
24
+ dispatch(didRegisterLinkEvents());
25
+ };
26
+ }
@@ -1,4 +1,28 @@
1
- import{mutable}from'@shopgate/engage/core/helpers';import{hasSGJavaScriptBridge,defaultClientInformation,getWebStorageEntry}from'@shopgate/pwa-core';import{requestClientInformation,receiveClientInformation,errorClientInformation}from"../../action-creators/client";/**
1
+ import { mutable } from '@shopgate/engage/core/helpers';
2
+ import { hasSGJavaScriptBridge, defaultClientInformation, getWebStorageEntry } from '@shopgate/pwa-core';
3
+ import { requestClientInformation, receiveClientInformation, errorClientInformation } from "../../action-creators/client";
4
+
5
+ /**
2
6
  * Requests the client information from the web storage.
3
7
  * @return {Function} A redux thunk.
4
- */function fetchClientInformation(){return function(dispatch){dispatch(requestClientInformation());if(!hasSGJavaScriptBridge()){dispatch(receiveClientInformation(defaultClientInformation));return Promise.resolve({aga:0,value:defaultClientInformation});}var request=getWebStorageEntry({name:'clientInformation'});request.then(function(response){return dispatch(receiveClientInformation(response.value));})["catch"](function(){dispatch(errorClientInformation());});return request;};}export default mutable(fetchClientInformation);
8
+ */
9
+ function fetchClientInformation() {
10
+ return dispatch => {
11
+ dispatch(requestClientInformation());
12
+ if (!hasSGJavaScriptBridge()) {
13
+ dispatch(receiveClientInformation(defaultClientInformation));
14
+ return Promise.resolve({
15
+ aga: 0,
16
+ value: defaultClientInformation
17
+ });
18
+ }
19
+ const request = getWebStorageEntry({
20
+ name: 'clientInformation'
21
+ });
22
+ request.then(response => dispatch(receiveClientInformation(response.value))).catch(() => {
23
+ dispatch(errorClientInformation());
24
+ });
25
+ return request;
26
+ };
27
+ }
28
+ export default mutable(fetchClientInformation);
@@ -1,5 +1,26 @@
1
- import{PipelineRequest}from'@shopgate/pwa-core';import{SHOPGATE_CMS_GET_MENU}from"../../constants/Pipelines";import{requestMenu,receiveMenu,errorMenu}from"../../action-creators/menu";/**
1
+ import { PipelineRequest } from '@shopgate/pwa-core';
2
+ import { SHOPGATE_CMS_GET_MENU } from "../../constants/Pipelines";
3
+ import { requestMenu, receiveMenu, errorMenu } from "../../action-creators/menu";
4
+
5
+ /**
2
6
  * Get the custom service menu entries.
3
7
  * @param {string} id The menu id.
4
8
  * @return {Function} A redux thunk.
5
- */function fetchMenu(id){return function(dispatch){dispatch(requestMenu(id));var request=new PipelineRequest(SHOPGATE_CMS_GET_MENU).setInput({id:id}).dispatch();request.then(function(_ref){var entries=_ref.entries;dispatch(receiveMenu(id,entries));})["catch"](function(){dispatch(errorMenu(id));});return request;};}export default fetchMenu;
9
+ */
10
+ function fetchMenu(id) {
11
+ return dispatch => {
12
+ dispatch(requestMenu(id));
13
+ const request = new PipelineRequest(SHOPGATE_CMS_GET_MENU).setInput({
14
+ id
15
+ }).dispatch();
16
+ request.then(({
17
+ entries
18
+ }) => {
19
+ dispatch(receiveMenu(id, entries));
20
+ }).catch(() => {
21
+ dispatch(errorMenu(id));
22
+ });
23
+ return request;
24
+ };
25
+ }
26
+ export default fetchMenu;
@@ -1,6 +1,22 @@
1
- import{mutable}from"../../helpers/redux";import{removeModal}from"../../action-creators/modal";import promiseMap from"./promiseMap";/**
1
+ import { mutable } from "../../helpers/redux";
2
+ import { removeModal } from "../../action-creators/modal";
3
+ import promiseMap from "./promiseMap";
4
+
5
+ /**
2
6
  * Closes an open modal and resolves the mapped promise.
3
7
  * @param {number} id A modal id.
4
8
  * @param {boolean} confirmed A flag whether the modal was confirmed or not.
5
9
  * @returns {Function} A redux thunk.
6
- */function closeModal(id){var confirmed=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return function(dispatch){var promise=promiseMap.get(id);if(promise){promise.resolve(confirmed);}dispatch(removeModal(id));};}/** @mixes {MutableFunction} */export default mutable(closeModal);
10
+ */
11
+ function closeModal(id, confirmed = false) {
12
+ return dispatch => {
13
+ const promise = promiseMap.get(id);
14
+ if (promise) {
15
+ promise.resolve(confirmed);
16
+ }
17
+ dispatch(removeModal(id));
18
+ };
19
+ }
20
+
21
+ /** @mixes {MutableFunction} */
22
+ export default mutable(closeModal);
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * A map that keeps track of the created modal promises.
3
3
  * @type {Map}
4
- */var promiseMap=new Map();export default promiseMap;
4
+ */
5
+ const promiseMap = new Map();
6
+ export default promiseMap;
@@ -1,21 +1,67 @@
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 CryptoJs from'crypto-js';import{logger}from'@shopgate/pwa-core';import{createModal}from"../../action-creators/modal";import{mutable}from"../../helpers/redux";import{getModalById}from"../../selectors/modal";import promiseMap from"./promiseMap";/**
1
+ import CryptoJs from 'crypto-js';
2
+ import { logger } from '@shopgate/pwa-core';
3
+ import { createModal } from "../../action-creators/modal";
4
+ import { mutable } from "../../helpers/redux";
5
+ import { getModalById } from "../../selectors/modal";
6
+ import promiseMap from "./promiseMap";
7
+
8
+ /**
2
9
  * Creates a runtime unique modal id.
3
10
  * @param {Object} options The modal options.
4
11
  * @returns {number}
5
- */export var getModalId=function getModalId(options){return CryptoJs.MD5(JSON.stringify(options)).toString();};/**
12
+ */
13
+ export const getModalId = options => CryptoJs.MD5(JSON.stringify(options)).toString();
14
+
15
+ /**
6
16
  * The modal defaults.
7
17
  * @type {Object}
8
- */var defaultModalOptions={id:null,type:null,// In this case the template should display a fallback dialog type.
9
- title:'',confirm:'modal.confirm',dismiss:'modal.dismiss',params:{}// Any parameters for special modal types go here.
10
- };/**
18
+ */
19
+ const defaultModalOptions = {
20
+ id: null,
21
+ type: null,
22
+ // In this case the template should display a fallback dialog type.
23
+ title: '',
24
+ confirm: 'modal.confirm',
25
+ dismiss: 'modal.dismiss',
26
+ params: {} // Any parameters for special modal types go here.
27
+ };
28
+
29
+ /**
11
30
  * Dispatches the createModal action creator and returns
12
31
  * a promise that will be resolved when the modal closes.
13
32
  * @param {Object} options The modal options.
14
33
  * @return {Function} A Redux thunk.
15
- */function showModal(options){return function(dispatch,getState){var id=getModalId(options);// Check if there is already a modal with the same id on the modal stack.
16
- var modal=getModalById(getState(),id);if(modal){/**
34
+ */
35
+ function showModal(options) {
36
+ return (dispatch, getState) => {
37
+ const id = getModalId(options);
38
+
39
+ // Check if there is already a modal with the same id on the modal stack.
40
+ const modal = getModalById(getState(), id);
41
+ if (modal) {
42
+ /**
17
43
  * To prevent bugging the user with duplicate modal, those are not added to the modal stack.
18
44
  * Usually the promise which is returned by showModal resolves with a boolean value
19
45
  * when the user interacts with its buttons. Since promise handling is optional for the
20
46
  * action, the promise can't be rejected, but resolves with null.
21
- */logger.warn('Modal creation aborted since an identical one was already added to the modal stack',options);return Promise.resolve(null);}var enrichedOptions=_extends({},defaultModalOptions,{},options,{id:id});dispatch(createModal(enrichedOptions));return new Promise(function(resolve,reject){promiseMap.set(id,{resolve:resolve,reject:reject});});};}/** @mixes {MutableFunction} */export default mutable(showModal);
47
+ */
48
+ logger.warn('Modal creation aborted since an identical one was already added to the modal stack', options);
49
+ return Promise.resolve(null);
50
+ }
51
+ const enrichedOptions = {
52
+ ...defaultModalOptions,
53
+ ...options,
54
+ id
55
+ };
56
+ dispatch(createModal(enrichedOptions));
57
+ return new Promise((resolve, reject) => {
58
+ promiseMap.set(id, {
59
+ resolve,
60
+ reject
61
+ });
62
+ });
63
+ };
64
+ }
65
+
66
+ /** @mixes {MutableFunction} */
67
+ export default mutable(showModal);
@@ -1,5 +1,72 @@
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{PipelineRequest}from'@shopgate/pwa-core';import{getDeviceTypeForCms}from'@shopgate/engage/core';import{makeGetPage,getIsCms2Enabled}from'@shopgate/engage/page/selectors';import{requestPageConfigV2,receivePageConfigV2,errorPageConfigV2}from'@shopgate/engage/page/action-creators';import{hasNewServices}from'@shopgate/engage/core/helpers';import{ERROR_HANDLE_SUPPRESS,ERROR_HANDLE_DEFAULT}from'@shopgate/engage/core/constants';import{SHOPGATE_CMS_GET_PAGE_CONFIG}from"../../constants/Pipelines";import{requestPageConfig,receivePageConfig,errorPageConfig}from"../../action-creators/page";import{shouldFetchData,mutable}from"../../helpers/redux";import{getPageConfigById}from"../../selectors/page";/**
1
+ import { PipelineRequest } from '@shopgate/pwa-core';
2
+ import { getDeviceTypeForCms } from '@shopgate/engage/core';
3
+ import { makeGetPage, getIsCms2Enabled } from '@shopgate/engage/page/selectors';
4
+ import { requestPageConfigV2, receivePageConfigV2, errorPageConfigV2 } from '@shopgate/engage/page/action-creators';
5
+ import { hasNewServices } from '@shopgate/engage/core/helpers';
6
+ import { ERROR_HANDLE_SUPPRESS, ERROR_HANDLE_DEFAULT } from '@shopgate/engage/core/constants';
7
+ import { SHOPGATE_CMS_GET_PAGE_CONFIG } from "../../constants/Pipelines";
8
+ import { requestPageConfig, receivePageConfig, errorPageConfig } from "../../action-creators/page";
9
+ import { shouldFetchData, mutable } from "../../helpers/redux";
10
+ import { getPageConfigById } from "../../selectors/page";
11
+
12
+ /**
2
13
  * Retrieves the config for a page.
3
14
  * @param {string} pageId The ID of the page to request.
4
15
  * @return {Function} The dispatched action.
5
- */function fetchPageConfig(pageId){return function(dispatch,getState){var state=getState();var cmsV2Enabled=getIsCms2Enabled(state);var pageConfig;if(cmsV2Enabled){pageConfig=makeGetPage({slug:pageId})(state);}else{pageConfig=getPageConfigById(state,{pageId:pageId});}if(!shouldFetchData(pageConfig)){return Promise.resolve(null);}var deviceTypeOfCmsPage=getDeviceTypeForCms();if(cmsV2Enabled){dispatch(requestPageConfigV2({slug:pageId}));}else{dispatch(requestPageConfig(pageId));}var request=new PipelineRequest(SHOPGATE_CMS_GET_PAGE_CONFIG).setVersion(cmsV2Enabled?2:1).setHandleErrors(cmsV2Enabled?ERROR_HANDLE_SUPPRESS:ERROR_HANDLE_DEFAULT).setInput(_extends({pageId:pageId},hasNewServices()&&!cmsV2Enabled?{deviceType:deviceTypeOfCmsPage}:null)).dispatch();request.then(function(result){if(cmsV2Enabled){dispatch(receivePageConfigV2({slug:pageId,data:result.page}));}else{dispatch(receivePageConfig(pageId,result));}})["catch"](function(error){if(cmsV2Enabled){dispatch(errorPageConfigV2({slug:pageId,code:error.code}));}else{dispatch(errorPageConfig(pageId,error.code));}});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchPageConfig);
16
+ */
17
+ function fetchPageConfig(pageId) {
18
+ return (dispatch, getState) => {
19
+ const state = getState();
20
+ const cmsV2Enabled = getIsCms2Enabled(state);
21
+ let pageConfig;
22
+ if (cmsV2Enabled) {
23
+ pageConfig = makeGetPage({
24
+ slug: pageId
25
+ })(state);
26
+ } else {
27
+ pageConfig = getPageConfigById(state, {
28
+ pageId
29
+ });
30
+ }
31
+ if (!shouldFetchData(pageConfig)) {
32
+ return Promise.resolve(null);
33
+ }
34
+ const deviceTypeOfCmsPage = getDeviceTypeForCms();
35
+ if (cmsV2Enabled) {
36
+ dispatch(requestPageConfigV2({
37
+ slug: pageId
38
+ }));
39
+ } else {
40
+ dispatch(requestPageConfig(pageId));
41
+ }
42
+ const request = new PipelineRequest(SHOPGATE_CMS_GET_PAGE_CONFIG).setVersion(cmsV2Enabled ? 2 : 1).setHandleErrors(cmsV2Enabled ? ERROR_HANDLE_SUPPRESS : ERROR_HANDLE_DEFAULT).setInput({
43
+ pageId,
44
+ ...(hasNewServices() && !cmsV2Enabled ? {
45
+ deviceType: deviceTypeOfCmsPage
46
+ } : null)
47
+ }).dispatch();
48
+ request.then(result => {
49
+ if (cmsV2Enabled) {
50
+ dispatch(receivePageConfigV2({
51
+ slug: pageId,
52
+ data: result.page
53
+ }));
54
+ } else {
55
+ dispatch(receivePageConfig(pageId, result));
56
+ }
57
+ }).catch(error => {
58
+ if (cmsV2Enabled) {
59
+ dispatch(errorPageConfigV2({
60
+ slug: pageId,
61
+ code: error.code
62
+ }));
63
+ } else {
64
+ dispatch(errorPageConfig(pageId, error.code));
65
+ }
66
+ });
67
+ return request;
68
+ };
69
+ }
70
+
71
+ /** @mixes {MutableFunction} */
72
+ export default mutable(fetchPageConfig);
@@ -1,7 +1,11 @@
1
- import fetchPageConfig from"./fetchPageConfig";/**
1
+ import fetchPageConfig from "./fetchPageConfig";
2
+
3
+ /**
2
4
  * Retrieves the config for a page.
3
5
  * @param {string} pageId The ID of the page to request.
4
6
  * @param {boolean} [force=true] When true, the request will go out without being checked.
5
7
  * @return {Function} The dispatched action.
6
8
  * @deprecated
7
- */var getPageConfig=fetchPageConfig;export default getPageConfig;
9
+ */
10
+ const getPageConfig = fetchPageConfig;
11
+ export default getPageConfig;
@@ -1 +1 @@
1
- export{default as fetchPageConfig}from"./fetchPageConfig";
1
+ export { default as fetchPageConfig } from "./fetchPageConfig";
@@ -1,5 +1,15 @@
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{ACTION_POP}from'@virtuous/conductor';import{navigate}from"../../action-creators/router";import{mutable}from"../../helpers/redux";/**
1
+ import { ACTION_POP } from '@virtuous/conductor';
2
+ import { navigate } from "../../action-creators/router";
3
+ import { mutable } from "../../helpers/redux";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @param {Object} [params={}] The history params.
4
8
  * @return {Function} The dispatched action.
5
- */export var historyPop=mutable(function(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){dispatch(navigate(_extends({},params,{action:ACTION_POP})));};});
9
+ */
10
+ export const historyPop = mutable((params = {}) => dispatch => {
11
+ dispatch(navigate({
12
+ ...params,
13
+ action: ACTION_POP
14
+ }));
15
+ });
@@ -1,5 +1,30 @@
1
- import{historyPop}from"./historyPop";import{mutable}from"../../helpers/redux";import{getRouterStackIndex,makeGetPrevRouteIndexByPattern}from"../../selectors/router";/**
1
+ import { historyPop } from "./historyPop";
2
+ import { mutable } from "../../helpers/redux";
3
+ import { getRouterStackIndex, makeGetPrevRouteIndexByPattern } from "../../selectors/router";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @param {Object} [params={}] The history params.
4
8
  * @return {Function} The dispatched action.
5
- */export var historyPopToRoute=mutable(function(_ref){var pattern=_ref.pattern,routeId=_ref.routeId;return function(dispatch,getState){var state=getState();var getPrevRouteIndexByPatternCart=makeGetPrevRouteIndexByPattern(pattern);var nextRouteIndex=getPrevRouteIndexByPatternCart(state,{routeId:routeId});var currentRouteIndex=getRouterStackIndex(state,{routeId:routeId});if(currentRouteIndex===null||nextRouteIndex===null||nextRouteIndex===-1){dispatch(historyPop());}else{var steps=currentRouteIndex-nextRouteIndex;dispatch(historyPop({steps:steps}));}};});
9
+ */
10
+ export const historyPopToRoute = mutable(({
11
+ pattern,
12
+ routeId
13
+ }) => (dispatch, getState) => {
14
+ const state = getState();
15
+ const getPrevRouteIndexByPatternCart = makeGetPrevRouteIndexByPattern(pattern);
16
+ const nextRouteIndex = getPrevRouteIndexByPatternCart(state, {
17
+ routeId
18
+ });
19
+ const currentRouteIndex = getRouterStackIndex(state, {
20
+ routeId
21
+ });
22
+ if (currentRouteIndex === null || nextRouteIndex === null || nextRouteIndex === -1) {
23
+ dispatch(historyPop());
24
+ } else {
25
+ const steps = currentRouteIndex - nextRouteIndex;
26
+ dispatch(historyPop({
27
+ steps
28
+ }));
29
+ }
30
+ });
@@ -1,5 +1,15 @@
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{ACTION_PUSH}from'@virtuous/conductor';import{navigate}from"../../action-creators/router";import{mutable}from"../../helpers/redux";/**
1
+ import { ACTION_PUSH } from '@virtuous/conductor';
2
+ import { navigate } from "../../action-creators/router";
3
+ import { mutable } from "../../helpers/redux";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @param {Object} params The history params.
4
8
  * @return {Function} The dispatched action.
5
- */export var historyPush=mutable(function(params){return function(dispatch){dispatch(navigate(_extends({},params,{action:ACTION_PUSH})));};});
9
+ */
10
+ export const historyPush = mutable(params => dispatch => {
11
+ dispatch(navigate({
12
+ ...params,
13
+ action: ACTION_PUSH
14
+ }));
15
+ });
@@ -1,6 +1,25 @@
1
- import{historyPop}from"./historyPop";import{historyReplace}from"./historyReplace";/**
1
+ import { historyPop } from "./historyPop";
2
+ import { historyReplace } from "./historyReplace";
3
+
4
+ /**
2
5
  * Performs a redirect. When the action params contain a location, the current history entry
3
6
  * will be replaced with it. Otherwise the current history entry will be popped.
4
7
  * @param {Object} params The redirect params.
5
8
  * @return {Function} A redux thunk.
6
- */export function historyRedirect(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(dispatch){var location=params.location,state=params.state;if(!location){dispatch(historyPop());return;}dispatch(historyReplace({pathname:location,state:state}));};}
9
+ */
10
+ export function historyRedirect(params = {}) {
11
+ return dispatch => {
12
+ const {
13
+ location,
14
+ state
15
+ } = params;
16
+ if (!location) {
17
+ dispatch(historyPop());
18
+ return;
19
+ }
20
+ dispatch(historyReplace({
21
+ pathname: location,
22
+ state
23
+ }));
24
+ };
25
+ }
@@ -1,15 +1,32 @@
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{ACTION_REPLACE}from'@virtuous/conductor';import{navigate}from"../../action-creators/router";import{mutable}from"../../helpers/redux";/**
1
+ import { ACTION_REPLACE } from '@virtuous/conductor';
2
+ import { navigate } from "../../action-creators/router";
3
+ import { mutable } from "../../helpers/redux";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @param {Object} params The history params.
4
8
  * @param {Object} [options={}] Additional options for the action
5
9
  * @param {boolean} [options.remountRoute=true] When set to "true", the target route will be forced
6
10
  * to remount.
7
11
  * @return {Function} The dispatched action.
8
- */export var historyReplace=mutable(function(params){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function(dispatch){dispatch(navigate(_extends({},params,{},(options===null||options===void 0?void 0:options.remountRoute)!==false&&{state:_extends({},params.state,{/**
12
+ */
13
+ export const historyReplace = mutable((params, options = {}) => dispatch => {
14
+ dispatch(navigate({
15
+ ...params,
16
+ ...(options?.remountRoute !== false && {
17
+ state: {
18
+ ...params.state,
19
+ /**
9
20
  * When a route is "replaced" the router doesn't assign a new route id to the old route
10
21
  * stack entry. This can cause issues when a route is replaced by itself, since the content
11
22
  * will not remount out of the box.
12
23
  *
13
24
  * When the "replaceRouteId" state prop is injected, the Route component performs logic
14
25
  * to enforce re-remounting routes which where replaced by itself.
15
- */replaceRouteId:Math.random().toString(36).substring(2,7)})},{action:ACTION_REPLACE})));};});
26
+ */
27
+ replaceRouteId: Math.random().toString(36).substring(2, 7)
28
+ }
29
+ }),
30
+ action: ACTION_REPLACE
31
+ }));
32
+ });
@@ -1,4 +1,13 @@
1
- import{ACTION_RESET}from'@virtuous/conductor';import{navigate}from"../../action-creators/router";import{mutable}from"../../helpers/redux";/**
1
+ import { ACTION_RESET } from '@virtuous/conductor';
2
+ import { navigate } from "../../action-creators/router";
3
+ import { mutable } from "../../helpers/redux";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @return {Function} The dispatched action.
4
- */export var historyReset=mutable(function(){return function(dispatch){dispatch(navigate({action:ACTION_RESET}));};});
8
+ */
9
+ export const historyReset = mutable(() => dispatch => {
10
+ dispatch(navigate({
11
+ action: ACTION_RESET
12
+ }));
13
+ });
@@ -1,5 +1,15 @@
1
- import{HISTORY_RESET_TO}from"../../constants/ActionTypes";import{navigate}from"../../action-creators/router";import{mutable}from"../../helpers/redux";/**
1
+ import { HISTORY_RESET_TO } from "../../constants/ActionTypes";
2
+ import { navigate } from "../../action-creators/router";
3
+ import { mutable } from "../../helpers/redux";
4
+
5
+ /**
2
6
  * @mixes {MutableFunction}
3
7
  * @param {Object} pathname The pathname to reset to
4
8
  * @return {Function} The dispatched action.
5
- */export var historyResetTo=mutable(function(pathname){return function(dispatch){dispatch(navigate({pathname:pathname,action:HISTORY_RESET_TO}));};});
9
+ */
10
+ export const historyResetTo = mutable(pathname => dispatch => {
11
+ dispatch(navigate({
12
+ pathname,
13
+ action: HISTORY_RESET_TO
14
+ }));
15
+ });
@@ -1 +1,17 @@
1
- export*from"./historyPush";export*from"./historyPop";export*from"./historyPopToRoute";export*from"./historyReplace";export*from"./historyReset";export*from"./historyResetTo";export*from"./historyRedirect";export*from"./routeDidPop";export*from"./routeDidPush";export*from"./routeDidReplace";export*from"./routeDidReset";export*from"./routeDidUpdate";export*from"./routeWillPop";export*from"./routeWillPush";export*from"./routeWillReplace";export*from"./routeWillReset";export*from"./windowOpenOverride";
1
+ export * from "./historyPush";
2
+ export * from "./historyPop";
3
+ export * from "./historyPopToRoute";
4
+ export * from "./historyReplace";
5
+ export * from "./historyReset";
6
+ export * from "./historyResetTo";
7
+ export * from "./historyRedirect";
8
+ export * from "./routeDidPop";
9
+ export * from "./routeDidPush";
10
+ export * from "./routeDidReplace";
11
+ export * from "./routeDidReset";
12
+ export * from "./routeDidUpdate";
13
+ export * from "./routeWillPop";
14
+ export * from "./routeWillPush";
15
+ export * from "./routeWillReplace";
16
+ export * from "./routeWillReset";
17
+ export * from "./windowOpenOverride";
@@ -1,5 +1,14 @@
1
- import{ACTION_POP}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_POP } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeDidPop(prev,next){return function(dispatch){dispatch(actions.routeDidLeave(prev,ACTION_POP));dispatch(actions.routeDidEnter(next,ACTION_POP));};}
8
+ */
9
+ export function routeDidPop(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeDidLeave(prev, ACTION_POP));
12
+ dispatch(actions.routeDidEnter(next, ACTION_POP));
13
+ };
14
+ }
@@ -1,5 +1,16 @@
1
- import{ACTION_PUSH}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_PUSH } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeDidPush(prev,next){return function(dispatch){if(prev){dispatch(actions.routeDidLeave(prev,ACTION_PUSH));}dispatch(actions.routeDidEnter(next,ACTION_PUSH));};}
8
+ */
9
+ export function routeDidPush(prev, next) {
10
+ return dispatch => {
11
+ if (prev) {
12
+ dispatch(actions.routeDidLeave(prev, ACTION_PUSH));
13
+ }
14
+ dispatch(actions.routeDidEnter(next, ACTION_PUSH));
15
+ };
16
+ }
@@ -1,5 +1,14 @@
1
- import{ACTION_REPLACE}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_REPLACE } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeDidReplace(prev,next){return function(dispatch){dispatch(actions.routeDidLeave(prev,ACTION_REPLACE));dispatch(actions.routeDidEnter(next,ACTION_REPLACE));};}
8
+ */
9
+ export function routeDidReplace(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeDidLeave(prev, ACTION_REPLACE));
12
+ dispatch(actions.routeDidEnter(next, ACTION_REPLACE));
13
+ };
14
+ }
@@ -1,5 +1,14 @@
1
- import{ACTION_RESET}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_RESET } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeDidReset(prev,next){return function(dispatch){dispatch(actions.routeDidLeave(prev,ACTION_RESET));dispatch(actions.routeDidEnter(next,ACTION_RESET));};}
8
+ */
9
+ export function routeDidReset(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeDidLeave(prev, ACTION_RESET));
12
+ dispatch(actions.routeDidEnter(next, ACTION_RESET));
13
+ };
14
+ }
@@ -1,4 +1,12 @@
1
- import{ACTION_UPDATE}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_UPDATE } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} route The updated route.
3
6
  * @returns {Function}
4
- */export function routeDidUpdate(route){return function(dispatch){dispatch(actions.routeDidUpdate(route,ACTION_UPDATE));};}
7
+ */
8
+ export function routeDidUpdate(route) {
9
+ return dispatch => {
10
+ dispatch(actions.routeDidUpdate(route, ACTION_UPDATE));
11
+ };
12
+ }
@@ -1,5 +1,14 @@
1
- import{ACTION_POP}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_POP } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeWillPop(prev,next){return function(dispatch){dispatch(actions.routeWillLeave(prev,ACTION_POP));dispatch(actions.routeWillEnter(next,ACTION_POP));};}
8
+ */
9
+ export function routeWillPop(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeWillLeave(prev, ACTION_POP));
12
+ dispatch(actions.routeWillEnter(next, ACTION_POP));
13
+ };
14
+ }
@@ -1,5 +1,16 @@
1
- import{ACTION_PUSH}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_PUSH } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeWillPush(prev,next){return function(dispatch){if(prev){dispatch(actions.routeWillLeave(prev,ACTION_PUSH));}dispatch(actions.routeWillEnter(next,ACTION_PUSH));};}
8
+ */
9
+ export function routeWillPush(prev, next) {
10
+ return dispatch => {
11
+ if (prev) {
12
+ dispatch(actions.routeWillLeave(prev, ACTION_PUSH));
13
+ }
14
+ dispatch(actions.routeWillEnter(next, ACTION_PUSH));
15
+ };
16
+ }