@zengenti/contensis-react-base 2.4.1-beta.9 → 2.5.0

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 (190) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +77 -0
  3. package/cjs/{App-f3164dab.js → App-79703372.js} +236 -22
  4. package/cjs/App-79703372.js.map +1 -0
  5. package/cjs/{RouteLoader-5c44f039.js → RouteLoader-f67bbf9e.js} +8 -39
  6. package/cjs/RouteLoader-f67bbf9e.js.map +1 -0
  7. package/cjs/{ToJs-ca9bea03.js → ToJs-d72e5b10.js} +58 -2
  8. package/cjs/ToJs-d72e5b10.js.map +1 -0
  9. package/cjs/{actions-e22726ed.js → actions-e9f69947.js} +1 -1
  10. package/cjs/actions-e9f69947.js.map +1 -0
  11. package/cjs/client.js +121 -16
  12. package/cjs/client.js.map +1 -1
  13. package/cjs/contensis-react-base.js +41 -52
  14. package/cjs/contensis-react-base.js.map +1 -1
  15. package/cjs/forms.js +1 -1
  16. package/cjs/{login-6c0ef139.js → login-4f274c6a.js} +8 -5
  17. package/cjs/login-4f274c6a.js.map +1 -0
  18. package/cjs/reducers-cb531715.js +207 -0
  19. package/cjs/reducers-cb531715.js.map +1 -0
  20. package/cjs/redux.js +15 -16
  21. package/cjs/redux.js.map +1 -1
  22. package/cjs/routing.js +4 -5
  23. package/cjs/routing.js.map +1 -1
  24. package/cjs/search.js +6 -4
  25. package/cjs/search.js.map +1 -1
  26. package/cjs/{selectors-69c3d37c.js → selectors-1295124a.js} +9 -1
  27. package/cjs/selectors-1295124a.js.map +1 -0
  28. package/cjs/user.js +82 -27
  29. package/cjs/user.js.map +1 -1
  30. package/cjs/util.js +21 -91
  31. package/cjs/util.js.map +1 -1
  32. package/cjs/{injectors-72d5b989.js → version-3a808c12.js} +21 -6
  33. package/cjs/version-3a808c12.js.map +1 -0
  34. package/esm/{App-08311b77.js → App-452c2ab3.js} +223 -8
  35. package/esm/App-452c2ab3.js.map +1 -0
  36. package/esm/{RouteLoader-2cfdfc5c.js → RouteLoader-dedcc835.js} +8 -38
  37. package/esm/RouteLoader-dedcc835.js.map +1 -0
  38. package/esm/{ToJs-19a3244a.js → ToJs-6e7b247c.js} +47 -3
  39. package/esm/ToJs-6e7b247c.js.map +1 -0
  40. package/esm/{actions-fda5e103.js → actions-ddd9c623.js} +1 -1
  41. package/esm/actions-ddd9c623.js.map +1 -0
  42. package/esm/client.js +121 -16
  43. package/esm/client.js.map +1 -1
  44. package/esm/contensis-react-base.js +38 -49
  45. package/esm/contensis-react-base.js.map +1 -1
  46. package/esm/forms.js +1 -1
  47. package/esm/{login-c05fee0e.js → login-1f9ad133.js} +8 -6
  48. package/esm/login-1f9ad133.js.map +1 -0
  49. package/esm/reducers-feab84fc.js +183 -0
  50. package/esm/reducers-feab84fc.js.map +1 -0
  51. package/esm/redux.js +5 -6
  52. package/esm/redux.js.map +1 -1
  53. package/esm/routing.js +4 -5
  54. package/esm/routing.js.map +1 -1
  55. package/esm/search.js +6 -4
  56. package/esm/search.js.map +1 -1
  57. package/esm/{selectors-170581d2.js → selectors-68799788.js} +9 -1
  58. package/esm/selectors-68799788.js.map +1 -0
  59. package/esm/user.js +80 -29
  60. package/esm/user.js.map +1 -1
  61. package/esm/util.js +20 -90
  62. package/esm/util.js.map +1 -1
  63. package/esm/{injectors-3cbe3981.js → version-64906b26.js} +20 -5
  64. package/esm/version-64906b26.js.map +1 -0
  65. package/models/app/App.d.ts +3 -1
  66. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +39 -1
  67. package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +1 -1
  68. package/models/app/pages/VersionInfo/index.d.ts +1 -1
  69. package/models/app/pages/VersionInfo/transformations/state-to-versioninfoprops.mapper.d.ts +2 -1
  70. package/models/client/client.d.ts +9 -3
  71. package/models/client/index.d.ts +3 -1
  72. package/models/config.d.ts +33 -0
  73. package/models/index.d.ts +5 -0
  74. package/models/redux/actions/navigation.d.ts +1 -3
  75. package/models/redux/actions/version.d.ts +2 -6
  76. package/models/redux/store/history.d.ts +2 -2
  77. package/models/redux/store/injectors.d.ts +4 -4
  78. package/models/redux/store/store.d.ts +2 -2
  79. package/models/redux/util.d.ts +1 -3
  80. package/models/routing/components/Loading.d.ts +5 -4
  81. package/models/routing/components/NotFound.d.ts +5 -11
  82. package/models/routing/components/RouteLoader.d.ts +2 -1
  83. package/models/routing/components/Status.d.ts +4 -11
  84. package/models/routing/redux/actions.d.ts +6 -18
  85. package/models/routing/redux/reducers.d.ts +2 -2
  86. package/models/routing/redux/selectors.d.ts +2 -0
  87. package/models/routing/redux/types.d.ts +12 -12
  88. package/models/routing/routes.d.ts +99 -0
  89. package/models/routing/util/expressions.d.ts +2 -10
  90. package/models/routing/util/find-contenttype-mapping.d.ts +2 -1
  91. package/models/routing/util/queries.d.ts +2 -2
  92. package/models/search/containers/withListing.d.ts +4 -0
  93. package/models/search/containers/withSearch.d.ts +4 -0
  94. package/models/search/hooks/useMinilist.hook.d.ts +23 -0
  95. package/models/search/index.d.ts +16 -1
  96. package/models/search/models/Enums.d.ts +5 -0
  97. package/models/search/models/Queries.d.ts +43 -0
  98. package/models/search/models/Search.d.ts +180 -0
  99. package/models/search/models/SearchActions.d.ts +127 -0
  100. package/models/search/models/SearchProps.d.ts +45 -0
  101. package/models/search/models/SearchState.d.ts +83 -0
  102. package/models/search/models/SearchUtil.d.ts +6 -0
  103. package/models/search/models/index.d.ts +3 -0
  104. package/models/search/redux/actions.d.ts +39 -0
  105. package/models/search/redux/queries.d.ts +3 -0
  106. package/models/search/redux/reducers.d.ts +4 -0
  107. package/models/search/redux/sagas.d.ts +20 -0
  108. package/models/search/redux/schema.d.ts +9 -0
  109. package/models/search/redux/selectors.d.ts +112 -0
  110. package/models/search/redux/types.d.ts +20 -0
  111. package/models/search/redux/util.d.ts +25 -0
  112. package/models/search/search/ContensisDeliveryApi.d.ts +32 -0
  113. package/models/search/search/ToJs.d.ts +4 -0
  114. package/models/search/search/expressions.d.ts +29 -0
  115. package/models/search/search/performance.d.ts +1 -0
  116. package/models/search/search/schema.d.ts +28 -0
  117. package/models/search/search/util.d.ts +21 -0
  118. package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -0
  119. package/models/search/transformations/filters-to-filterexpression.d.ts +1 -0
  120. package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +2 -0
  121. package/models/search/transformations/searchresult-to-state.mapper.d.ts +6 -0
  122. package/models/search/transformations/state-to-queryparams.mapper.d.ts +12 -0
  123. package/models/search/transformations/state-to-searchuri.d.ts +14 -0
  124. package/models/server/features/caching/cacheDuration.schema.d.ts +2 -2
  125. package/models/server/features/caching/cacheHashing.d.ts +1 -1
  126. package/models/server/features/caching/setCachingHeaders.d.ts +4 -3
  127. package/models/server/features/response-handler/index.d.ts +5 -3
  128. package/models/server/features/response-handler/types.d.ts +5 -5
  129. package/models/server/features/reverse-proxy/index.d.ts +3 -2
  130. package/models/server/features/static-assets/index.d.ts +10 -5
  131. package/models/server/internalServer.d.ts +9 -8
  132. package/models/server/middleware/bundleManipulation.d.ts +6 -5
  133. package/models/server/middleware/resolveStartup.d.ts +13 -1
  134. package/models/server/util/displayStartupConfiguration.d.ts +1 -1
  135. package/models/server/util/staticPaths.d.ts +1 -1
  136. package/models/server/util/stringifyAttributes.d.ts +1 -1
  137. package/models/server/webApp.d.ts +8 -1
  138. package/models/{app/features/testImmer → testImmer}/redux/reducer.d.ts +0 -0
  139. package/models/{app/features/testImmer → testImmer}/redux/selectors.d.ts +0 -0
  140. package/models/user/containers/ChangePassword.container.d.ts +2 -0
  141. package/models/user/containers/ForgotPassword.container.d.ts +2 -0
  142. package/models/user/hocs/withLogin.d.ts +2 -0
  143. package/models/user/hocs/withRegistration.d.ts +2 -0
  144. package/models/user/hooks/useChangePassword.d.ts +9 -0
  145. package/models/user/hooks/useForgotPassword.d.ts +14 -0
  146. package/models/user/{containers → hooks}/useLogin.d.ts +2 -0
  147. package/models/user/{containers → hooks}/useRegistration.d.ts +2 -2
  148. package/models/user/index.d.ts +9 -5
  149. package/models/user/redux/actions.d.ts +6 -9
  150. package/models/user/redux/sagas/resetPassword.d.ts +1 -0
  151. package/models/user/redux/selectors.d.ts +11 -0
  152. package/models/user/redux/types.d.ts +12 -0
  153. package/models/user/util/LoginHelper.class.d.ts +1 -1
  154. package/models/user/util/matchGroups.d.ts +3 -1
  155. package/models/user/util/userHelper.d.ts +12 -0
  156. package/models/util/index.d.ts +1 -2
  157. package/models/util/json-mapper.d.ts +9 -0
  158. package/models/{schema.d.ts → util/schema.d.ts} +0 -0
  159. package/package-lock.json +7833 -7781
  160. package/package.json +14 -11
  161. package/cjs/App-f3164dab.js.map +0 -1
  162. package/cjs/RouteLoader-5c44f039.js.map +0 -1
  163. package/cjs/ToJs-ca9bea03.js.map +0 -1
  164. package/cjs/actions-e22726ed.js.map +0 -1
  165. package/cjs/injectors-72d5b989.js.map +0 -1
  166. package/cjs/login-6c0ef139.js.map +0 -1
  167. package/cjs/reducers-91e3e239.js +0 -119
  168. package/cjs/reducers-91e3e239.js.map +0 -1
  169. package/cjs/selectors-69c3d37c.js.map +0 -1
  170. package/cjs/version-7d8852f6.js +0 -23
  171. package/cjs/version-7d8852f6.js.map +0 -1
  172. package/esm/App-08311b77.js.map +0 -1
  173. package/esm/RouteLoader-2cfdfc5c.js.map +0 -1
  174. package/esm/ToJs-19a3244a.js.map +0 -1
  175. package/esm/actions-fda5e103.js.map +0 -1
  176. package/esm/injectors-3cbe3981.js.map +0 -1
  177. package/esm/login-c05fee0e.js.map +0 -1
  178. package/esm/reducers-f855681f.js +0 -108
  179. package/esm/reducers-f855681f.js.map +0 -1
  180. package/esm/selectors-170581d2.js.map +0 -1
  181. package/esm/version-937d57fb.js +0 -19
  182. package/esm/version-937d57fb.js.map +0 -1
  183. package/models/app/features/link/components/Link.d.ts +0 -22
  184. package/models/app/features/link/index.d.ts +0 -2
  185. package/models/app/pages/Home/Homepage.d.ts +0 -11
  186. package/models/app/routes/StaticRoutes.d.ts +0 -23
  187. package/models/routing/util/search.d.ts +0 -7
  188. package/models/server/index.d.ts +0 -3
  189. package/models/user/containers/withLogin.d.ts +0 -2
  190. package/models/user/containers/withRegistration.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,64 @@
