@zengenti/contensis-react-base 4.0.0-beta.6 → 4.0.0-beta.60

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 (206) hide show
  1. package/README.md +14 -1
  2. package/cjs/{App-vZrUfVgQ.js → App-Dr56ZsQj.js} +476 -99
  3. package/cjs/App-Dr56ZsQj.js.map +1 -0
  4. package/cjs/{ChangePassword.container-ECjEXixF.js → ChangePassword.container-C4Du3Wb1.js} +57 -50
  5. package/cjs/ChangePassword.container-C4Du3Wb1.js.map +1 -0
  6. package/cjs/{SSRContext-DVj_QAC1.js → ContensisDeliveryApi-gN3_MHEl.js} +32 -74
  7. package/cjs/ContensisDeliveryApi-gN3_MHEl.js.map +1 -0
  8. package/cjs/CookieConstants-DfPiWCRZ.js +12 -0
  9. package/cjs/CookieConstants-DfPiWCRZ.js.map +1 -0
  10. package/{esm/CookieHelper.class-FTURFpz3.js → cjs/CookieHelper.class-Det3qfdU.js} +4 -6
  11. package/cjs/CookieHelper.class-Det3qfdU.js.map +1 -0
  12. package/cjs/{RouteLoader-D5Yg7EB5.js → RouteLoader-Bbt-nG3v.js} +13 -8
  13. package/cjs/RouteLoader-Bbt-nG3v.js.map +1 -0
  14. package/cjs/SSRContext-DotLlTQc.js +116 -0
  15. package/cjs/SSRContext-DotLlTQc.js.map +1 -0
  16. package/cjs/ToJs-BsWqWjdm.js +23 -0
  17. package/cjs/ToJs-BsWqWjdm.js.map +1 -0
  18. package/cjs/{VersionInfo-B_dKCubg.js → VersionInfo-zFPsvS8q.js} +3 -25
  19. package/cjs/VersionInfo-zFPsvS8q.js.map +1 -0
  20. package/cjs/client.js +62 -64
  21. package/cjs/client.js.map +1 -1
  22. package/cjs/contensis-react-base.js +235 -127
  23. package/cjs/contensis-react-base.js.map +1 -1
  24. package/cjs/i18n.js +75 -0
  25. package/cjs/i18n.js.map +1 -0
  26. package/cjs/{ToJs-C9jwV7YB.js → matchGroups-dqONU-vY.js} +2 -22
  27. package/cjs/matchGroups-dqONU-vY.js.map +1 -0
  28. package/cjs/redux.js +8 -6
  29. package/cjs/redux.js.map +1 -1
  30. package/cjs/routing.js +15 -7
  31. package/cjs/routing.js.map +1 -1
  32. package/cjs/{sagas-CbZhaRNd.js → sagas-OfBUtx74.js} +523 -370
  33. package/cjs/sagas-OfBUtx74.js.map +1 -0
  34. package/cjs/search.js +54 -29
  35. package/cjs/search.js.map +1 -1
  36. package/cjs/{selectors-wCs5fHD4.js → selectors-BrxJ8-F8.js} +27 -6
  37. package/cjs/selectors-BrxJ8-F8.js.map +1 -0
  38. package/cjs/selectors-DAQR0uZa.js +18 -0
  39. package/cjs/selectors-DAQR0uZa.js.map +1 -0
  40. package/cjs/slice-5xJMH24n.js +69 -0
  41. package/cjs/slice-5xJMH24n.js.map +1 -0
  42. package/cjs/{store-D07FOXvM.js → store-Dn7vP6G0.js} +52 -4
  43. package/cjs/store-Dn7vP6G0.js.map +1 -0
  44. package/cjs/urls-DVIwGZmd.js +25 -0
  45. package/cjs/urls-DVIwGZmd.js.map +1 -0
  46. package/cjs/user.js +20 -17
  47. package/cjs/user.js.map +1 -1
  48. package/cjs/util-wQwG9vit.js +148 -0
  49. package/cjs/util-wQwG9vit.js.map +1 -0
  50. package/cjs/util.js +80 -22
  51. package/cjs/util.js.map +1 -1
  52. package/cjs/{version-B7XFkBhY.js → version-2FamXHhj.js} +15 -16
  53. package/cjs/version-2FamXHhj.js.map +1 -0
  54. package/cjs/{version-CM-bJ62L.js → version-rFG9Y6_B.js} +2 -2
  55. package/cjs/{version-CM-bJ62L.js.map → version-rFG9Y6_B.js.map} +1 -1
  56. package/esm/{App-DLZweVSp.js → App-CrCf7gso.js} +436 -60
  57. package/esm/App-CrCf7gso.js.map +1 -0
  58. package/esm/{ChangePassword.container-BgzIy8dA.js → ChangePassword.container-CUBtn82K.js} +19 -13
  59. package/esm/ChangePassword.container-CUBtn82K.js.map +1 -0
  60. package/esm/{SSRContext-BE8ElZ3X.js → ContensisDeliveryApi-CvEoOLCl.js} +30 -67
  61. package/esm/ContensisDeliveryApi-CvEoOLCl.js.map +1 -0
  62. package/esm/CookieConstants-DEmbwzYr.js +7 -0
  63. package/esm/CookieConstants-DEmbwzYr.js.map +1 -0
  64. package/{cjs/CookieHelper.class-C3Eqoze9.js → esm/CookieHelper.class-C6rTRl_1.js} +2 -14
  65. package/esm/CookieHelper.class-C6rTRl_1.js.map +1 -0
  66. package/esm/{RouteLoader-xeQBXywk.js → RouteLoader-BpHhiAlL.js} +10 -5
  67. package/esm/RouteLoader-BpHhiAlL.js.map +1 -0
  68. package/esm/SSRContext-CYxBWky3.js +106 -0
  69. package/esm/SSRContext-CYxBWky3.js.map +1 -0
  70. package/esm/ToJs-BnRRHk6f.js +17 -0
  71. package/esm/ToJs-BnRRHk6f.js.map +1 -0
  72. package/esm/{VersionInfo-Cno7K0OA.js → VersionInfo-By2ZCZOh.js} +4 -24
  73. package/esm/VersionInfo-By2ZCZOh.js.map +1 -0
  74. package/esm/client.js +62 -63
  75. package/esm/client.js.map +1 -1
  76. package/esm/contensis-react-base.js +227 -121
  77. package/esm/contensis-react-base.js.map +1 -1
  78. package/esm/i18n.js +64 -0
  79. package/esm/i18n.js.map +1 -0
  80. package/esm/{ToJs-CNzfvyxJ.js → matchGroups-_w8BwzCC.js} +3 -18
  81. package/esm/matchGroups-_w8BwzCC.js.map +1 -0
  82. package/esm/redux.js +11 -8
  83. package/esm/redux.js.map +1 -1
  84. package/esm/routing.js +14 -7
  85. package/esm/routing.js.map +1 -1
  86. package/esm/{sagas-xJU-zOpn.js → sagas-BZWjx5by.js} +511 -357
  87. package/esm/sagas-BZWjx5by.js.map +1 -0
  88. package/esm/search.js +73 -47
  89. package/esm/search.js.map +1 -1
  90. package/esm/{selectors-DO2ocdOp.js → selectors-8ROQrTd7.js} +25 -7
  91. package/esm/selectors-8ROQrTd7.js.map +1 -0
  92. package/esm/selectors-DcmvOeX2.js +10 -0
  93. package/esm/selectors-DcmvOeX2.js.map +1 -0
  94. package/esm/slice-C6JLQik8.js +63 -0
  95. package/esm/slice-C6JLQik8.js.map +1 -0
  96. package/esm/{store-3u0RzHZ0.js → store-DSjRYsM2.js} +52 -5
  97. package/esm/store-DSjRYsM2.js.map +1 -0
  98. package/esm/urls-DfCisos-.js +22 -0
  99. package/esm/urls-DfCisos-.js.map +1 -0
  100. package/esm/user.js +9 -6
  101. package/esm/user.js.map +1 -1
  102. package/esm/util-BafFLYzn.js +136 -0
  103. package/esm/util-BafFLYzn.js.map +1 -0
  104. package/esm/util.js +58 -14
  105. package/esm/util.js.map +1 -1
  106. package/esm/{version-BlsI7hX2.js → version-B75wA6Te.js} +16 -16
  107. package/esm/version-B75wA6Te.js.map +1 -0
  108. package/esm/{version-wnf-TITV.js → version-BQAL8sQO.js} +2 -2
  109. package/esm/{version-wnf-TITV.js.map → version-BQAL8sQO.js.map} +1 -1
  110. package/i18n/package.json +5 -0
  111. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
  112. package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +0 -1
  113. package/models/i18n/index.d.ts +5 -0
  114. package/models/i18n/redux/sagas.d.ts +19 -0
  115. package/models/i18n/redux/selectors.d.ts +11 -0
  116. package/models/i18n/redux/slice.d.ts +198 -0
  117. package/models/i18n/routes.d.ts +8 -0
  118. package/models/i18n/useI18n.hook.d.ts +20 -0
  119. package/models/index.d.ts +1 -0
  120. package/models/models/AppState.d.ts +2 -0
  121. package/models/models/ContentTypeMapping.d.ts +5 -0
  122. package/models/models/Locales.d.ts +11 -0
  123. package/models/models/MatchedRoute.d.ts +5 -1
  124. package/models/models/RouteComponent.d.ts +0 -1
  125. package/models/models/SSRContext.d.ts +4 -4
  126. package/models/models/StaticRoute.d.ts +11 -0
  127. package/models/models/WithEvents.d.ts +8 -0
  128. package/models/models/config/AppConfig.d.ts +2 -0
  129. package/models/models/config/I18n.d.ts +38 -0
  130. package/models/models/config/ServerConfig.d.ts +3 -0
  131. package/models/redux/index.d.ts +2 -1
  132. package/models/redux/sagas/index.d.ts +3 -1
  133. package/models/redux/sagas/injector.d.ts +13 -0
  134. package/models/redux/store/injectors/index.d.ts +26 -0
  135. package/models/redux/store/injectors/inject.d.ts +24 -0
  136. package/models/redux/store/injectors/util.d.ts +2 -0
  137. package/models/redux/store/store.d.ts +13 -4
  138. package/models/redux/util.d.ts +1 -1
  139. package/models/routing/components/RouteLoader.d.ts +3 -3
  140. package/models/routing/httpContext.d.ts +0 -1
  141. package/models/routing/index.d.ts +1 -0
  142. package/models/routing/redux/actions.d.ts +1 -1
  143. package/models/routing/redux/invokeSearch.d.ts +22 -0
  144. package/models/routing/redux/selectors.d.ts +47 -4
  145. package/models/routing/util/expressions.d.ts +1 -1
  146. package/models/routing/util/find-contenttype-mapping.d.ts +3 -1
  147. package/models/search/containers/withListing.d.ts +1 -1
  148. package/models/search/containers/withSearch.d.ts +1 -1
  149. package/models/search/models/Queries.d.ts +3 -5
  150. package/models/search/models/Search.d.ts +43 -13
  151. package/models/search/models/SearchActions.d.ts +61 -18
  152. package/models/search/models/SearchProps.d.ts +11 -10
  153. package/models/search/models/SearchState.d.ts +23 -2
  154. package/models/search/models/SearchUtil.d.ts +3 -3
  155. package/models/search/redux/getIn.d.ts +2 -2
  156. package/models/search/redux/reducers.d.ts +3 -4
  157. package/models/search/redux/sagas.d.ts +13 -14
  158. package/models/search/redux/schema.d.ts +3 -3
  159. package/models/search/redux/selectors.d.ts +64 -42
  160. package/models/search/redux/util.d.ts +10 -1
  161. package/models/search/search/ContensisDeliveryApi.d.ts +6 -26
  162. package/models/search/search/expressions.d.ts +6 -4
  163. package/models/search/search/util.d.ts +9 -7
  164. package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
  165. package/models/server/features/linkdepth-api/search.d.ts +1 -1
  166. package/models/server/features/response-handler/render-stream.d.ts +2 -4
  167. package/models/server/features/static-assets/index.d.ts +4 -3
  168. package/models/server/internalServer.d.ts +1 -2
  169. package/models/server/middleware/subsiteDebug.d.ts +11 -0
  170. package/models/server/root.d.ts +3 -0
  171. package/models/server/util/bundles.d.ts +9 -9
  172. package/models/server/util/jsx.d.ts +2 -14
  173. package/models/user/hocs/withRegistration.d.ts +1 -1
  174. package/models/util/CachedDeliveryApi.d.ts +8 -2
  175. package/models/util/ContensisDeliveryApi.d.ts +2 -4
  176. package/models/util/NoSSR.d.ts +6 -0
  177. package/models/util/SSRContext.d.ts +3 -19
  178. package/models/util/donotuse_useHistory.d.ts +6 -0
  179. package/models/util/index.d.ts +6 -1
  180. package/models/util/subsite.d.ts +12 -0
  181. package/models/util/useIsClient.d.ts +6 -0
  182. package/package.json +39 -38
  183. package/cjs/App-vZrUfVgQ.js.map +0 -1
  184. package/cjs/ChangePassword.container-ECjEXixF.js.map +0 -1
  185. package/cjs/CookieHelper.class-C3Eqoze9.js.map +0 -1
  186. package/cjs/RouteLoader-D5Yg7EB5.js.map +0 -1
  187. package/cjs/SSRContext-DVj_QAC1.js.map +0 -1
  188. package/cjs/ToJs-C9jwV7YB.js.map +0 -1
  189. package/cjs/VersionInfo-B_dKCubg.js.map +0 -1
  190. package/cjs/sagas-CbZhaRNd.js.map +0 -1
  191. package/cjs/selectors-wCs5fHD4.js.map +0 -1
  192. package/cjs/store-D07FOXvM.js.map +0 -1
  193. package/cjs/version-B7XFkBhY.js.map +0 -1
  194. package/esm/App-DLZweVSp.js.map +0 -1
  195. package/esm/ChangePassword.container-BgzIy8dA.js.map +0 -1
  196. package/esm/CookieHelper.class-FTURFpz3.js.map +0 -1
  197. package/esm/RouteLoader-xeQBXywk.js.map +0 -1
  198. package/esm/SSRContext-BE8ElZ3X.js.map +0 -1
  199. package/esm/ToJs-CNzfvyxJ.js.map +0 -1
  200. package/esm/VersionInfo-Cno7K0OA.js.map +0 -1
  201. package/esm/sagas-xJU-zOpn.js.map +0 -1
  202. package/esm/selectors-DO2ocdOp.js.map +0 -1
  203. package/esm/store-3u0RzHZ0.js.map +0 -1
  204. package/esm/version-BlsI7hX2.js.map +0 -1
  205. package/models/redux/store/injectors.d.ts +0 -31
  206. package/models/search/search/ToJs.d.ts +0 -4
