orc-shared 1.2.0-dev.1 → 1.2.0-dev.13

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 (227) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/dist/actions/applications.js +1 -1
  4. package/dist/actions/authentication.js +1 -1
  5. package/dist/actions/countries.js +1 -1
  6. package/dist/actions/locale.js +1 -1
  7. package/dist/actions/makeApiAction.js +3 -3
  8. package/dist/actions/makeOrcApiAction.js +2 -2
  9. package/dist/actions/metadata.js +3 -3
  10. package/dist/actions/modules.js +63 -1
  11. package/dist/actions/navigation.js +3 -3
  12. package/dist/actions/requestsApi.js +8 -8
  13. package/dist/actions/scopes.js +59 -22
  14. package/dist/actions/timezones.js +1 -1
  15. package/dist/actions/toasts.js +1 -1
  16. package/dist/actions/versionInfo.js +1 -1
  17. package/dist/actions/view.js +1 -1
  18. package/dist/buildStore.js +3 -3
  19. package/dist/components/AppFrame/About.js +11 -6
  20. package/dist/components/AppFrame/MenuItem.js +6 -15
  21. package/dist/components/AppFrame/Preferences.js +3 -3
  22. package/dist/components/AppFrame/Sidebar.js +20 -9
  23. package/dist/components/AppFrame/Topbar.js +1 -1
  24. package/dist/components/ApplicationModuleLoader.js +143 -0
  25. package/dist/components/Authenticate.js +13 -13
  26. package/dist/components/CategoryList.js +1 -1
  27. package/dist/components/Checkbox.js +1 -1
  28. package/dist/components/DropMenu/Menu.js +1 -1
  29. package/dist/components/DropMenu/index.js +1 -1
  30. package/dist/components/Form/FieldList.js +3 -3
  31. package/dist/components/Form/Form.js +1 -1
  32. package/dist/components/Form/Inputs/Button.js +1 -1
  33. package/dist/components/Form/Inputs/FieldButtons.js +1 -1
  34. package/dist/components/Form/Inputs/Number.js +1 -1
  35. package/dist/components/Form/Inputs/ReadOnly.js +1 -1
  36. package/dist/components/Form/Inputs/SmallButton.js +1 -1
  37. package/dist/components/Form/Inputs/Text.js +1 -1
  38. package/dist/components/Form/Inputs/Time.js +1 -1
  39. package/dist/components/Form/Inputs/Toggles.js +1 -1
  40. package/dist/components/Form/Inputs/Translation.js +3 -3
  41. package/dist/components/List/HeadCell.js +1 -1
  42. package/dist/components/List/List.js +1 -1
  43. package/dist/components/List/Row.js +1 -1
  44. package/dist/components/List/enhanceColumnDefs.js +2 -2
  45. package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
  46. package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
  47. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +1 -1
  48. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +3 -3
  49. package/dist/components/MaterialUI/DataDisplay/Table.js +1 -1
  50. package/dist/components/MaterialUI/DataDisplay/TableProps.js +1 -1
  51. package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  52. package/dist/components/MaterialUI/DataDisplay/chipProps.js +1 -1
  53. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +1 -1
  54. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +1 -1
  55. package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
  56. package/dist/components/MaterialUI/DataDisplay/modalProps.js +1 -1
  57. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +3 -3
  58. package/dist/components/MaterialUI/Feedback/useNotification.js +1 -1
  59. package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
  60. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +1 -1
  61. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +1 -1
  62. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +1 -1
  63. package/dist/components/MaterialUI/Inputs/InputBase.js +42 -5
  64. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -1
  65. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  66. package/dist/components/MaterialUI/Inputs/RadioProps.js +1 -1
  67. package/dist/components/MaterialUI/Inputs/Select.js +2 -2
  68. package/dist/components/MaterialUI/Inputs/SelectProps.js +1 -1
  69. package/dist/components/MaterialUI/Inputs/Switch.js +3 -3
  70. package/dist/components/MaterialUI/Inputs/SwitchProps.js +1 -1
  71. package/dist/components/MaterialUI/Inputs/TimePicker.js +1 -1
  72. package/dist/components/MaterialUI/Inputs/createInput.js +3 -3
  73. package/dist/components/MaterialUI/Inputs/index.js +1 -1
  74. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +1 -1
  75. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +1 -1
  76. package/dist/components/MaterialUI/Navigation/ExternalLink.js +113 -0
  77. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +8 -2
  78. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +1 -1
  79. package/dist/components/MaterialUI/Surfaces/paperProps.js +1 -1
  80. package/dist/components/MaterialUI/muiThemes.js +7 -2
  81. package/dist/components/MaterialUI/textProps.js +1 -1
  82. package/dist/components/Modules.js +126 -41
  83. package/dist/components/MultiSelector.js +1 -1
  84. package/dist/components/Navigation/Bar.js +3 -3
  85. package/dist/components/Navigation/Tab.js +1 -1
  86. package/dist/components/Navigation/useNavigationState.js +3 -3
  87. package/dist/components/Placeholder.js +1 -1
  88. package/dist/components/Routing/FullPage.js +3 -1
  89. package/dist/components/Routing/Page.js +5 -3
  90. package/dist/components/Routing/Segment.js +1 -1
  91. package/dist/components/Routing/SegmentPage.js +1 -1
  92. package/dist/components/Routing/withWaypointing.js +8 -4
  93. package/dist/components/Scope/ScopeNode.js +1 -1
  94. package/dist/components/Scope/Selector.js +1 -1
  95. package/dist/components/Scope/index.js +3 -3
  96. package/dist/components/Scope/useScopeConfirmationModalState.js +7 -16
  97. package/dist/components/Scope/useScopeData.js +4 -13
  98. package/dist/components/Scope/useScopeSelect.js +1 -1
  99. package/dist/components/Selector.js +1 -1
  100. package/dist/components/Spritesheet.js +1 -1
  101. package/dist/components/Switch.js +1 -1
  102. package/dist/components/Text.js +1 -1
  103. package/dist/components/ToastList.js +1 -1
  104. package/dist/components/Toolbar.js +1 -1
  105. package/dist/components/Treeview/Label.js +1 -1
  106. package/dist/components/Treeview/Leaf.js +1 -1
  107. package/dist/components/Treeview/Node.js +3 -3
  108. package/dist/components/Treeview/index.js +2 -2
  109. package/dist/components/Treeview/settings.js +1 -1
  110. package/dist/constants.js +19 -2
  111. package/dist/content/icons/lock.svg +3 -0
  112. package/dist/content/icons/orckestra-icon.svg +5 -0
  113. package/dist/content/icons/unlock.svg +3 -0
  114. package/dist/content/iconsSheet.svg +11 -0
  115. package/dist/content/orckestra-logo-white.png +0 -0
  116. package/dist/getThemeOverrides.js +2 -2
  117. package/dist/hocs/withInfiniteScroll.js +1 -1
  118. package/dist/hocs/withUpdateHandler.js +2 -2
  119. package/dist/hooks/useDispatchWithModulesData.js +1 -1
  120. package/dist/hooks/useEditState.js +3 -3
  121. package/dist/hooks/useEntityLoader.js +2 -2
  122. package/dist/hooks/useFullEntityEditState.js +3 -3
  123. package/dist/hooks/useLabelMessage.js +3 -3
  124. package/dist/hooks/useMultipleFieldEditState.js +2 -2
  125. package/dist/hooks/useNavigationHandler.js +1 -1
  126. package/dist/hooks/useNotificationRequestState.js +2 -2
  127. package/dist/hooks/useSelectorAndUnwrap.js +1 -1
  128. package/dist/reducers/metadata.js +1 -1
  129. package/dist/reducers/modules.js +39 -1
  130. package/dist/reducers/scopes.js +27 -0
  131. package/dist/reducers/settings.js +31 -2
  132. package/dist/schemas/countries.js +1 -1
  133. package/dist/schemas/definitions.js +1 -1
  134. package/dist/schemas/metadata.js +1 -1
  135. package/dist/schemas/productDefinitions.js +1 -1
  136. package/dist/schemas/timezones.js +1 -1
  137. package/dist/selectors/applications.js +1 -1
  138. package/dist/selectors/authentication.js +57 -18
  139. package/dist/selectors/countries.js +1 -1
  140. package/dist/selectors/locale.js +1 -1
  141. package/dist/selectors/metadata.js +16 -6
  142. package/dist/selectors/modules.js +15 -1
  143. package/dist/selectors/navigation.js +1 -1
  144. package/dist/selectors/requests.js +1 -1
  145. package/dist/selectors/scope.js +8 -1
  146. package/dist/selectors/settings.js +13 -1
  147. package/dist/selectors/versionInfo.js +1 -1
  148. package/dist/selectors/view.js +1 -1
  149. package/dist/spawnerMiddleware.js +1 -1
  150. package/dist/utils/displayModeHelper.js +1 -1
  151. package/dist/utils/flatten.js +2 -2
  152. package/dist/utils/localizationHelper.js +1 -1
  153. package/dist/utils/mapHelper.js +1 -1
  154. package/dist/utils/modelValidationHelper.js +1 -1
  155. package/dist/utils/parseHelper.js +1 -1
  156. package/dist/utils/propertyHelper.js +2 -2
  157. package/dist/utils/propertyValidator.js +1 -1
  158. package/dist/utils/setTranslation.js +27 -1
  159. package/dist/utils/setTranslationWithFallback.js +31 -2
  160. package/dist/utils/testUtils.js +2 -1
  161. package/dist/utils/unwrapImmutable.js +1 -1
  162. package/dist/utils/urlHelper.js +1 -1
  163. package/package.json +6 -5
  164. package/src/actions/modules.js +30 -0
  165. package/src/actions/modules.test.js +50 -1
  166. package/src/actions/scopes.js +33 -7
  167. package/src/actions/scopes.test.js +84 -14
  168. package/src/components/AppFrame/About.js +10 -3
  169. package/src/components/AppFrame/AppFrame.test.js +9 -0
  170. package/src/components/AppFrame/MenuItem.js +3 -5
  171. package/src/components/AppFrame/MenuItem.test.js +2 -24
  172. package/src/components/AppFrame/Sidebar.js +11 -12
  173. package/src/components/AppFrame/Sidebar.test.js +18 -0
  174. package/src/components/ApplicationModuleLoader.js +52 -0
  175. package/src/components/ApplicationModuleLoader.test.js +149 -0
  176. package/src/components/Authenticate.js +5 -4
  177. package/src/components/Authenticate.test.js +23 -4
  178. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +7 -1
  179. package/src/components/MaterialUI/Inputs/InputBase.js +19 -2
  180. package/src/components/MaterialUI/Inputs/InputBase.test.js +68 -0
  181. package/src/components/MaterialUI/Navigation/ExternalLink.js +25 -0
  182. package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
  183. package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +5 -1
  184. package/src/components/MaterialUI/muiThemes.js +5 -0
  185. package/src/components/Modules.js +103 -20
  186. package/src/components/Modules.test.js +315 -28
  187. package/src/components/Provision.test.js +34 -0
  188. package/src/components/Routing/FullPage.js +2 -1
  189. package/src/components/Routing/FullPage.test.js +23 -0
  190. package/src/components/Routing/Page.js +2 -2
  191. package/src/components/Routing/Page.test.js +20 -0
  192. package/src/components/Routing/Segment.js +1 -1
  193. package/src/components/Routing/withWaypointing.js +2 -2
  194. package/src/components/Routing/withWaypointing.test.js +33 -5
  195. package/src/components/Scope/Scope.test.js +4 -0
  196. package/src/components/Scope/useScopeConfirmationModalState.js +5 -16
  197. package/src/components/Scope/useScopeConfirmationModalState.test.js +39 -13
  198. package/src/components/Scope/useScopeData.js +0 -3
  199. package/src/components/Scope/useScopeData.test.js +0 -27
  200. package/src/constants.js +15 -0
  201. package/src/content/icons/lock.svg +3 -0
  202. package/src/content/icons/orckestra-icon.svg +5 -0
  203. package/src/content/icons/unlock.svg +3 -0
  204. package/src/content/iconsSheet.svg +11 -0
  205. package/src/content/orckestra-logo-white.png +0 -0
  206. package/src/hocs/withScopeData.test.js +0 -31
  207. package/src/reducers/modules.js +48 -2
  208. package/src/reducers/modules.test.js +117 -2
  209. package/src/reducers/scopes.js +30 -0
  210. package/src/reducers/scopes.test.js +45 -1
  211. package/src/reducers/settings.js +26 -2
  212. package/src/reducers/settings.test.js +74 -6
  213. package/src/selectors/authentication.js +53 -27
  214. package/src/selectors/authentication.test.js +600 -12
  215. package/src/selectors/metadata.js +18 -7
  216. package/src/selectors/metadata.test.js +221 -283
  217. package/src/selectors/modules.js +7 -0
  218. package/src/selectors/modules.test.js +16 -1
  219. package/src/selectors/scope.js +3 -1
  220. package/src/selectors/scope.test.js +5 -0
  221. package/src/selectors/settings.js +6 -0
  222. package/src/translations/en-US.json +1 -1
  223. package/src/translations/fr-CA.json +1 -1
  224. package/src/utils/setTranslation.js +16 -1
  225. package/src/utils/setTranslation.test.js +24 -0
  226. package/src/utils/setTranslationWithFallback.js +18 -1
  227. package/src/utils/setTranslationWithFallback.test.js +108 -0