1
+ #### 2.5.0 (2021-09-20)
2
+
3
+ ##### New Features
4
+
5
+ - Removed useUser hook and created hooks for change password, forgot password (c65d6dd7)
6
+ - add entryMapper to /util utility function to clean up code when mapping route entries with jsonpath-mapper style templates and default arguments (3b6132d9)
7
+
8
+ ##### Bug Fixes
9
+
10
+ - Error messages not displaying on the various password forms when operations fail (341bc827)
11
+ - issue with a default value set in typescript refactor (822da5c9)
12
+ - added two missing routing selectors (2ddc26e6)
13
+ - server side debugging requires an old version of babel-plugin to define the set globals in the app (09566a99)
14
+ - changes in latest immutable js typings break existing selectors by changing their return value from any to unknown, update search package to fix bug with ToJS component. Use typescript eslint import resolver (9da62533)
15
+ - update search package to set projectId in listings (098ea40f)
16
+ - small issue with SSR and dynamic bundles need to filter out some undefined array items from the loadable modules (c9fa233f)
17
+
18
+ ##### Build System / Dependencies
19
+
20
+ - install latest search package and uninstall unused packages (81f1c1eb)
21
+ - update search package to add missing types, add rules-of-hooks back to eslintrc, correct staticRoute type in OnRouteLoadArgs (c7d1a9ce)
22
+ - add follow-tags to git push in release script so we caputure the tag created by npm version command (7030a4fd)
23
+ - adding further types to app config (d5da430c)
24
+ - add types to AppConfig keys (2c0d3447)
25
+ - search index.d.ts is not being copied in CI (0f6b7137)
26
+ - copy typescript models for search package as existing d.ts files are ignored by tsc (5f1ce21f)
27
+ - add missing @types packages (0f54a201)
28
+ - update search package to fix build (5223e118)
29
+ - update package-lock to fix build (a2f40c58)
30
+ - fix no default export in /client (9e10dc24)
31
+ - most models not published to npm (1b2eea17)
32
+ - try remove now redundant build stage (87d68755)
33
+ - handle all exports via index file, use ts-patch to be able to use tsconfig plugins to transform alias paths in d.ts files to usable paths for consumers (7fd52af6)
34
+ - update packages (dcc3cbd4)
35
+ - change npm script in CI to clean assets and build models with tsc (32c61de8)
36
+ - further TypeScript work (e91452d8)
37
+ - TypeScript with rollup and babel initial commit (2c737ed9)##### Other Changes
38
+
39
+ ##### Performance Improvements
40
+
41
+ - remove excess code from bundles (03773ece)
42
+ - update zengenti packages (f654d22a)
43
+
44
+ ##### Refactors
45
+
46
+ - further typescript conversions (9c88cd52)
47
+ - further typescript conversions (d7010813)
48
+ - typescript conversion progress, all models exported through default package, convert client entrypoint and types for routes and routing events (2a15b4c6)
49
+ - typescript conversion progress, types added for globals and server start config (12e17c53)
50
+
51
+ ##### Documentation Changes
52
+
53
+ - add TypeScript notes to README (0a8bcabd)
54
+ - tweak package description text (4f713d5a)
55
+ - update CHANGELOG (b8b1b488)
56
+
57
+ #### Other changes
58
+
59
+ - zengenti/contensis-react-base into dom-auth-changes-merge (7d6e7ed9)
60
+ - //github.com/zengenti/contensis-react-base into contensis-14-forgot-change-password (c6775cf1)
61
+
1
62
  #### 2.4.0 (2021-08-19)