@@ -0,0 +1,198 @@
1
+ import { PayloadAction } from '@reduxjs/toolkit';
2
+ import { I18nAppConfig } from "../../models/config/I18n";
3
+ import { LocaleDictionary, LocaleRoutes, Locales } from "../../models/Locales";
4
+ export type UpdateLanguageActionPayload = {
5
+ language: string;
6
+ redirect?: boolean | string;
7
+ fallbackPath?: string;
8
+ };
9
+ declare const i18nSlice: import("@reduxjs/toolkit").Slice<{
10
+ currentLanguage: string;
11
+ dictionary: LocaleDictionary;
12
+ locales: {
13
+ [language: string]: any;
14
+ };
15
+ routes: LocaleRoutes;
16
+ primaryLanguage: string;
17
+ supportedLanguages: string[];
18
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
19
+ error: Error | undefined;
20
+ }, {
21
+ GET_ENTRY_URI_ERROR(draft: import("@reduxjs/toolkit").WritableDraft<{
22
+ currentLanguage: string;
23
+ dictionary: LocaleDictionary;
24
+ locales: {
25
+ [language: string]: any;
26
+ };
27
+ routes: LocaleRoutes;
28
+ primaryLanguage: string;
29
+ supportedLanguages: string[];
30
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
31
+ error: Error | undefined;
32
+ }>, { payload }: PayloadAction<Error>): void;
33
+ INIT_LOCALES(draft: import("@reduxjs/toolkit").WritableDraft<{
34
+ currentLanguage: string;
35
+ dictionary: LocaleDictionary;
36
+ locales: {
37
+ [language: string]: any;
38
+ };
39
+ routes: LocaleRoutes;
40
+ primaryLanguage: string;
41
+ supportedLanguages: string[];
42
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
43
+ error: Error | undefined;
44
+ }>, { payload, }: PayloadAction<{
45
+ locales: Locales;
46
+ routes: LocaleRoutes;
47
+ } & I18nAppConfig>): void;
48
+ SET_LANGUAGE(draft: import("@reduxjs/toolkit").WritableDraft<{
49
+ currentLanguage: string;
50
+ dictionary: LocaleDictionary;
51
+ locales: {
52
+ [language: string]: any;
53
+ };
54
+ routes: LocaleRoutes;
55
+ primaryLanguage: string;
56
+ supportedLanguages: string[];
57
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
58
+ error: Error | undefined;
59
+ }>, { payload, }: PayloadAction<{
60
+ language: string;
61
+ dictionary: LocaleDictionary;
62
+ redirect?: string;
63
+ }>): void;
64
+ SET_LOCALES(draft: import("@reduxjs/toolkit").WritableDraft<{
65
+ currentLanguage: string;
66
+ dictionary: LocaleDictionary;
67
+ locales: {
68
+ [language: string]: any;
69
+ };
70
+ routes: LocaleRoutes;
71
+ primaryLanguage: string;
72
+ supportedLanguages: string[];
73
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
74
+ error: Error | undefined;
75
+ }>, { payload, }: PayloadAction<{
76
+ locales: Locales;
77
+ } & I18nAppConfig>): void;
78
+ /** UPDATE_LANGUAGE action triggers updateLanguage saga and ends with SET_LANGUAGE */
79
+ UPDATE_LANGUAGE(_draft: import("@reduxjs/toolkit").WritableDraft<{
80
+ currentLanguage: string;
81
+ dictionary: LocaleDictionary;
82
+ locales: {
83
+ [language: string]: any;
84
+ };
85
+ routes: LocaleRoutes;
86
+ primaryLanguage: string;
87
+ supportedLanguages: string[];
88
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
89
+ error: Error | undefined;
90
+ }>, _: PayloadAction<UpdateLanguageActionPayload>): void;
91
+ }, "i18n", "i18n", import("@reduxjs/toolkit").SliceSelectors<{
92
+ currentLanguage: string;
93
+ dictionary: LocaleDictionary;
94
+ locales: {
95
+ [language: string]: any;
96
+ };
97
+ routes: LocaleRoutes;
98
+ primaryLanguage: string;
99
+ supportedLanguages: string[];
100
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
101
+ error: Error | undefined;
102
+ }>>;
103
+ export declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
104
+ GET_ENTRY_URI_ERROR(draft: import("@reduxjs/toolkit").WritableDraft<{
105
+ currentLanguage: string;
106
+ dictionary: LocaleDictionary;
107
+ locales: {
108
+ [language: string]: any;
109
+ };
110
+ routes: LocaleRoutes;
111
+ primaryLanguage: string;
112
+ supportedLanguages: string[];
113
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
114
+ error: Error | undefined;
115
+ }>, { payload }: PayloadAction<Error>): void;
116
+ INIT_LOCALES(draft: import("@reduxjs/toolkit").WritableDraft<{
117
+ currentLanguage: string;
118
+ dictionary: LocaleDictionary;
119
+ locales: {
120
+ [language: string]: any;
121
+ };
122
+ routes: LocaleRoutes;
123
+ primaryLanguage: string;
124
+ supportedLanguages: string[];
125
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
126
+ error: Error | undefined;
127
+ }>, { payload, }: PayloadAction<{
128
+ locales: Locales;
129
+ routes: LocaleRoutes;
130
+ } & I18nAppConfig>): void;
131
+ SET_LANGUAGE(draft: import("@reduxjs/toolkit").WritableDraft<{
132
+ currentLanguage: string;
133
+ dictionary: LocaleDictionary;
134
+ locales: {
135
+ [language: string]: any;
136
+ };
137
+ routes: LocaleRoutes;
138
+ primaryLanguage: string;
139
+ supportedLanguages: string[];
140
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
141
+ error: Error | undefined;
142
+ }>, { payload, }: PayloadAction<{
143
+ language: string;
144
+ dictionary: LocaleDictionary;
145
+ redirect?: string;
146
+ }>): void;
147
+ SET_LOCALES(draft: import("@reduxjs/toolkit").WritableDraft<{
148
+ currentLanguage: string;
149
+ dictionary: LocaleDictionary;
150
+ locales: {
151
+ [language: string]: any;
152
+ };
153
+ routes: LocaleRoutes;
154
+ primaryLanguage: string;
155
+ supportedLanguages: string[];
156
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
157
+ error: Error | undefined;
158
+ }>, { payload, }: PayloadAction<{
159
+ locales: Locales;
160
+ } & I18nAppConfig>): void;
161
+ /** UPDATE_LANGUAGE action triggers updateLanguage saga and ends with SET_LANGUAGE */
162
+ UPDATE_LANGUAGE(_draft: import("@reduxjs/toolkit").WritableDraft<{
163
+ currentLanguage: string;
164
+ dictionary: LocaleDictionary;
165
+ locales: {
166
+ [language: string]: any;
167
+ };
168
+ routes: LocaleRoutes;
169
+ primaryLanguage: string;
170
+ supportedLanguages: string[];
171
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
172
+ error: Error | undefined;
173
+ }>, _: PayloadAction<UpdateLanguageActionPayload>): void;
174
+ }, "i18n">, reducer: import("../../../node_modules/redux").Reducer<{
175
+ currentLanguage: string;
176
+ dictionary: LocaleDictionary;
177
+ locales: {
178
+ [language: string]: any;
179
+ };
180
+ routes: LocaleRoutes;
181
+ primaryLanguage: string;
182
+ supportedLanguages: string[];
183
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
184
+ error: Error | undefined;
185
+ }>, getInitialState: () => {
186
+ currentLanguage: string;
187
+ dictionary: LocaleDictionary;
188
+ locales: {
189
+ [language: string]: any;
190
+ };
191
+ routes: LocaleRoutes;
192
+ primaryLanguage: string;
193
+ supportedLanguages: string[];
194
+ resolver: ((language: string) => Promise<LocaleDictionary> | LocaleDictionary) | undefined;
195
+ error: Error | undefined;
196
+ };
197
+ export declare const updateLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<UpdateLanguageActionPayload, "i18n/UPDATE_LANGUAGE">;
198
+ export default i18nSlice;
@@ -0,0 +1,8 @@
1
+ import type { AppRoutes } from "../models";
2
+ export declare const deparameterise: (path: string) => string;
3
+ /** Create static routes for routes with specified locales */
4
+ export declare const createLocaleRoutes: (routes: AppRoutes) => {
5
+ [originalPath: string]: {
6
+ [locale: string]: string;
7
+ };
8
+ };
@@ -0,0 +1,20 @@
1
+ import { UpdateLanguageActionPayload } from './redux/slice';
2
+ import { LocaleDictionary } from "../models/Locales";
3
+ type FlattenObjectKeys<T extends Record<string, unknown>, Key = keyof T> = string extends Key ? string : Key extends string ? T[Key] extends Record<string, unknown> ? `${Key}.${FlattenObjectKeys<T[Key]>}` : `${Key}` : never;
4
+ export declare const useI18n: <Dictionary extends LocaleDictionary = LocaleDictionary>() => {
5
+ /** The language that is currently active */
6
+ currentLanguage: string;
7
+ /** The dictionary loaded for the current language / locale */
8
+ dictionary: Dictionary;
9
+ /** The locales from the redux store */
10
+ locales: {
11
+ [language: string]: any;
12
+ };
13
+ /** Localised routes (paths) from the redux store */
14
+ routes: import("../models/Locales").LocaleRoutes;
15
+ /** A function to translate keys into localized strings supporting nested keys supplied with dot notation */
16
+ translate: (key: FlattenObjectKeys<Dictionary>, defaultValue?: string) => string;
17
+ /** A function that dispatches a redux action to update the current language */
18
+ updateLanguage: (language: string, { fallbackPath, redirect, }?: Omit<UpdateLanguageActionPayload, "language">) => void;
19
+ };
20
+ export {};
package/models/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./models";
2
2
  export { default as linkDepthApi } from "./server/features/linkdepth-api/api";
