@zengenti/contensis-react-base 2.4.1-beta.7 → 2.5.1-beta.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 (225) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +89 -0
  3. package/cjs/{App-f3164dab.js → App-8f560cc5.js} +236 -22
  4. package/cjs/App-8f560cc5.js.map +1 -0
  5. package/cjs/{RouteLoader-5c44f039.js → RouteLoader-f99cd734.js} +14 -41
  6. package/cjs/RouteLoader-f99cd734.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 +128 -118
  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-d468b2a6.js} +223 -8
  35. package/esm/App-d468b2a6.js.map +1 -0
  36. package/esm/{RouteLoader-2cfdfc5c.js → RouteLoader-281d47e1.js} +14 -40
  37. package/esm/RouteLoader-281d47e1.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 +122 -112
  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 +4 -0
  66. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +40 -0
  67. package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +1 -0
  68. package/models/app/pages/VersionInfo/index.d.ts +2 -0
  69. package/models/app/pages/VersionInfo/transformations/state-to-versioninfoprops.mapper.d.ts +3 -0
  70. package/models/client/client.d.ts +11 -0
  71. package/models/client/index.d.ts +3 -0
  72. package/models/config.d.ts +33 -0
  73. package/models/forms/index.d.ts +1 -0
  74. package/models/index.d.ts +5 -0
  75. package/models/redux/actions/index.d.ts +9 -0
  76. package/models/redux/actions/navigation.d.ts +1 -0
  77. package/models/redux/actions/version.d.ts +2 -0
  78. package/models/redux/index.d.ts +17 -0
  79. package/models/redux/reducers/navigation.d.ts +3 -0
  80. package/models/redux/reducers/version.d.ts +3 -0
  81. package/models/redux/sagas/index.d.ts +1 -0
  82. package/models/redux/sagas/navigation.d.ts +4 -0
  83. package/models/redux/selectors/index.d.ts +9 -0
  84. package/models/redux/selectors/navigation.d.ts +3 -0
  85. package/models/redux/selectors/version.d.ts +3 -0
  86. package/models/redux/store/history.d.ts +2 -0
  87. package/models/redux/store/injectors.d.ts +19 -0
  88. package/models/redux/store/routerMiddleware.d.ts +7 -0
  89. package/models/redux/store/store.d.ts +3 -0
  90. package/models/redux/types/index.d.ts +9 -0
  91. package/models/redux/types/navigation.d.ts +3 -0
  92. package/models/redux/types/version.d.ts +2 -0
  93. package/models/redux/util.d.ts +1 -0
  94. package/models/routing/components/Loading.d.ts +5 -0
  95. package/models/routing/components/NotFound.d.ts +6 -0
  96. package/models/routing/components/RouteLoader.d.ts +3 -0
  97. package/models/routing/components/Status.d.ts +4 -0
  98. package/models/routing/index.d.ts +4 -0
  99. package/models/routing/redux/actions.d.ts +6 -0
  100. package/models/routing/redux/reducers.d.ts +4 -0
  101. package/models/routing/redux/sagas.d.ts +1 -0
  102. package/models/routing/redux/selectors.d.ts +25 -0
  103. package/models/routing/redux/types.d.ts +12 -0
  104. package/models/routing/routes.d.ts +98 -0
  105. package/models/routing/util/expressions.d.ts +2 -0
  106. package/models/routing/util/find-contenttype-mapping.d.ts +2 -0
  107. package/models/routing/util/queries.d.ts +2 -0
  108. package/models/search/containers/withListing.d.ts +4 -0
  109. package/models/search/containers/withSearch.d.ts +4 -0
  110. package/models/search/hooks/useMinilist.hook.d.ts +23 -0
  111. package/models/search/index.d.ts +16 -0
  112. package/models/search/models/Enums.d.ts +5 -0
  113. package/models/search/models/Queries.d.ts +43 -0
  114. package/models/search/models/Search.d.ts +180 -0
  115. package/models/search/models/SearchActions.d.ts +127 -0
  116. package/models/search/models/SearchProps.d.ts +45 -0
  117. package/models/search/models/SearchState.d.ts +83 -0
  118. package/models/search/models/SearchUtil.d.ts +6 -0
  119. package/models/search/models/index.d.ts +3 -0
  120. package/models/search/redux/actions.d.ts +39 -0
  121. package/models/search/redux/queries.d.ts +3 -0
  122. package/models/search/redux/reducers.d.ts +4 -0
  123. package/models/search/redux/sagas.d.ts +20 -0
  124. package/models/search/redux/schema.d.ts +9 -0
  125. package/models/search/redux/selectors.d.ts +112 -0
  126. package/models/search/redux/types.d.ts +20 -0
  127. package/models/search/redux/util.d.ts +25 -0
  128. package/models/search/search/ContensisDeliveryApi.d.ts +32 -0
  129. package/models/search/search/ToJs.d.ts +4 -0
  130. package/models/search/search/expressions.d.ts +29 -0
  131. package/models/search/search/performance.d.ts +1 -0
  132. package/models/search/search/schema.d.ts +28 -0
  133. package/models/search/search/util.d.ts +21 -0
  134. package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -0
  135. package/models/search/transformations/filters-to-filterexpression.d.ts +1 -0
  136. package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +2 -0
  137. package/models/search/transformations/searchresult-to-state.mapper.d.ts +6 -0
  138. package/models/search/transformations/state-to-queryparams.mapper.d.ts +12 -0
  139. package/models/search/transformations/state-to-searchuri.d.ts +14 -0
  140. package/models/server/features/caching/cacheDuration.schema.d.ts +7 -0
  141. package/models/server/features/caching/cacheHashing.d.ts +1 -0
  142. package/models/server/features/caching/setCachingHeaders.d.ts +6 -0
  143. package/models/server/features/response-handler/index.d.ts +12 -0
  144. package/models/server/features/response-handler/types.d.ts +5 -0
  145. package/models/server/features/reverse-proxy/index.d.ts +4 -0
  146. package/models/server/features/static-assets/index.d.ts +14 -0
  147. package/models/server/internalServer.d.ts +10 -0
  148. package/models/server/middleware/bundleManipulation.d.ts +6 -0
  149. package/models/server/middleware/resolveStartup.d.ts +13 -0
  150. package/models/server/util/bundles.d.ts +46 -0
  151. package/models/server/util/displayStartupConfiguration.d.ts +2 -0
  152. package/models/server/util/headers.d.ts +9 -0
  153. package/models/server/util/staticPaths.d.ts +1 -0
  154. package/models/server/util/stringifyAttributes.d.ts +2 -0
  155. package/models/server/webApp.d.ts +9 -0
  156. package/models/testImmer/redux/reducer.d.ts +8 -0
  157. package/models/testImmer/redux/selectors.d.ts +3 -0
  158. package/models/user/components/Login.d.ts +2 -0
  159. package/models/user/components/LoginForm.d.ts +16 -0
  160. package/models/user/components/LogoutForm.d.ts +12 -0
  161. package/models/user/components.styled/Login.styled.d.ts +2 -0
  162. package/models/user/components.styled/LoginForm.styled.d.ts +2 -0
  163. package/models/user/containers/ChangePassword.container.d.ts +2 -0
  164. package/models/user/containers/ForgotPassword.container.d.ts +2 -0
  165. package/models/user/containers/Login.container.d.ts +2 -0
  166. package/models/user/containers/Registration.container.d.ts +2 -0
  167. package/models/user/hocs/withLogin.d.ts +2 -0
  168. package/models/user/hocs/withRegistration.d.ts +2 -0
  169. package/models/user/hooks/useChangePassword.d.ts +9 -0
  170. package/models/user/hooks/useForgotPassword.d.ts +14 -0
  171. package/models/user/hooks/useLogin.d.ts +12 -0
  172. package/models/user/hooks/useRegistration.d.ts +8 -0
  173. package/models/user/index.d.ts +16 -0
  174. package/models/user/redux/actions.d.ts +6 -0
  175. package/models/user/redux/reducers.d.ts +4 -0
  176. package/models/user/redux/sagas/index.d.ts +1 -0
  177. package/models/user/redux/sagas/login.d.ts +36 -0
  178. package/models/user/redux/sagas/register.d.ts +1 -0
  179. package/models/user/redux/sagas/resetPassword.d.ts +1 -0
  180. package/models/user/redux/selectors.d.ts +27 -0
  181. package/models/user/redux/types.d.ts +21 -0
  182. package/models/user/transformations/mapClientCredentials.d.ts +2 -0
  183. package/models/user/util/ContensisManagementApi.d.ts +9 -0
  184. package/models/user/util/CookieHelper.class.d.ts +5 -0
  185. package/models/user/util/LoginHelper.class.d.ts +52 -0
  186. package/models/user/util/OidcUserManager.d.ts +18 -0
  187. package/models/user/util/matchGroups.d.ts +3 -0
  188. package/models/user/util/userHelper.d.ts +12 -0
  189. package/models/util/ContensisDeliveryApi.d.ts +40 -0
  190. package/models/util/ToJs.d.ts +1 -0
  191. package/models/util/fromJSLeaveImmer.d.ts +2 -0
  192. package/models/util/fromJSOrdered.d.ts +2 -0
  193. package/models/util/index.d.ts +5 -0
  194. package/models/util/json-mapper.d.ts +81 -0
  195. package/models/util/navHelper.d.ts +7 -0
  196. package/models/util/navigation.d.ts +4 -0
  197. package/models/util/performance.d.ts +1 -0
  198. package/models/util/pickProject.d.ts +2 -0
  199. package/models/{schema.d.ts → util/schema.d.ts} +0 -0
  200. package/models/util/stringifyStrings.d.ts +2 -0
  201. package/models/util/urls.d.ts +9 -0
  202. package/package-lock.json +7831 -7713
  203. package/package.json +24 -14
  204. package/cjs/App-f3164dab.js.map +0 -1
  205. package/cjs/RouteLoader-5c44f039.js.map +0 -1
  206. package/cjs/ToJs-ca9bea03.js.map +0 -1
  207. package/cjs/actions-e22726ed.js.map +0 -1
  208. package/cjs/injectors-72d5b989.js.map +0 -1
  209. package/cjs/login-6c0ef139.js.map +0 -1
  210. package/cjs/reducers-91e3e239.js +0 -119
  211. package/cjs/reducers-91e3e239.js.map +0 -1
  212. package/cjs/selectors-69c3d37c.js.map +0 -1
  213. package/cjs/version-7d8852f6.js +0 -23
  214. package/cjs/version-7d8852f6.js.map +0 -1
  215. package/esm/App-08311b77.js.map +0 -1
  216. package/esm/RouteLoader-2cfdfc5c.js.map +0 -1
  217. package/esm/ToJs-19a3244a.js.map +0 -1
  218. package/esm/actions-fda5e103.js.map +0 -1
  219. package/esm/injectors-3cbe3981.js.map +0 -1
  220. package/esm/login-c05fee0e.js.map +0 -1
  221. package/esm/reducers-f855681f.js +0 -108
  222. package/esm/reducers-f855681f.js.map +0 -1
  223. package/esm/selectors-170581d2.js.map +0 -1
  224. package/esm/version-937d57fb.js +0 -19
  225. package/esm/version-937d57fb.js.map +0 -1
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
@@ -4,6 +4,18 @@ Everything you need to get started with React and Contensis.
4
4
 