2
63
 
3
64
  ##### Build System / Dependencies
package/README.md CHANGED
@@ -46,6 +46,8 @@ Default export `ZengentiAppServer` which has a `.start()` function attached for
46
46
 
47
47
  Named export `{ ReactApp }` provides a ready-made instance of a root `<App>` component to provide as the first argument to `ZengentiAppServer.start()`
48
48
 
49
+ All TypeScript models are exported from here and should be imported in your app from the default package `@zengenti/contensis-react-base`
50
+
49
51
  ### /client
50
52
 
51
53
  Default export `ClientApp` which is a class when instantiated with `new ClientApp` accepts two constructor arguments similar to `ZengentiAppServer.start()` except for use when loading the application via the client-side entrypoint
@@ -79,6 +81,20 @@ Some simple utility functions to save repetion of common functions in our app co
79
81
  - mapping functions when working with certain Contensis api results or data types
80
82
  - a copy of `ZenInfo` page to show certain build and expose configuration parameters. Something we usually include with every deployed site and served at `/zenInfo` route.
81
83
 
84
+ ### Using imports in your app
85
+
86
+ You should not import files from any other place than the packages / subpackages mentioned in this README. e.g. using imports like `@zengenti/contensis-react-base/cjs/client` or `@zengenti/contensis-react-base/models/*` is not recommended as it will not provide you with the best build output and they could change in future and would not be reflected in the semantic versioning having the potential to cause problems in future.
87
+
88
+ Sometimes VSCode may import the reference automatically from an unsupported place. You should check when committing your code that all imports are referenced correctly.
89
+
90
+ ## TypeScript support
91
+
92
+ As of v2.5.0 TypeScript declarations are available to use, and will also benefit applications written in JavaScript
93
+
94
+ All models are exported with the default package `@zengenti/contensis-react-base`
95
+
96
+ When importing Types to use in your own TypeScript project, try to always use the root import path e.g. `import { ModelName } from '@zengenti/contensis-react-base';`
97
+
82
98
  ## Key scripts to build from source 🚦 📃