3
+ export { subsiteDebugMiddleware as DO_NOT_COMMIT_subsiteDebugMiddleware } from "./server/middleware/subsiteDebug";
3
4
  import internalServer from "./server/internalServer";
4
5
  export { default as ReactApp } from "./app/App";
5
6
  export default internalServer;
@@ -1,8 +1,10 @@
1
1
  import { VersionStatus } from 'contensis-core-api';
2
2
  import { Entry, Node } from 'contensis-delivery-api';
3
3
  import { Group, User } from 'contensis-management-api';
4
+ import { getInitialState } from "../i18n/redux/slice";
4
5
  import { StaticRoute, MatchedRoute } from "./";
5
6
  export type AppState = {
7
+ i18n: ReturnType<typeof getInitialState>;
6
8
  navigation: {
7
9
  root: Node | null;
8
10
  isError: boolean;
@@ -4,6 +4,7 @@ import { ReduxInjector } from './ReduxInjector';
4
4
  import { RouteComponent } from './RouteComponent';
5
5
  import { RouteComponentProps } from './RouteComponentProps';
6
6
  import { RequireLogin } from './RequireLogin';
7
+ import { SearchRouteOptions } from "../search/models/SearchActions";
7
8
  export type ContentTypeMapping = {
8
9
  /** The unique identifier for the content type to map. */
9
10
  contentTypeID: string;
@@ -86,4 +87,8 @@ export type ContentTypeMapping = {
86
87
  * Specifies whether login is required to access the content for this type.
87
88
  */
88
89
  requireLogin?: RequireLogin;
90
+ /**
91
+ * Triggers the loading of relevant search assets
92
+ */
93
+ searchOptions?: SearchRouteOptions;
89
94
  };
@@ -0,0 +1,11 @@
1
+ export type Locales = {
2
+ [language: string]: any;
3
+ };
4
+ export type LocaleRoutes = {
5
+ [originalPath: string]: {
6
+ [locale: string]: string;
7
+ };
8
+ };
9
+ export type LocaleDictionary = {
10
+ [key: string]: any;
11
+ };
@@ -1,4 +1,8 @@
1
1
  import type { RouteObject, RouteMatch } from 'react-router';
2
- export type MatchedRoute<ParamKey extends string = string, TRouteObject extends RouteObject = RouteObject> = Omit<RouteMatch<ParamKey>, 'route'> & {
2
+ type RouteObjectAllowingExtraProps = RouteObject & {
3
+ [propName: string]: any;
4
+ };
5
+ export type MatchedRoute<ParamKey extends string = string, TRouteObject extends RouteObjectAllowingExtraProps = RouteObjectAllowingExtraProps> = Omit<RouteMatch<ParamKey>, 'route'> & {
3
6
  route: TRouteObject;
4
7
  };
8
+ export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { LoadableComponent } from '@loadable/component';
3
2
  import { RouteComponentProps } from './RouteComponentProps';
4
3
  export type RouteComponent<Props> = LoadableComponent<RouteComponentProps> | React.ComponentType<Props>;
@@ -1,12 +1,12 @@
1
1
  import { Request, Response } from 'express';
2
2
  import { Dispatch } from "../../node_modules/redux";
3
3
  import { CookieHelper } from "../user/util/CookieHelper.class";
4
- import { cachedSearchWithCookies } from "../util";
4
+ import { CachedSearch } from "../util/CachedDeliveryApi";
5
5
  export type SSRContext = {
6
6
  /** SSR only */
7
7
  accessMethod?: SSRAccessMethod;
8
8
  /** Available in both SSR and client side */
9
- api: ReturnType<typeof cachedSearchWithCookies>;
9
+ api: CachedSearch;
10
10
  /** Available in both SSR and client side */
11
11
  cookies: CookieHelper;
12
12
  /** Available in both SSR and client side */
@@ -15,8 +15,8 @@ export type SSRContext = {
15
15
  request?: Request;
16
16
  /** SSR only */
17
17
  response?: Response;
18
- /** SSR only */
19
- ssrAssets?: SSRAssets;
18
+ /** Available in both SSR and client side */
19
+ subsitePath?: string;
20
20
  };
21
21
  export type SSRAccessMethod = {
22
22
  DYNAMIC: boolean;
@@ -5,6 +5,7 @@ import { EntryMapper } from './EntryMapper';
5
5
  import { ReduxInjector } from './ReduxInjector';
6
6
  import { RequireLogin } from './RequireLogin';
7
7
  import type { RouteObject } from 'react-router';
8
+ import { SearchRouteOptions } from "../search/models/SearchActions";
8
9
  export type StaticRoute = Omit<RouteObject, 'children'> & {
9
10
  index?: false | undefined;
10
11
  children?: StaticRoute[];
@@ -56,6 +57,16 @@ export type StaticRoute = Omit<RouteObject, 'children'> & {
56
57
  * Specifies whether login is required to access the content for this type.
57
58
  */
58
59
  requireLogin?: RequireLogin;
60
+ /**
61
+ * Triggers the loading of the relevant search assets
62
+ */
63
+ searchOptions?: SearchRouteOptions;
59
64
  ssr?: boolean;
60
65
  ssrOnly?: boolean;
66
+ /** Specify localised paths for different language codes, e.g. { 'en-GB': '/path', 'fr-FR': '/chemin' } */
67
+ i18n?: {
68
+ [languageCode: string]: string;
69
+ };
70
+ /** The language code for this route, e.g. 'en-GB' */
71
+ language?: string;
61
72
  };
@@ -1,10 +1,15 @@
1
1
  import { FieldLinkDepths } from 'contensis-core-api';
2
2
  import { Entry } from 'contensis-delivery-api';
3
+ import { ContentTypeMapping } from './ContentTypeMapping';
3
4
  import { GetRouteActionArgs } from './GetRouteActionArgs';
4
5
  import { RequireLogin } from './RequireLogin';
6
+ import { SearchParams, SearchRouteOptions } from "../search/models/SearchActions";
5
7
  export type OnRouteLoadArgs = Omit<GetRouteActionArgs, 'withEvents'>;
6
8
  export type OnRouteLoadedArgs = OnRouteLoadArgs & {
9
+ contentTypeRoute?: ContentTypeMapping;
7
10
  entry?: Entry | any;
11
+ params: SearchParams;
12
+ searchOptions?: SearchRouteOptions;
8
13
  };
9
14
  /**
10
15
  * Configuration options to customize the app state during route changes.
@@ -50,6 +55,9 @@ export type RouteLoadOptions = {
50
55
  refetchNode?: true;
51
56
  };
52
57
  export type RouteLoadedOptions = {
58
+ searchOptions?: SearchRouteOptions & {
59
+ onPaths?: string[];
60
+ };
53
61
  requireLogin?: RequireLogin;
54
62
  };
55
63
  export type WithEvents = {
@@ -1,7 +1,9 @@
1
1
  import { AppRoutes } from '../AppRouteProps';
2
2
  import { WithEvents } from '../WithEvents';
3
+ import { I18nAppConfig } from './I18n';
3
4
  import { StateType } from './StateType';
4
5
  export type AppConfig = {
6
+ i18n?: I18nAppConfig;
5
7
  /** @deprecated Immutable.js library is deprecated and may be removed in future versions. A plain js (and immutable) state is provided by immer package by default */
6
8
  stateType?: StateType;
7
9
  routes: AppRoutes;
@@ -0,0 +1,38 @@
1
+ import { LocaleDictionary, Locales } from '../Locales';
2
+ export type I18nAppConfig<L extends Locales = Locales> = {
3
+ /** The primary language code for the application */
4
+ primaryLanguage: string;
5
+ /** Provide the supported language codes using the same casing convention as Contensis
6
+ * ```ts
7
+ * supportedLanguages: ['cy', 'en-GB', 'fr-FR', 'de-DE']
8
+ * ```
9
+ * Use an empty array to fetch supported languages from the Contensis Project
10
+ * ```ts
11
+ * supportedLanguages: []
12
+ * ``` */
13
+ supportedLanguages: string[];
14
+ /** Supply static locales if not using the resolver
15
+ *
16
+ * ```ts
17
+ * locales: {
18
+ * 'en-GB': { title: 'Hello World' },
19
+ * 'fr-FR': { title: 'Bonjour le monde' },
20
+ * }
21
+ * ```
22
+ */
23
+ locales?: L;
24
+ /** Handle dynamic import of locale dictionaries
25
+ *
26
+ * ```ts
27
+ * // Example: Each language is in its own file in `~/locales/`,
28
+ * // is named using the language code e.g. `en-GB.ts`, `fr-FR.ts`
29
+ * // and has a default export
30
+ * resolver: (language: string) =>
31
+ * import(
32
+ * // webpackChunkName: "locale.[request]"
33
+ * `~/locales/${language}`
34
+ * ).then(({ default: dictionary }) => dictionary)
35
+ * ```
36
+ */
37
+ resolver?: (language: string) => Promise<LocaleDictionary> | LocaleDictionary;
38
+ };
@@ -17,7 +17,10 @@ export type ServerConfig = AppConfig & {
17
17
  startup?: string;
18
18
  };
19
19
  staticFolderPath?: string;
20
+ /** The default static route path */
20
21
  staticRoutePath?: string;
22
+ /** Additional static route paths */
23
+ staticRoutePaths?: string[];
21
24
  stats?: string;
22
25
  templates: {
23
26
  html: string;
@@ -1,6 +1,7 @@
1
1
  export { action, getJS, getImmutableOrJS as getIn } from './util';
2
2
  export { reduxStore as store } from './store/store';
3
- export { convertSagaArray, injectRedux, injectReducer, injectSaga, useInjectRedux, } from './store/injectors';
3
+ export { injectReducer, injectSaga } from './store/injectors/inject';
4
+ export { injectRedux, useInjectRedux } from './store/injectors/index';
4
5
  export declare const navigation: {
5
6
  types: typeof import("./types/navigation");
6
7
  actions: typeof import("./actions/navigation");
@@ -1 +1,3 @@
1
- export default function _default(featureSagas?: any[]): () => Generator<import("redux-saga/effects").AllEffect<any>, void, unknown>;
1
+ import { Effect } from 'redux-saga/effects';
2
+ declare const _default: (featureSagas?: Effect[]) => Effect<any, any>[];
3
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export declare function reduxInjectorSaga(injectorFn: () => Promise<{
2
+ key: string;
3
+ reducer: any;
4
+ saga: any;
5
+ }>): Generator<Promise<{
6
+ key: string;
7
+ reducer: any;
8
+ saga: any;
9
+ }>, void, {
10
+ key: any;
11
+ reducer: any;
12
+ saga: any;
13
+ }>;
@@ -0,0 +1,26 @@
1
+ import { Reducer } from "../../../../node_modules/redux";
2
+ import { Effect } from 'redux-saga/effects';
3
+ export declare const injectRedux: ({ key, reducer, saga }: {
4
+ key: string;
5
+ reducer?: Reducer;
6
+ saga?: Effect[];
7
+ }, store?: import("../../../../node_modules/redux").Store<import("../../..").AppState, import("../../../../node_modules/redux").Action, unknown> & {
8
+ runSaga: (sagas: Effect[] | (() => Generator)) => import("redux-saga").Task;
9
+ close: () => void;
10
+ initialSagas: Set<any>;
11
+ injectedReducers: any;
12
+ injectedSagas: any;
13
+ createReducer: (injectedReducers?: any) => Reducer<import("../../..").AppState>;
14
+ }) => void;
15
+ export declare const useInjectRedux: ({ key, reducer, saga }: {
16
+ key: string;
17
+ reducer?: Reducer;
18
+ saga?: Effect[];
19
+ }, store?: import("../../../../node_modules/redux").Store<import("../../..").AppState, import("../../../../node_modules/redux").Action, unknown> & {
20
+ runSaga: (sagas: Effect[] | (() => Generator)) => import("redux-saga").Task;
21
+ close: () => void;
22
+ initialSagas: Set<any>;
23
+ injectedReducers: any;
24
+ injectedSagas: any;
25
+ createReducer: (injectedReducers?: any) => Reducer<import("../../..").AppState>;
26
+ }) => void;
@@ -0,0 +1,24 @@
1
+ import { Reducer } from "../../../../node_modules/redux";
2
+ import { Effect } from 'redux-saga/effects';
3
+ export declare const injectReducer: ({ key, reducer }: {
4
+ key: string;
5
+ reducer: Reducer;
6
+ }, store?: import("../../../../node_modules/redux").Store<import("../../..").AppState, import("../../../../node_modules/redux").Action, unknown> & {
7
+ runSaga: (sagas: Effect[] | (() => Generator)) => import("redux-saga").Task;
8
+ close: () => void;
9
+ initialSagas: Set<any>;
10
+ injectedReducers: any;
11
+ injectedSagas: any;
12
+ createReducer: (injectedReducers?: any) => Reducer<import("../../..").AppState>;
13
+ }) => void;
14
+ export declare const injectSaga: ({ key, saga }: {
15
+ key: string;
16
+ saga: Effect[];
17
+ }, store?: import("../../../../node_modules/redux").Store<import("../../..").AppState, import("../../../../node_modules/redux").Action, unknown> & {
18
+ runSaga: (sagas: Effect[] | (() => Generator)) => import("redux-saga").Task;
19
+ close: () => void;
20
+ initialSagas: Set<any>;
21
+ injectedReducers: any;
22
+ injectedSagas: any;
23
+ createReducer: (injectedReducers?: any) => Reducer<import("../../..").AppState>;
24
+ }) => void;
@@ -0,0 +1,2 @@
1
+ import { Effect } from 'redux-saga/effects';
2
+ export declare const wrapSagasInGenerator: (sagas: Effect[] | (() => Generator)) => () => Generator;
@@ -1,12 +1,21 @@
1
- import { Action, Store } from "../../../node_modules/redux";
2
- import createSagaMiddleware from 'redux-saga';
3
- import { AppState, StateType } from "../../models";
4
1
  import { History, MemoryHistory } from 'history';
2
+ import { Action, Store, Reducer } from "../../../node_modules/redux";
3
+ import { Task } from 'redux-saga';
4
+ import { Effect } from 'redux-saga/effects';
5
+ import { AppState, StateType } from "../../models";
5
6
  type ReduxAppStore = Store<AppState, Action>;
7
+ type PatchedRunSaga = (sagas: Effect[] | (() => Generator)) => Task;
6
8
  type ReduxSagaAppStore = ReduxAppStore & {
7
- runSaga: ReturnType<typeof createSagaMiddleware>['run'];
9
+ runSaga: PatchedRunSaga;
8
10
  close: () => void;
11
+ initialSagas: Set<any>;
12
+ injectedReducers: any;
13
+ injectedSagas: any;
14
+ createReducer: (injectedReducers?: any) => Reducer<AppState>;
9
15
  };
16
+ /** A no-op reducer to serve for server-rendered reducers
17
+ * that are re-injected client-side */
18
+ export declare const stubReducer: (state?: null) => null;
10
19
  export declare let reduxStore: ReduxSagaAppStore;
11
20
  declare const _default: (featureReducers: any, initialState: AppState, history: History | MemoryHistory, stateType: StateType) => Promise<ReduxSagaAppStore>;
12
21
  export default _default;
@@ -1,3 +1,3 @@
1
1
  export declare const action: (type: string, payload?: any) => any;
2
2
  export declare const getJS: <S extends Record<string, unknown>, T extends keyof S>(state: S, stateKey: T) => S[T];
3
- export declare const getImmutableOrJS: <S extends Record<string, unknown>, T extends unknown>(state: S, stateKey: T | T[], fallbackValue?: any, returnType?: 'immutable' | 'js') => any;
3
+ export declare const getImmutableOrJS: <S extends Record<string, unknown>, T extends keyof S | any>(state: S, stateKey: T | T[], fallbackValue?: any, returnType?: "immutable" | "js") => any;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
2
- import { AppRootProps, RouteLoaderProps } from "../../models";
3
- declare const _default: (props: AppRootProps & RouteLoaderProps) => JSX.Element;
1
+ import React from 'react';
2
+ import type { AppRootProps, RouteLoaderProps } from "../../models";
3
+ declare const _default: (props: AppRootProps & RouteLoaderProps) => React.JSX.Element;
4
4
  export default _default;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type HttpContextValues = {
3
2
  statusCode?: number;
4
3
  url?: string;
@@ -5,3 +5,4 @@ export { useHttpContext } from './httpContext';
5
5
  export { Redirect } from './components/Redirect';
6
6
  export { Status } from './components/Status';
7
7
  export { default as RouteLoader } from './components/RouteLoader';
8
+ export { routeParams } from '../search/search/util';
@@ -1,7 +1,7 @@
1
1
  import { useLocation } from 'react-router-dom';
2
2
  import { Entry } from 'contensis-delivery-api/lib/models';
3
3
  import { AppRoutes, MatchedRoute, StaticRoute, SSRContext, WithEvents } from "../../models";
4
- export declare const setNavigationPath: (path: string, location: ReturnType<typeof useLocation>, staticRoute: MatchedRoute<string, StaticRoute> | undefined, withEvents: WithEvents, statePath: string, routes: AppRoutes, ssr: SSRContext) => any;
4
+ export declare const setNavigationPath: (path: string, contentPath: string, location: ReturnType<typeof useLocation>, staticRoute: MatchedRoute<string, StaticRoute> | undefined, withEvents: WithEvents, statePath: string, routes: AppRoutes, ssr: SSRContext) => any;
5
5
  export declare const setCurrentProject: (project: string, allowedGroups: any, hostname: string) => any;
6
6
  export declare const setRoute: (path: string, state?: any) => any;
7
7
  export declare const setRouteEntry: (entry: Entry) => any;
@@ -0,0 +1,22 @@
1
+ import { OnRouteLoadedArgs, RouteLoadedOptions } from "../../models";
2
+ import { SearchRouteOptions } from "../../search/models/SearchActions";
3
+ /**
4
+ * Invokes the Search saga if:
5
+ * - `searchOptions` is present on `staticRoute` or `contentTypeRoute`
6
+ * - `searchOptions` is provided by the consumer app
7
+ * - and path starts with one of `onPaths: ['/search']`
8
+ * - or a `facet` or `listingType` is present in provided `searchOptions`
9
+ *
10
+ * A `config` is required if we want to inject the redux reducer here, sagas are injected automatically
11
+ */
12
+ export declare function handleSearchSaga({ location, params, routeSearchOptions, searchOptions, ssr, }: OnRouteLoadedArgs & RouteLoadedOptions & {
13
+ routeSearchOptions: SearchRouteOptions;
14
+ }): Generator<import("redux-saga/effects").CallEffect<void> | Promise<typeof import("../../search")> | import("redux-saga/effects").CallEffect<Generator<Promise<{
15
+ key: string;
16
+ reducer: any;
17
+ saga: any;
18
+ }>, void, {
19
+ key: any;
20
+ reducer: any;
21
+ saga: any;
22
+ }>>, void, typeof import("../../search")>;