5
5
  Handles web app routing with Contensis Site View and component rendering based on a loaded Content Type entry in Contensis, Redux application store creation and all the major application dependencies to get going, with server side rendering and an Express web server.
6
6
 
7
+ ## v2.6 Installation Notes
8
+
9
+ This version introduces React v17. React is very sensitive to having multiple versions installed at the same time.
10
+
11
+ Many projects upgrading to v2.6 of `contensis-react-base` are likely to be using an older version of Storybook which when installed along with React 17 results in multiple versions of React being installed and resulting in the app not rendering giving a react console error.
12
+
13
+ You will need to upgrade your version of Storybook to be >= 6.1 which has support for React 17. [Further reading](https://storybook.js.org/blog/storybook-6-1/)
14
+
15
+ TLDR: Storybook have provided a simple way to upgrade. Run `npx sb upgrade` when upgrading to v2.6 of `contensis-react-base`. You should also ensure you are running the latest version of webpack or webpack@4 to prevent futher errors when loading Storybook.
16
+
17
+ If you are still getting react errors after this, check your project for other dependencies to remove/update that rely on older versions of react
18
+
7
19
  # What's goin' on under the hood? 🔧
8
20
 
9
21
  The core of your Contensis React application is in package `@zengenti/contensis-react-base` this must be installed as a 'production' dependency, i.e. lives in the `dependencies` section of your `package.json`
@@ -46,6 +58,8 @@ Default export `ZengentiAppServer` which has a `.start()` function attached for
46
58
 
47
59
  Named export `{ ReactApp }` provides a ready-made instance of a root `<App>` component to provide as the first argument to `ZengentiAppServer.start()`
48
60
 
61
+ All TypeScript models are exported from here and should be imported in your app from the default package `@zengenti/contensis-react-base`
62
+
49
63
  ### /client
50
64
 
51
65
  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 +93,20 @@ Some simple utility functions to save repetion of common functions in our app co
79
93
  - mapping functions when working with certain Contensis api results or data types
80
94
  - 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
95
 
96
+ ### Using imports in your app
97
+
98
+ 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.
99
+
100
+ Sometimes VSCode may import the reference automatically from an unsupported place. You should check when committing your code that all imports are referenced correctly.
101
+
102
+ ## TypeScript support
103
+
104
+ As of v2.5.0 TypeScript declarations are available to use, and will also benefit applications written in JavaScript
105
+
106
+ All models are exported with the default package `@zengenti/contensis-react-base`
107
+
108
+ 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';`
109
+
82
110
  ## Key scripts to build from source 🚦 📃
83
111
 
84
112
  - `npm install` - install dependencies so we can get started
@@ -92,6 +120,67 @@ https://www.conventionalcommits.org/en/v1.0.0/#summary
92
120
 
93
121
  # Changelog
94
122
 
123
+ #### 2.5.0 (2021-09-20)
124
+
125
+ ##### New Features
126
+
127
+ - Removed useUser hook and created hooks for change password, forgot password (c65d6dd7)
128
+ - add entryMapper to /util utility function to clean up code when mapping route entries with jsonpath-mapper style templates and default arguments (3b6132d9)
129
+
130
+ ##### Bug Fixes
131
+
132
+ - Error messages not displaying on the various password forms when operations fail (341bc827)
133
+ - issue with a default value set in typescript refactor (822da5c9)
134
+ - added two missing routing selectors (2ddc26e6)
135
+ - server side debugging requires an old version of babel-plugin to define the set globals in the app (09566a99)
136
+ - 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)
137
+ - update search package to set projectId in listings (098ea40f)
138
+ - small issue with SSR and dynamic bundles need to filter out some undefined array items from the loadable modules (c9fa233f)
139
+
140
+ ##### Build System / Dependencies
141
+
142
+ - install latest search package and uninstall unused packages (81f1c1eb)
143
+ - update search package to add missing types, add rules-of-hooks back to eslintrc, correct staticRoute type in OnRouteLoadArgs (c7d1a9ce)
144
+ - add follow-tags to git push in release script so we caputure the tag created by npm version command (7030a4fd)
145
+ - adding further types to app config (d5da430c)
146
+ - add types to AppConfig keys (2c0d3447)
147
+ - search index.d.ts is not being copied in CI (0f6b7137)
148
+ - copy typescript models for search package as existing d.ts files are ignored by tsc (5f1ce21f)
149
+ - add missing @types packages (0f54a201)
150
+ - update search package to fix build (5223e118)
151
+ - update package-lock to fix build (a2f40c58)
152
+ - fix no default export in /client (9e10dc24)
153
+ - most models not published to npm (1b2eea17)
154
+ - try remove now redundant build stage (87d68755)
155
+ - 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)
156
+ - update packages (dcc3cbd4)
157
+ - change npm script in CI to clean assets and build models with tsc (32c61de8)
158
+ - further TypeScript work (e91452d8)
159
+ - TypeScript with rollup and babel initial commit (2c737ed9)##### Other Changes
160
+
161
+ ##### Performance Improvements
162
+
163
+ - remove excess code from bundles (03773ece)
164
+ - update zengenti packages (f654d22a)
165
+
166
+ ##### Refactors
167
+
168
+ - further typescript conversions (9c88cd52)
169
+ - further typescript conversions (d7010813)
170
+ - typescript conversion progress, all models exported through default package, convert client entrypoint and types for routes and routing events (2a15b4c6)
171
+ - typescript conversion progress, types added for globals and server start config (12e17c53)
172
+
173
+ ##### Documentation Changes
174
+
175
+ - add TypeScript notes to README (0a8bcabd)
176
+ - tweak package description text (4f713d5a)
177
+ - update CHANGELOG (b8b1b488)
178
+
179
+ #### Other changes
180
+
181
+ - zengenti/contensis-react-base into dom-auth-changes-merge (7d6e7ed9)
182
+ - //github.com/zengenti/contensis-react-base into contensis-14-forgot-change-password (c6775cf1)
183
+
95
184
  #### 2.4.0 (2021-08-19)
96
185
 
97
186
  ##### 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-f99cd734.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-8f560cc5.js.map