83
99
 
84
100
  - `npm install` - install dependencies so we can get started
@@ -92,6 +108,67 @@ https://www.conventionalcommits.org/en/v1.0.0/#summary
92
108
 
93
109
  # Changelog
94
110
 
111
+ #### 2.5.0 (2021-09-20)
112
+
113
+ ##### New Features
114
+
115
+ - Removed useUser hook and created hooks for change password, forgot password (c65d6dd7)
116
+ - add entryMapper to /util utility function to clean up code when mapping route entries with jsonpath-mapper style templates and default arguments (3b6132d9)
117
+
118
+ ##### Bug Fixes
119
+
120
+ - Error messages not displaying on the various password forms when operations fail (341bc827)
121
+ - issue with a default value set in typescript refactor (822da5c9)
122
+ - added two missing routing selectors (2ddc26e6)
123
+ - server side debugging requires an old version of babel-plugin to define the set globals in the app (09566a99)
124
+ - changes in latest immutable js typings break existing selectors by changing their return value from any to unknown, update search package to fix bug with ToJS component. Use typescript eslint import resolver (9da62533)
125
+ - update search package to set projectId in listings (098ea40f)
126
+ - small issue with SSR and dynamic bundles need to filter out some undefined array items from the loadable modules (c9fa233f)
127
+
128
+ ##### Build System / Dependencies
129
+
130
+ - install latest search package and uninstall unused packages (81f1c1eb)
131
+ - update search package to add missing types, add rules-of-hooks back to eslintrc, correct staticRoute type in OnRouteLoadArgs (c7d1a9ce)
132
+ - add follow-tags to git push in release script so we caputure the tag created by npm version command (7030a4fd)
133
+ - adding further types to app config (d5da430c)
134
+ - add types to AppConfig keys (2c0d3447)
135
+ - search index.d.ts is not being copied in CI (0f6b7137)
136
+ - copy typescript models for search package as existing d.ts files are ignored by tsc (5f1ce21f)
137
+ - add missing @types packages (0f54a201)
138
+ - update search package to fix build (5223e118)
139
+ - update package-lock to fix build (a2f40c58)
140
+ - fix no default export in /client (9e10dc24)
141
+ - most models not published to npm (1b2eea17)
142
+ - try remove now redundant build stage (87d68755)
143
+ - handle all exports via index file, use ts-patch to be able to use tsconfig plugins to transform alias paths in d.ts files to usable paths for consumers (7fd52af6)
144
+ - update packages (dcc3cbd4)
145
+ - change npm script in CI to clean assets and build models with tsc (32c61de8)
146
+ - further TypeScript work (e91452d8)
147
+ - TypeScript with rollup and babel initial commit (2c737ed9)##### Other Changes
148
+
149
+ ##### Performance Improvements
150
+
151
+ - remove excess code from bundles (03773ece)
152
+ - update zengenti packages (f654d22a)
153
+
154
+ ##### Refactors
155
+
156
+ - further typescript conversions (9c88cd52)
157
+ - further typescript conversions (d7010813)
158
+ - typescript conversion progress, all models exported through default package, convert client entrypoint and types for routes and routing events (2a15b4c6)
159
+ - typescript conversion progress, types added for globals and server start config (12e17c53)
160
+
161
+ ##### Documentation Changes
162
+
163
+ - add TypeScript notes to README (0a8bcabd)
164
+ - tweak package description text (4f713d5a)
165
+ - update CHANGELOG (b8b1b488)
166
+
167
+ #### Other changes
168
+
169
+ - zengenti/contensis-react-base into dom-auth-changes-merge (7d6e7ed9)
170
+ - //github.com/zengenti/contensis-react-base into contensis-14-forgot-change-password (c6775cf1)
171
+
95
172
  #### 2.4.0 (2021-08-19)