@@ -96,4 +96,28 @@ describe("setTranslation", () => {
96
96
  hat: { name: "it-name" },
97
97
  }),
98
98
  ));
99
+
100
+ it("returns first not empty match by language if language-culture not found", () =>
101
+ expect(
102
+ setTranslation,
103
+ "when called with",
104
+ [
105
+ "en-US",
106
+ Immutable.fromJS({
107
+ hat: {
108
+ name: {
109
+ "en-CA": "",
110
+ "fr-CA": "fr CA name",
111
+ "en-GB": "en GB name",
112
+ "it-IT": "it-name",
113
+ },
114
+ },
115
+ }),
116
+ ["hat", "name"],
117
+ ],
118
+ "to equal",
119
+ Immutable.fromJS({
120
+ hat: { name: "en GB name" },
121
+ }),
122
+ ));
99
123
  });
@@ -2,7 +2,24 @@ import { flatten } from "./flatten";
2
2
 
3
3
  export const setTranslationWithFallbackValue = (locale, obj, fallbackValue, ...field) => {
4
4
  if (!obj) return obj;
5
- const value = obj.getIn(flatten([field, locale])) || fallbackValue || "";
5
+ let localeValue = obj.getIn(flatten([field, locale]));
6
+ if (!localeValue && locale.includes("-")) {
7
+ let fieldValue = obj.getIn(flatten([field]));
8
+ if (fieldValue) {
9
+ let fieldKeys = fieldValue.keys();
10
+ let language = locale.substring(0, locale.indexOf("-"));
11
+
12
+ for (let key of fieldKeys) {
13
+ if (key !== locale && key.startsWith(language)) {
14
+ localeValue = obj.getIn(flatten([field, key]));
15
+ if (localeValue) {
16
+ break;
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
22
+ const value = localeValue || fallbackValue || "";
6
23
  return obj.setIn(flatten([field]), value);
7
24
  };
8
25
 
@@ -147,4 +147,112 @@ describe("setTranslationWithFallbackValue", () => {
147
147
  "to equal",
148
148
  null,
149
149
  ));
150
+
151
+ it("returns value matched by language-culture when exist", () =>
152
+ expect(
153
+ setTranslationWithFallbackValue,
154
+ "when called with",
155
+ [
156
+ "en-US",
157
+ Immutable.fromJS({
158
+ hat: { name: { "en-US": "en-US Name", "en-GB": "en-GB Name" } },
159
+ }),
160
+ "fallbakValue",
161
+ ["hat", "name"],
162
+ ],
163
+ "to equal",
164
+ Immutable.fromJS({
165
+ hat: { name: "en-US Name" },
166
+ }),
167
+ ));
168
+
169
+ it("returns value matched by language when match by language-culture does not exist", () =>
170
+ expect(
171
+ setTranslationWithFallbackValue,
172
+ "when called with",
173
+ [
174
+ "en-US",
175
+ Immutable.fromJS({
176
+ hat: { name: { "en-GB": "en-GB Name" } },
177
+ }),
178
+ "fallbakValue",
179
+ ["hat", "name"],
180
+ ],
181
+ "to equal",
182
+ Immutable.fromJS({
183
+ hat: { name: "en-GB Name" },
184
+ }),
185
+ ));
186
+
187
+ it("returns first not empty value matched by language when match by language-culture does not exist", () =>
188
+ expect(
189
+ setTranslationWithFallbackValue,
190
+ "when called with",
191
+ [
192
+ "en-US",
193
+ Immutable.fromJS({
194
+ hat: { name: { "en-GB": "", "en-CA": "en-CA Name" } },
195
+ }),
196
+ "fallbakValue",
197
+ ["hat", "name"],
198
+ ],
199
+ "to equal",
200
+ Immutable.fromJS({
201
+ hat: { name: "en-CA Name" },
202
+ }),
203
+ ));
204
+
205
+ it("returns value fallback value when match by language-culture and language does not exist", () =>
206
+ expect(
207
+ setTranslationWithFallbackValue,
208
+ "when called with",
209
+ [
210
+ "en-GB",
211
+ Immutable.fromJS({
212
+ hat: { name: { "fr-CA": "fr-CA Name" } },
213
+ }),
214
+ "fallbakValue",
215
+ ["hat", "name"],
216
+ ],
217
+ "to equal",
218
+ Immutable.fromJS({
219
+ hat: { name: "fallbakValue" },
220
+ }),
221
+ ));
222
+
223
+ it("returns fallbak Value when field value is empty ", () =>
224
+ expect(
225
+ setTranslationWithFallbackValue,
226
+ "when called with",
227
+ [
228
+ "en-GB",
229
+ Immutable.fromJS({
230
+ hat: { name: {} },
231
+ }),
232
+ "fallbakValue",
233
+ ["hat", "name"],
234
+ ],
235
+ "to equal",
236
+ Immutable.fromJS({
237
+ hat: { name: "fallbakValue" },
238
+ }),
239
+ ));
240
+
241
+ it("returns fallbakValue when field is undefined ", () =>
242
+ expect(
243
+ setTranslationWithFallbackValue,
244
+ "when called with",
245
+ [
246
+ "en-GB",
247
+ Immutable.fromJS({
248
+ hat: { name: {} },
249
+ }),
250
+ "fallbakValue",
251
+ ["hat", "name2"],
252
+ ],
253
+ "to equal",
254
+ Immutable.fromJS({
255
+ hat: { name: {}, name2: "fallbakValue" },
256
+ }),
257
+ ));
150
258
  });