96
173
 
97
174
  ##### Build System / Dependencies
@@ -7,20 +7,21 @@ require('redux-immutable');
7
7
  require('redux-thunk');
8
8
  require('redux-saga');
9
9
  require('redux-injectors');
10
- var injectors = require('./injectors-72d5b989.js');
11
- var actions = require('./actions-e22726ed.js');
12
- var reducers = require('./reducers-91e3e239.js');
10
+ var version = require('./version-3a808c12.js');
11
+ var actions = require('./actions-e9f69947.js');
12
+ var reducers = require('./reducers-cb531715.js');
13
13
  var history$1 = require('history');
14
14
  var effects = require('@redux-saga/core/effects');
15
15
  var contensisDeliveryApi = require('contensis-delivery-api');
16
- var version = require('./version-2193b4a2.js');
16
+ var version$1 = require('./version-2193b4a2.js');
17
17
  require('query-string');
18
- var selectors = require('./selectors-69c3d37c.js');
18
+ var selectors = require('./selectors-1295124a.js');
19
19
  var log = require('loglevel');
20
- var login = require('./login-6c0ef139.js');
20
+ var ToJs = require('./ToJs-d72e5b10.js');
21
+ var login = require('./login-4f274c6a.js');
21
22
  var awaitToJs = require('await-to-js');
22
23
  require('react-hot-loader');
23
- var RouteLoader = require('./RouteLoader-5c44f039.js');
24
+ var RouteLoader = require('./RouteLoader-f67bbf9e.js');
24
25
 
25
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
27
 
@@ -32,7 +33,7 @@ const browserHistory = selectedHistory();
32
33
 
33
34
  const storeSurrogateKeys = response => {
34
35
  const keys = response.headers.get ? response.headers.get('surrogate-key') : response.headers.map['surrogate-key'];
35
- if (keys) injectors.reduxStore.dispatch(actions.setSurrogateKeys(keys));
36
+ if (keys) version.reduxStore.dispatch(actions.setSurrogateKeys(keys));
36
37
  };
37
38
 
38
39
  const getClientConfig = project => {
@@ -303,13 +304,13 @@ class CachedSearch {
303
304
 
304
305
  const cachedSearch = new CachedSearch();
305
306
 
306
- const navigationSagas = [effects.takeEvery(injectors.GET_NODE_TREE, ensureNodeTreeSaga)];
307
+ const navigationSagas = [effects.takeEvery(version.GET_NODE_TREE, ensureNodeTreeSaga)];
307
308
  function* ensureNodeTreeSaga(action) {
308
309
  const state = yield effects.select();
309
310
 
310
311
  try {
311
- if (!injectors.hasNavigationTree(state)) {
312
- const deliveryApiVersionStatus = yield effects.select(version.selectVersionStatus);
312
+ if (!version.hasNavigationTree(state)) {
313
+ const deliveryApiVersionStatus = yield effects.select(version$1.selectVersionStatus);
313
314
  const project = yield effects.select(selectors.selectCurrentProject);
314
315
  const nodes = yield deliveryApi.getClient(deliveryApiVersionStatus, project).nodes.getRoot({
315
316
  depth: action.treeDepth || 0
@@ -317,18 +318,18 @@ function* ensureNodeTreeSaga(action) {
317
318
 
318
319
  if (nodes) {
319
320
  yield effects.put({
320
- type: injectors.SET_NODE_TREE,
321
+ type: version.SET_NODE_TREE,
321
322
  nodes
322
323
  });
323
324
  } else {
324
325
  yield effects.put({
325
- type: injectors.GET_NODE_TREE_ERROR
326
+ type: version.GET_NODE_TREE_ERROR
326
327
  });
327
328
  }
328
329
  }
329
330
  } catch (ex) {
330
331
  yield effects.put({
331
- type: injectors.GET_NODE_TREE_ERROR,
332
+ type: version.GET_NODE_TREE_ERROR,
332
333
  error: ex.toString()
333
334
  });
334
335
  }
@@ -424,7 +425,7 @@ function* getRouteSaga(action) {
424
425
  const routeNode = selectors.selectCurrentNode(state);
425
426
  const currentPath = action.path; //selectCurrentPath(state);
426
427
 
427
- const deliveryApiStatus = version.selectVersionStatus(state);
428
+ const deliveryApiStatus = version$1.selectVersionStatus(state);
428
429
  const project = selectors.selectCurrentProject(state);
429
430
  const isHome = currentPath === '/';
430
431
  const isPreview = currentPath && currentPath.startsWith('/preview/');
@@ -611,9 +612,9 @@ function* getRouteSaga(action) {
611
612
  }
612
613
  }
613
614
 
614
- if (!injectors.hasNavigationTree(state) && (doNavigation === true || doNavigation.tree)) if (typeof window !== 'undefined') {
615
+ if (!version.hasNavigationTree(state) && (doNavigation === true || doNavigation.tree)) if (typeof window !== 'undefined') {
615
616
  yield effects.put({
616
- type: injectors.GET_NODE_TREE,
617
+ type: version.GET_NODE_TREE,
617
618
  treeDepth: doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree
618
619
  });
619
620
  } else {
@@ -703,7 +704,7 @@ function* reduxInjectorSaga(injectorFn) {
703
704
  reducer,
704
705
  saga
705
706
  } = yield injectorFn();
706
- injectors.injectRedux({
707
+ version.injectRedux({
707
708
  key,
708
709
  reducer,
709
710
  saga
@@ -786,6 +787,220 @@ function* redirectSaga() {
786
787
  if (redirectUri) yield effects.put(actions.setRoute(redirectUri));
787
788
  }
788
789
 
790
+ const PAP_URL = 'https://pap.zengenti.com';
791
+ const USER_ENVS_URI = 'my-environments';
792
+ const USER_RESEND_VERIFICATION_URI = 'account/verify/resend';
793
+ const USER_REQUEST_PASSWORD_RESET_URI = 'account/reset';
794
+ const USER_RESET_PASSWORD_URI = 'account/reset/password';
795
+ const USER_ENVS_URL = `${PAP_URL}/${USER_ENVS_URI}`;
796
+ const BASE_OPTIONS = {
797
+ method: 'GET',
798
+ headers: {
799
+ 'Content-Type': 'application/json'
800
+ }
801
+ };
802
+ class UserHelper {
803
+ static async GetUsersEnvironments(securityToken) {
804
+ const options = { ...BASE_OPTIONS,
805
+ headers: {
806
+ 'x-security-token': securityToken
807
+ }
808
+ };
809
+ return await UserHelper.get(USER_ENVS_URL, options);
810
+ }
811
+
812
+ static async ResendUserVerification(userEmail) {
813
+ const options = { ...BASE_OPTIONS
814
+ };
815
+ return await UserHelper.get(`/${USER_RESEND_VERIFICATION_URI}?user=${userEmail}`, options);
816
+ }
817
+
818
+ static async RequestPasswordReset(userEmailObject) {
819
+ const options = { ...BASE_OPTIONS,
820
+ body: JSON.stringify(userEmailObject)
821
+ };
822
+ options.method = 'POST';
823
+ return await UserHelper.get(`/${USER_REQUEST_PASSWORD_RESET_URI}`, options);
824
+ }
825
+
826
+ static async ResetPassword(resetPasswordObject) {
827
+ const options = { ...BASE_OPTIONS,
828
+ body: JSON.stringify(resetPasswordObject)
829
+ };
830
+ options.method = 'POST';
831
+ return await UserHelper.get(`/${USER_RESET_PASSWORD_URI}`, options);
832
+ }
833
+
834
+ static async get(url, options = BASE_OPTIONS) {
835
+ try {
836
+ const responseBody = await api(url, options);
837
+ return responseBody;
838
+ } catch (err) {
839
+ return {
840
+ error: {
841
+ message: err.message
842
+ }
843
+ };
844
+ }
845
+ }
846
+
847
+ }
848
+
849
+ async function api(url, options) {
850
+ return fetch(url, options).then(async response => {
851
+ return response.json().then(data => data);
852
+ }).catch(error => {
853
+ throw error;
854
+ });
855
+ }
856
+
857
+ const resetPasswordSagas = [effects.takeEvery(reducers.REQUEST_USER_PASSWORD_RESET, requestPasswordResetSaga), effects.takeEvery(reducers.RESET_USER_PASSWORD, resetPasswordSaga), effects.takeEvery(reducers.CHANGE_USER_PASSWORD, changePasswordSaga)];
858
+
859
+ function* requestPasswordResetSaga(action) {
860
+ const userEmailObject = action.userEmailObject;
861
+ yield effects.put({
862
+ type: reducers.REQUEST_USER_PASSWORD_RESET_SENDING
863
+ });
864
+
865
+ if (userEmailObject && userEmailObject.userEmail) {
866
+ try {
867
+ const passwordResetRequestResponse = yield UserHelper.RequestPasswordReset(userEmailObject);
868
+
869
+ if (passwordResetRequestResponse) {
870
+ if (!passwordResetRequestResponse.error) {
871
+ yield effects.put({
872
+ type: reducers.REQUEST_USER_PASSWORD_RESET_SUCCESS
873
+ });
874
+ } else {
875
+ yield effects.put({
876
+ type: reducers.REQUEST_USER_PASSWORD_RESET_ERROR,
877
+ error: passwordResetRequestResponse.error.message
878
+ });
879
+ }
880
+ } else {
881
+ yield effects.put({
882
+ type: reducers.REQUEST_USER_PASSWORD_RESET_ERROR,
883
+ error: 'No response from server'
884
+ });
885
+ }
886
+ } catch (error) {
887
+ yield effects.put({
888
+ type: reducers.REQUEST_USER_PASSWORD_RESET_ERROR,
889
+ error: error && error.toString()
890
+ });
891
+ }
892
+ } else {
893
+ yield effects.put({
894
+ type: reducers.REQUEST_USER_PASSWORD_RESET_ERROR,
895
+ error: 'Invalid object'
896
+ });
897
+ }
898
+ }
899
+
900
+ function* resetPasswordSaga(action) {
901
+ const resetPasswordObject = action.resetPasswordObject;
902
+ yield effects.put({
903
+ type: reducers.RESET_USER_PASSWORD_SENDING
904
+ });
905
+
906
+ if (resetPasswordObject.token && resetPasswordObject.password) {
907
+ try {
908
+ const resetPasswordResponse = yield UserHelper.ResetPassword(resetPasswordObject);
909
+
910
+ if (resetPasswordResponse) {
911
+ if (!resetPasswordResponse.error) {
912
+ yield effects.put({
913
+ type: reducers.RESET_USER_PASSWORD_SUCCESS
914
+ });
915
+ } else {
916
+ const error = resetPasswordResponse.error.data && resetPasswordResponse.error.data.length > 0 && resetPasswordResponse.error.data[0].message || resetPasswordResponse.error.message;
917
+ yield effects.put({
918
+ type: reducers.RESET_USER_PASSWORD_ERROR,
919
+ error
920
+ });
921
+ }
922
+ } else {
923
+ yield effects.put({
924
+ type: reducers.RESET_USER_PASSWORD_ERROR,
925
+ error: 'No response from server'
926
+ });
927
+ }
928
+ } catch (error) {
929
+ yield effects.put({
930
+ type: reducers.RESET_USER_PASSWORD_ERROR,
931
+ error: error && error.toString()
932
+ });
933
+ }
934
+ } else {
935
+ yield effects.put({
936
+ type: reducers.RESET_USER_PASSWORD_ERROR,
937
+ error: 'Invalid object'
938
+ });
939
+ }
940
+ } // userId
941
+ // existingPassword
942
+ // newPassword
943
+
944
+
945
+ function* changePasswordSaga(action) {
946
+ if (!action || !action.userId || !action.currentPassword || !action.newPassword) {
947
+ yield effects.put({
948
+ type: reducers.CHANGE_USER_PASSWORD_ERROR,
949
+ error: 'Invalid action object sent to changePassword saga'
950
+ });
951
+ return;
952
+ }
953
+
954
+ try {
955
+ const changePasswordObject = {
956
+ userId: action.userId,
957
+ existing: action.currentPassword,
958
+ new: action.newPassword
959
+ };
960
+ yield effects.put({
961
+ type: reducers.CHANGE_USER_PASSWORD_SENDING
962
+ });
963
+ const clientCredentials = (yield effects.select(ToJs.selectClientCredentials)).toJS();
964
+ const client = yield login.getManagementApiClient({ ...clientCredentials
965
+ });
966
+ const [err, res] = yield awaitToJs.to(client.security.users.updatePassword(changePasswordObject));
967
+
968
+ if (err) {
969
+ var _err$data, _err$data$data, _err$data2;
970
+
971
+ const error = (err === null || err === void 0 ? void 0 : (_err$data = err.data) === null || _err$data === void 0 ? void 0 : (_err$data$data = _err$data.data) === null || _err$data$data === void 0 ? void 0 : _err$data$data.length) > 0 && err.data.data[0].message || (err === null || err === void 0 ? void 0 : (_err$data2 = err.data) === null || _err$data2 === void 0 ? void 0 : _err$data2.message);
972
+ yield effects.put({
973
+ type: reducers.CHANGE_USER_PASSWORD_ERROR,
974
+ error
975
+ });
976
+ return;
977
+ } // // eslint-disable-next-line no-console
978
+ // console.log(changePasswordObject);
979
+ // // eslint-disable-next-line no-console
980
+ // console.log(userCredentialsObject);
981
+
982
+
983
+ yield effects.put({
984
+ type: reducers.CHANGE_USER_PASSWORD_SUCCESS
985
+ });
986
+ } catch (error) {
987
+ yield effects.put({
988
+ type: reducers.CHANGE_USER_PASSWORD_ERROR,
989
+ error: error && error.toString()
990
+ });
991
+ }
992
+ }
993
+
994
+ const userSagas = [...login.loginSagas, ...registerSagas, ...resetPasswordSagas];
995
+
996
+ // index.js
997
+ function rootSaga (featureSagas = []) {
998
+ return function* rootSaga() {
999
+ const subSagas = [...routingSagas, ...navigationSagas, ...userSagas];
1000
+ yield effects.all([...subSagas, ...featureSagas]);
1001
+ };
1002
+ }
1003
+
789
1004
  const servers = SERVERS;
790
1005
  /* global SERVERS */
791
1006
 
@@ -834,10 +1049,9 @@ const AppRoot = props => {
834
1049
  };
835
1050
 
836
1051
  exports.AppRoot = AppRoot;
1052
+ exports.browserHistory = browserHistory;
837
1053
  exports.deliveryApi = deliveryApi;
838
1054
  exports.history = history;
839
- exports.navigationSagas = navigationSagas;
840
1055
  exports.pickProject = pickProject;
841
- exports.registerSagas = registerSagas;
842
- exports.routingSagas = routingSagas;
843
- //# sourceMappingURL=App-f3164dab.js.map
1056
+ exports.rootSaga = rootSaga;
1057
+ //# sourceMappingURL=App-79703372.js.map