@verdaccio/ui-theme 6.0.0-6-next.9 → 6.0.0-6-next.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 (323) hide show
  1. package/.babelrc +1 -1
  2. package/.eslintrc +0 -15
  3. package/CHANGELOG.md +61 -0
  4. package/jest/api/packages.json +42 -0
  5. package/jest/jest.config.js +2 -2
  6. package/jest/server-handlers.ts +9 -0
  7. package/jest/server.ts +6 -0
  8. package/jest/setup-env.ts +18 -0
  9. package/jest/setup.ts +2 -7
  10. package/jest/unit/components/__mocks__/token.ts +0 -1
  11. package/jest/unit/components/store/login.ts +1 -0
  12. package/package.json +43 -33
  13. package/src/App/App.test.tsx +75 -51
  14. package/src/App/App.tsx +7 -42
  15. package/src/App/AppRoute.tsx +3 -16
  16. package/src/App/Footer/Footer.test.tsx +0 -1
  17. package/src/App/Footer/Footer.tsx +35 -22
  18. package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +208 -302
  19. package/src/App/Footer/styles.ts +2 -3
  20. package/src/App/Header/Header.test.tsx +53 -61
  21. package/src/App/Header/Header.tsx +13 -24
  22. package/src/App/Header/HeaderGreetings.tsx +0 -1
  23. package/src/App/Header/HeaderLeft.tsx +0 -1
  24. package/src/App/Header/HeaderMenu.tsx +6 -6
  25. package/src/App/Header/HeaderRight.tsx +1 -2
  26. package/src/App/Header/HeaderToolTip.tsx +0 -1
  27. package/src/App/Header/HeaderToolTipIcon.tsx +10 -10
  28. package/src/App/Header/LanguageSwitch.tsx +17 -79
  29. package/src/App/Header/LoginDialog/LoginDialog.test.tsx +25 -35
  30. package/src/App/Header/LoginDialog/LoginDialog.tsx +28 -46
  31. package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +1 -2
  32. package/src/App/Header/LoginDialog/LoginDialogForm.tsx +0 -1
  33. package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +1 -2
  34. package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +4 -4
  35. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -3
  36. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +9 -10
  37. package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +1 -2
  38. package/src/App/Header/RegistryInfoDialog/styles.ts +0 -1
  39. package/src/App/Header/Search/Search.test.tsx +48 -43
  40. package/src/App/Header/Search/Search.tsx +23 -108
  41. package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +392 -28
  42. package/src/App/Header/styles.ts +2 -3
  43. package/src/App/index.ts +0 -1
  44. package/src/App/utils/loadable.tsx +3 -1
  45. package/src/components/ActionBar/ActionBar.test.tsx +13 -14
  46. package/src/components/ActionBar/ActionBar.tsx +0 -2
  47. package/src/components/ActionBar/ActionBarAction.tsx +11 -14
  48. package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +198 -53
  49. package/src/components/AppBar.tsx +1 -1
  50. package/src/components/Author/Author.test.tsx +1 -4
  51. package/src/components/Author/Author.tsx +2 -4
  52. package/src/components/Author/__snapshots__/Author.test.tsx.snap +804 -48
  53. package/src/components/Author/styles.ts +0 -1
  54. package/src/components/AutoComplete/AutoComplete.tsx +85 -163
  55. package/src/components/AutoComplete/AutoCompleteV2.tsx +8 -10
  56. package/src/components/AutoComplete/styles.tsx +0 -15
  57. package/src/components/Avatar.tsx +1 -1
  58. package/src/components/Box.tsx +1 -1
  59. package/src/components/Button.tsx +1 -1
  60. package/src/components/Card.tsx +1 -1
  61. package/src/components/CardActions.tsx +1 -1
  62. package/src/components/CardContent.tsx +1 -1
  63. package/src/components/Chip.tsx +1 -1
  64. package/src/components/CircularProgress.tsx +2 -2
  65. package/src/components/CopyToClipBoard.tsx +2 -3
  66. package/src/components/Dialog.tsx +1 -1
  67. package/src/components/DialogActions.tsx +2 -2
  68. package/src/components/DialogContent.tsx +2 -2
  69. package/src/components/DialogTitle.tsx +1 -1
  70. package/src/components/Divider.tsx +1 -1
  71. package/src/components/FloatingActionButton.tsx +1 -1
  72. package/src/components/FormControl.tsx +1 -1
  73. package/src/components/FormHelperText.tsx +2 -2
  74. package/src/components/Grid.tsx +1 -1
  75. package/src/components/Heading.tsx +1 -1
  76. package/src/components/IconButton.tsx +1 -1
  77. package/src/components/Icons/index.ts +1 -17
  78. package/src/components/Input.tsx +1 -1
  79. package/src/components/InputAdornment/InputAdornment.tsx +2 -2
  80. package/src/components/InputLabel.tsx +1 -1
  81. package/src/components/Label/Label.test.tsx +0 -1
  82. package/src/components/Label/Label.tsx +2 -3
  83. package/src/components/List.tsx +1 -1
  84. package/src/components/ListItem.tsx +1 -1
  85. package/src/components/ListItemText.tsx +1 -4
  86. package/src/components/Loading/Loading.test.tsx +0 -1
  87. package/src/components/Loading/Loading.tsx +1 -2
  88. package/src/components/Loading/Spinner/Spinner.test.tsx +1 -2
  89. package/src/components/Loading/Spinner/Spinner.tsx +1 -2
  90. package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +114 -16
  91. package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +63 -11
  92. package/src/components/Loading/styles.ts +1 -2
  93. package/src/components/Logo/Logo.test.tsx +0 -1
  94. package/src/components/Logo/Logo.tsx +1 -2
  95. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +2 -0
  96. package/src/components/Menu.tsx +1 -1
  97. package/src/components/MenuItem.tsx +1 -1
  98. package/src/components/NotFound/NotFound.tsx +1 -3
  99. package/src/components/NotFound/Notfound.test.tsx +1 -2
  100. package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +138 -11
  101. package/src/components/NotFound/styles.ts +0 -1
  102. package/src/components/Paper.tsx +1 -1
  103. package/src/components/SnackbarContent.tsx +1 -1
  104. package/src/components/SvgIcon.tsx +1 -1
  105. package/src/components/Tab.tsx +1 -1
  106. package/src/components/Tabs.tsx +1 -1
  107. package/src/components/Text/Text.tsx +1 -1
  108. package/src/components/Text/TextConfig.ts +1 -1
  109. package/src/components/TextField/TextField.test.tsx +0 -1
  110. package/src/components/TextField/TextField.tsx +2 -2
  111. package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +216 -3
  112. package/src/components/Toolbar.tsx +1 -1
  113. package/src/components/Tooltip.tsx +1 -1
  114. package/src/design-tokens/ResetStyles.tsx +1 -1
  115. package/src/design-tokens/StyleBaseline.tsx +2 -2
  116. package/src/design-tokens/ThemeContext.ts +1 -1
  117. package/src/design-tokens/ThemeProvider.tsx +15 -12
  118. package/src/design-tokens/theme.ts +28 -26
  119. package/src/design-tokens/useTheme.ts +1 -1
  120. package/src/{design-tokens → hooks}/useLocalStorage.ts +0 -0
  121. package/src/{design-tokens → hooks}/useOnClickOutside.ts +0 -0
  122. package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
  123. package/src/i18n/__mocks__/loadTranslationFile.ts +5 -0
  124. package/src/i18n/config.ts +38 -0
  125. package/src/i18n/crowdin/ui.json +170 -0
  126. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/cs-CZ.json +0 -0
  127. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/de-DE.json +0 -0
  128. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/en-US.json +0 -0
  129. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/es-ES.json +0 -0
  130. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/fr-FR.json +0 -0
  131. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ja-JP.json +0 -0
  132. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/km-KH.json +0 -0
  133. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/pt-BR.json +0 -0
  134. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ru-RU.json +0 -0
  135. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/tr-TR.json +0 -0
  136. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/uk-UA.json +0 -0
  137. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-CN.json +0 -0
  138. package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-TW.json +0 -0
  139. package/src/i18n/download_translations/ar-SA/ui.json +170 -0
  140. package/src/i18n/download_translations/cs-CZ/ui.json +170 -0
  141. package/src/i18n/download_translations/de-DE/ui.json +170 -0
  142. package/src/i18n/download_translations/es-ES/ui.json +170 -0
  143. package/src/i18n/download_translations/fi-FI/ui.json +170 -0
  144. package/src/i18n/download_translations/fil-PH/ui.json +170 -0
  145. package/src/i18n/download_translations/fr-FR/ui.json +170 -0
  146. package/src/i18n/download_translations/gl-ES/ui.json +170 -0
  147. package/src/i18n/download_translations/hi-IN/ui.json +170 -0
  148. package/src/i18n/download_translations/it-IT/ui.json +170 -0
  149. package/src/i18n/download_translations/ja-JP/ui.json +170 -0
  150. package/src/i18n/download_translations/km-KH/ui.json +170 -0
  151. package/src/i18n/download_translations/ko-KR/ui.json +170 -0
  152. package/src/i18n/download_translations/pl-PL/ui.json +170 -0
  153. package/src/i18n/download_translations/pt-BR/ui.json +170 -0
  154. package/src/i18n/download_translations/pt-PT/ui.json +170 -0
  155. package/src/i18n/download_translations/ro-RO/ui.json +170 -0
  156. package/src/i18n/download_translations/ru-RU/ui.json +170 -0
  157. package/src/i18n/download_translations/si-LK/ui.json +170 -0
  158. package/src/i18n/download_translations/sr-CS/ui.json +170 -0
  159. package/src/i18n/download_translations/sr-SP/ui.json +170 -0
  160. package/src/i18n/download_translations/tg-TJ/ui.json +170 -0
  161. package/src/i18n/download_translations/tr-TR/ui.json +170 -0
  162. package/src/i18n/download_translations/uk-UA/ui.json +170 -0
  163. package/src/i18n/download_translations/vi-VN/ui.json +170 -0
  164. package/src/i18n/download_translations/yo-NG/ui.json +170 -0
  165. package/src/i18n/download_translations/zh-CN/ui.json +170 -0
  166. package/src/i18n/download_translations/zh-TW/ui.json +170 -0
  167. package/src/i18n/enabledLanguages.ts +35 -0
  168. package/src/i18n/loadTranslationFile.ts +14 -0
  169. package/src/index.tsx +13 -11
  170. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +0 -2
  171. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +1 -3
  172. package/src/pages/Version/DetailContainer/Dependencies/styles.ts +0 -1
  173. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +1 -3
  174. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +2 -3
  175. package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +0 -1
  176. package/src/pages/Version/DetailContainer/DetailContainer.tsx +1 -3
  177. package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +0 -1
  178. package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +0 -1
  179. package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +0 -1
  180. package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +0 -1
  181. package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +0 -1
  182. package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +10 -1
  183. package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +1 -2
  184. package/src/pages/Version/DetailContainer/Readme/Readme.tsx +1 -2
  185. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +1 -9
  186. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +1 -3
  187. package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +184 -26
  188. package/src/pages/Version/DetailContainer/UpLinks/styles.ts +2 -3
  189. package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +3 -5
  190. package/src/pages/Version/DetailContainer/Versions/Versions.tsx +1 -2
  191. package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +2 -4
  192. package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +1 -3
  193. package/src/pages/Version/DetailContainer/Versions/styles.ts +2 -3
  194. package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +168 -34
  195. package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +0 -2
  196. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +0 -2
  197. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +1 -2
  198. package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +0 -1
  199. package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +3 -5
  200. package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +3 -5
  201. package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +0 -1
  202. package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +328 -40
  203. package/src/pages/Version/DetailSidebar/Developers/styles.ts +0 -1
  204. package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +1 -3
  205. package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +1 -3
  206. package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +1436 -74
  207. package/src/pages/Version/DetailSidebar/Dist/styles.ts +2 -1
  208. package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +1 -3
  209. package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +1 -3
  210. package/src/pages/Version/DetailSidebar/Engines/styles.ts +0 -1
  211. package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +1 -3
  212. package/src/pages/Version/DetailSidebar/Install/Install.tsx +0 -2
  213. package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +0 -1
  214. package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +1 -3
  215. package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +1 -3
  216. package/src/pages/Version/Version.test.tsx +3 -5
  217. package/src/pages/Version/Version.tsx +21 -6
  218. package/src/pages/Version/VersionContextProvider.tsx +14 -45
  219. package/src/pages/Version/VersionLayout.tsx +1 -1
  220. package/src/pages/Version/context.ts +1 -1
  221. package/src/pages/home/Home.tsx +9 -28
  222. package/src/pages/home/PackageList/Help/Help.test.tsx +0 -1
  223. package/src/pages/home/PackageList/Help/Help.tsx +0 -1
  224. package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +298 -59
  225. package/src/pages/home/PackageList/Help/styles.ts +0 -1
  226. package/src/pages/home/PackageList/Package/Package.test.tsx +5 -4
  227. package/src/pages/home/PackageList/Package/Package.tsx +20 -28
  228. package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +0 -1
  229. package/src/pages/home/PackageList/Package/styles.ts +5 -6
  230. package/src/pages/home/PackageList/PackageList.tsx +17 -17
  231. package/src/pages/home/PackageList/Packagelist.test.tsx +6 -5
  232. package/src/providers/API/api.test.ts +1 -0
  233. package/src/providers/API/api.ts +7 -3
  234. package/src/providers/config/AppConfigurationProvider.tsx +3 -3
  235. package/src/store/index.ts +1 -0
  236. package/src/store/models/configuration.ts +41 -0
  237. package/src/store/models/download.ts +30 -0
  238. package/src/store/models/index.ts +18 -0
  239. package/src/store/models/login.ts +92 -0
  240. package/src/store/models/manifest.ts +91 -0
  241. package/src/store/models/packages.ts +36 -0
  242. package/src/store/models/search.ts +81 -0
  243. package/src/store/store.ts +15 -0
  244. package/src/utils/login.test.ts +3 -4
  245. package/src/utils/package.test.ts +2 -3
  246. package/src/utils/package.ts +2 -1
  247. package/src/utils/sec-utils.ts +1 -1
  248. package/src/utils/test-react-testing-library.tsx +22 -5
  249. package/src/utils/url.test.ts +1 -1
  250. package/src/utils/url.ts +1 -0
  251. package/static/Dependencies.15768a14646212b71166.js +2 -0
  252. package/static/Dependencies.15768a14646212b71166.js.LICENSE.txt +78 -0
  253. package/static/Dist.15768a14646212b71166.js +2 -0
  254. package/static/Dist.15768a14646212b71166.js.LICENSE.txt +60 -0
  255. package/static/Engines.15768a14646212b71166.js +2 -0
  256. package/static/Engines.15768a14646212b71166.js.LICENSE.txt +66 -0
  257. package/static/Home.15768a14646212b71166.js +2 -0
  258. package/static/Home.15768a14646212b71166.js.LICENSE.txt +222 -0
  259. package/static/Install.15768a14646212b71166.js +2 -0
  260. package/static/Install.15768a14646212b71166.js.LICENSE.txt +66 -0
  261. package/static/NotFound.15768a14646212b71166.js +2 -0
  262. package/static/NotFound.15768a14646212b71166.js.LICENSE.txt +40 -0
  263. package/static/Provider.15768a14646212b71166.js +2 -0
  264. package/static/Provider.15768a14646212b71166.js.LICENSE.txt +32 -0
  265. package/static/Repository.15768a14646212b71166.js +2 -0
  266. package/static/Repository.15768a14646212b71166.js.LICENSE.txt +50 -0
  267. package/static/UpLinks.15768a14646212b71166.js +2 -0
  268. package/static/UpLinks.15768a14646212b71166.js.LICENSE.txt +56 -0
  269. package/static/Version.15768a14646212b71166.js +2 -0
  270. package/static/Version.15768a14646212b71166.js.LICENSE.txt +380 -0
  271. package/static/Versions.15768a14646212b71166.js +2 -0
  272. package/static/Versions.15768a14646212b71166.js.LICENSE.txt +64 -0
  273. package/static/index.html +1 -1
  274. package/static/main.15768a14646212b71166.js +2 -0
  275. package/static/main.15768a14646212b71166.js.LICENSE.txt +972 -0
  276. package/static/manifest.json +17 -3
  277. package/static/runtime.15768a14646212b71166.js +2 -0
  278. package/static/{runtime.9525ddaaf85378590c63.js.LICENSE.txt → runtime.15768a14646212b71166.js.LICENSE.txt} +2 -2
  279. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js +2 -0
  280. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js.LICENSE.txt +148 -0
  281. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js +2 -0
  282. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js.LICENSE.txt +218 -0
  283. package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js +2 -0
  284. package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js.LICENSE.txt +316 -0
  285. package/static/vendors.15768a14646212b71166.js +103 -0
  286. package/static/vendors.15768a14646212b71166.js.LICENSE.txt +3158 -0
  287. package/tools/dev.server.js +0 -1
  288. package/tools/webpack.dev.config.babel.js +1 -3
  289. package/tools/webpack.prod.config.babel.js +1 -1
  290. package/tsconfig.json +1 -3
  291. package/types/index.ts +3 -20
  292. package/i18n/config.ts +0 -94
  293. package/src/App/AppContext.ts +0 -18
  294. package/src/App/AppContextProvider.tsx +0 -44
  295. package/src/App/Header/Search/SearchAdornment.tsx +0 -18
  296. package/src/components/Icons/Austria.tsx +0 -23
  297. package/src/components/Icons/Brazil.tsx +0 -44
  298. package/src/components/Icons/China.tsx +0 -33
  299. package/src/components/Icons/Czech.tsx +0 -21
  300. package/src/components/Icons/France.tsx +0 -27
  301. package/src/components/Icons/Germany.tsx +0 -27
  302. package/src/components/Icons/India.tsx +0 -44
  303. package/src/components/Icons/Japan.tsx +0 -23
  304. package/src/components/Icons/Khmer.tsx +0 -40
  305. package/src/components/Icons/Nicaragua.tsx +0 -66
  306. package/src/components/Icons/Russia.tsx +0 -27
  307. package/src/components/Icons/Spain.tsx +0 -43
  308. package/src/components/Icons/Taiwan.tsx +0 -25
  309. package/src/components/Icons/Turkey.tsx +0 -23
  310. package/src/components/Icons/Ukraine.tsx +0 -30
  311. package/src/components/Icons/Usa.tsx +0 -34
  312. package/src/design-tokens/emotion.ts +0 -5
  313. package/src/lib/constants.ts +0 -9
  314. package/src/pages/Version/DetailSidebar/ActionBar/ActionBar.test.tsx +0 -84
  315. package/src/pages/Version/DetailSidebar/ActionBar/__snapshots__/ActionBar.test.tsx.snap +0 -122
  316. package/src/pages/Version/is-package-version-valid.ts +0 -19
  317. package/src/providers/API/APIProvider.tsx +0 -109
  318. package/src/providers/API/index.ts +0 -1
  319. package/static/main.9525ddaaf85378590c63.js +0 -2
  320. package/static/main.9525ddaaf85378590c63.js.LICENSE.txt +0 -1588
  321. package/static/runtime.9525ddaaf85378590c63.js +0 -2
  322. package/static/vendors.9525ddaaf85378590c63.js +0 -2
  323. package/static/vendors.9525ddaaf85378590c63.js.LICENSE.txt +0 -4540
package/.babelrc CHANGED
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "@babel/preset-react"
14
14
  ],
15
- "plugins": ["react-hot-loader/babel", "@babel/transform-runtime", "emotion"],
15
+ "plugins": ["react-hot-loader/babel", "@babel/transform-runtime", "@emotion"],
16
16
  "env": {
17
17
  "test": {
18
18
  "presets": [
package/.eslintrc CHANGED
@@ -11,21 +11,6 @@
11
11
  "verdaccio"
12
12
  ],
13
13
  "rules": {
14
- "import/order": ["error", {
15
- "pathGroups": [
16
- {
17
- "pattern": "verdaccio-ui/**",
18
- "group": "external",
19
- "position": "after"
20
- }
21
- ],
22
- "pathGroupsExcludedImportTypes": ["verdaccio-ui"],
23
- "alphabetize": {
24
- "order": "asc",
25
- "caseInsensitive": true
26
- },
27
- "newlines-between": "always"
28
- }],
29
14
  "react/display-name": 0,
30
15
  "react/no-deprecated": 1,
31
16
  "react/jsx-no-target-blank": 1,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # @verdaccio/ui-theme
2
2
 
3
+ ## 6.0.0-6-next.13
4
+
5
+ ### Major Changes
6
+
7
+ - 000d4374: feat: upgrade to material ui 5
8
+
9
+ ## 6.0.0-6-next.12
10
+
11
+ ### Major Changes
12
+
13
+ - 794af76c: Remove Node 12 support
14
+
15
+ - We need move to the new `undici` and does not support Node.js 12
16
+
17
+ ### Minor Changes
18
+
19
+ - 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
20
+
21
+ ## 6.0.0-6-next.11
22
+
23
+ ### Minor Changes
24
+
25
+ - 5fed1955: feat: integrate rematch for ui state storage
26
+
27
+ ## 6.0.0-6-next.10
28
+
29
+ ### Major Changes
30
+
31
+ - 459b6fa7: refactor: search v1 endpoint and local-database
32
+
33
+ - refactor search `api v1` endpoint, improve performance
34
+ - remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
35
+ - refactor method storage class
36
+ - create new module `core` to reduce the ammount of modules with utilities
37
+ - use `undici` instead `node-fetch`
38
+ - use `fastify` instead `express` for functional test
39
+
40
+ ### Breaking changes
41
+
42
+ - plugin storage API changes
43
+ - remove old search endpoint (return 404)
44
+ - filter local private packages at plugin level
45
+
46
+ The storage api changes for methods `get`, `add`, `remove` as promise base. The `search` methods also changes and recieves a `query` object that contains all query params from the client.
47
+
48
+ ```ts
49
+ export interface IPluginStorage<T> extends IPlugin {
50
+ add(name: string): Promise<void>;
51
+ remove(name: string): Promise<void>;
52
+ get(): Promise<any>;
53
+ init(): Promise<void>;
54
+ getSecret(): Promise<string>;
55
+ setSecret(secret: string): Promise<any>;
56
+ getPackageStorage(packageInfo: string): IPackageStorage;
57
+ search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
58
+ saveToken(token: Token): Promise<any>;
59
+ deleteToken(user: string, tokenKey: string): Promise<any>;
60
+ readTokens(filter: TokenFilter): Promise<Token[]>;
61
+ }
62
+ ```
63
+
3
64
  ## 6.0.0-6-next.9
4
65
 
5
66
  ### Minor Changes
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "name": "test",
4
+ "version": "1.0.22",
5
+ "description": "test",
6
+ "main": "src/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "repository": {
11
+ "type": "http",
12
+ "url": "git+https://github.com/test/test.git"
13
+ },
14
+ "keywords": [],
15
+ "author": {
16
+ "name": "",
17
+ "email": "",
18
+ "url": "",
19
+ "avatar": "data:image/svg+xml;utf8,%3Csvg%20height%3D%22100%22%20viewBox%3D%22-27%2024%20100%20100%22%20width%3D%22100%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3Ccircle%20cx%3D%2223%22%20cy%3D%2274%22%20id%3D%22a%22%20r%3D%2250%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23F5EEE5%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3CclipPath%20id%3D%22b%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3C%2FclipPath%3E%3Cg%20clip-path%3D%22url(%23b)%22%3E%3Cdefs%3E%3Cpath%20d%3D%22M36%2095.9c0%204%204.7%205.2%207.1%205.8%207.6%202%2022.8%205.9%2022.8%205.9%203.2%201.1%205.7%203.5%207.1%206.6v9.8H-27v-9.8c1.3-3.1%203.9-5.5%207.1-6.6%200%200%2015.2-3.9%2022.8-5.9%202.4-.6%207.1-1.8%207.1-5.8V85h26v10.9z%22%20id%3D%22c%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23E6C19C%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3CclipPath%20id%3D%22d%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3C%2FclipPath%3E%3Cpath%20clip-path%3D%22url(%23d)%22%20d%3D%22M23.2%2035h.2c3.3%200%208.2.2%2011.4%202%203.3%201.9%207.3%205.6%208.5%2012.1%202.4%2013.7-2.1%2035.4-6.3%2042.4-4%206.7-9.8%209.2-13.5%209.4H23h-.1c-3.7-.2-9.5-2.7-13.5-9.4-4.2-7-8.7-28.7-6.3-42.4%201.2-6.5%205.2-10.2%208.5-12.1%203.2-1.8%208.1-2%2011.4-2h.2z%22%20fill%3D%22%23D4B08C%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M22.6%2040c19.1%200%2020.7%2013.8%2020.8%2015.1%201.1%2011.9-3%2028.1-6.8%2033.7-4%205.9-9.8%208.1-13.5%208.3h-.5c-3.8-.3-9.6-2.5-13.6-8.4-3.8-5.6-7.9-21.8-6.8-33.8C2.3%2053.7%203.5%2040%2022.6%2040z%22%20fill%3D%22%23F2CEA5%22%2F%3E%3C%2Fsvg%3E"
20
+ },
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "lodash": "^4.17.21"
24
+ },
25
+ "readmeFilename": "README.md",
26
+ "bugs": {
27
+ "url": "https://github.com/test/test/issues"
28
+ },
29
+ "homepage": "https://github.com/test/test#readme",
30
+ "_id": "test@1.0.22",
31
+ "_nodeVersion": "14.17.4",
32
+ "_npmVersion": "7.20.5",
33
+ "dist": {
34
+ "integrity": "sha512-2IDD0lLzGUL7YJ+17Oh9VtbOwdKLqBLS+ZFATDXi5R22TL2hZ9LBFE10bzsDovNc4xtgwZAk1/K+5LHTye4ztg==",
35
+ "shasum": "c9152f57636bce762ccb5a83113c42a5831579bc",
36
+ "tarball": "http://localhost:4873/test/-/test-1.0.22.tgz"
37
+ },
38
+ "contributors": [],
39
+ "time": "2021-08-14T20:15:19.336Z",
40
+ "users": {}
41
+ }
42
+ ]
@@ -10,9 +10,9 @@ module.exports = Object.assign({}, config, {
10
10
  '^.+\\.(js|ts|tsx)$': 'babel-jest',
11
11
  },
12
12
  moduleFileExtensions: ['js', 'ts', 'tsx'],
13
- testURL: 'http://localhost',
13
+ testURL: 'http://localhost:9000/',
14
14
  rootDir: '..',
15
- setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
15
+ setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', '<rootDir>/jest/setup-env.ts'],
16
16
  setupFiles: ['<rootDir>/jest/setup.ts'],
17
17
  transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-syntax-highlighter)'],
18
18
  modulePathIgnorePatterns: [
@@ -0,0 +1,9 @@
1
+ import { rest } from 'msw';
2
+
3
+ const packagesPayload = require('./api/packages.json');
4
+
5
+ export const handlers = [
6
+ rest.get('http://localhost:9000/-/verdaccio/packages', (req, res, ctx) => {
7
+ return res(ctx.json(packagesPayload));
8
+ }),
9
+ ];
package/jest/server.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { setupServer } from 'msw/node';
2
+
3
+ import { handlers } from './server-handlers';
4
+
5
+ const server = setupServer(...handlers);
6
+ export { server };
@@ -0,0 +1,18 @@
1
+ import '@testing-library/jest-dom';
2
+ import '@testing-library/jest-dom/extend-expect';
3
+ import 'whatwg-fetch';
4
+
5
+ import { server } from './server';
6
+
7
+ // mock load translations to avoid warnings
8
+ jest.mock('../src/i18n/loadTranslationFile');
9
+
10
+ beforeAll(() => {
11
+ server.listen({
12
+ onUnhandledRequest: 'warn',
13
+ });
14
+ });
15
+ afterEach(() => server.resetHandlers());
16
+ afterAll(() => {
17
+ server.close();
18
+ });
package/jest/setup.ts CHANGED
@@ -2,29 +2,24 @@
2
2
  * Setup configuration for Jest
3
3
  * This file includes global settings for the JEST environment.
4
4
  */
5
- import { GlobalWithFetchMock } from 'jest-fetch-mock';
6
5
  import 'mutationobserver-shim';
7
6
 
8
7
  // @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
9
8
  global.__VERDACCIO_BASENAME_UI_OPTIONS = {
10
- base: 'http://localhost',
9
+ base: 'http://localhost:9000/',
11
10
  protocol: 'http',
12
11
  host: 'localhost',
13
12
  primaryColor: '#4b5e40',
14
13
  url_prefix: '',
15
14
  darkMode: false,
16
15
  language: 'en-US',
17
- uri: 'http://localhost:4873',
16
+ uri: 'http://localhost:9000/',
18
17
  pkgManagers: ['pnpm', 'yarn', 'npm'],
19
18
  title: 'Verdaccio Dev UI',
20
19
  scope: '',
21
20
  version: 'v1.0.0',
22
21
  };
23
22
 
24
- const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
25
- customGlobal.fetch = require('jest-fetch-mock');
26
- customGlobal.fetchMock = customGlobal.fetch;
27
-
28
23
  // mocking few DOM methods
29
24
  // @ts-ignore : Property 'document' does not exist on type 'Global'.
30
25
  if (global.document) {
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Token Utility
3
3
  */
4
-
5
4
  import dayjs from 'dayjs';
6
5
  import { Base64 } from 'js-base64';
7
6
 
@@ -1,4 +1,5 @@
1
1
  import { API_ERROR } from '../../../../lib/constants';
2
+
2
3
  /**
3
4
  * API mock for login endpoint
4
5
  * @param {object} config configuration of api call
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/ui-theme",
3
- "version": "6.0.0-6-next.9",
3
+ "version": "6.0.0-6-next.13",
4
4
  "description": "Verdaccio User Interface",
5
5
  "author": {
6
6
  "name": "Verdaccio Contributors",
@@ -13,38 +13,46 @@
13
13
  "homepage": "https://verdaccio.org",
14
14
  "main": "index.js",
15
15
  "engines": {
16
- "node": ">=10",
16
+ "node": ">=14",
17
17
  "npm": ">=6"
18
18
  },
19
19
  "devDependencies": {
20
- "@emotion/core": "10.1.1",
21
- "@emotion/jest": "11.3.0",
22
- "@emotion/styled": "10.0.27",
23
- "@emotion/styled-base": "^10.0.31",
24
- "@material-ui/core": "4.11.4",
25
- "@material-ui/icons": "4.11.2",
26
- "@material-ui/styles": "4.11.4",
27
- "@testing-library/dom": "8.2.0",
28
- "@testing-library/jest-dom": "5.14.1",
29
- "@testing-library/react": "11.2.7",
30
- "@verdaccio/node-api": "6.0.0-6-next.18",
31
- "autosuggest-highlight": "3.1.1",
32
- "babel-loader": "8.2.2",
20
+ "@types/react": "17.0.37",
21
+ "@types/react-autosuggest": "10.1.5",
22
+ "@types/react-dom": "17.0.11",
23
+ "@types/react-helmet": "6.1.4",
24
+ "@types/redux": "3.6.0",
25
+ "@types/react-router-dom": "5.3.2",
26
+ "@types/react-virtualized": "9.21.15",
27
+ "@emotion/react": "11.5.0",
28
+ "@emotion/jest": "11.5.0",
29
+ "@emotion/styled": "11.3.0",
30
+ "@emotion/css": "11.5.0",
31
+ "@emotion/babel-plugin": "11.0.0",
32
+ "@mui/icons-material": "5.0.5",
33
+ "@mui/material": "5.0.6",
34
+ "@mui/styles": "5.0.2",
35
+ "@rematch/core": "2.2.0",
36
+ "@rematch/loading": "2.1.2",
37
+ "@testing-library/dom": "8.11.1",
38
+ "@testing-library/jest-dom": "5.16.1",
39
+ "@testing-library/react": "12.1.2",
40
+ "@verdaccio/node-api": "6.0.0-6-next.25",
41
+ "@verdaccio/types": "11.0.0-6-next.10",
42
+ "babel-loader": "8.2.3",
33
43
  "babel-plugin-dynamic-import-node": "2.3.3",
34
- "babel-plugin-emotion": "10.0.33",
35
44
  "bundlesize": "0.18.1",
36
- "css-loader": "6.2.0",
37
- "dayjs": "1.10.6",
38
- "emotion": "10.0.27",
39
- "emotion-theming": "10.0.27",
45
+ "css-loader": "6.5.1",
46
+ "dayjs": "1.10.7",
40
47
  "friendly-errors-webpack-plugin": "1.7.0",
41
48
  "github-markdown-css": "4.0.0",
42
49
  "harmony-reflect": "1.6.2",
43
50
  "history": "4.10.1",
44
- "html-webpack-plugin": "5.3.2",
45
- "i18next": "20.6.0",
51
+ "html-webpack-plugin": "5.4.0",
52
+ "i18next": "20.6.1",
46
53
  "in-publish": "2.0.1",
47
- "js-base64": "3.6.1",
54
+ "country-flag-icons": "1.4.19",
55
+ "js-base64": "3.7.2",
48
56
  "js-yaml": "3.14.1",
49
57
  "localstorage-memory": "1.0.3",
50
58
  "lodash": "4.17.21",
@@ -56,15 +64,17 @@
56
64
  "ora": "5.4.1",
57
65
  "prop-types": "15.7.2",
58
66
  "react": "17.0.2",
59
- "react-autosuggest": "10.1.0",
60
67
  "react-dom": "17.0.2",
61
- "react-hook-form": "7.14.2",
68
+ "react-hook-form": "7.15.3",
62
69
  "react-hot-loader": "4.13.0",
63
- "react-i18next": "11.11.4",
70
+ "react-i18next": "11.12.0",
64
71
  "react-router": "5.2.1",
65
- "react-router-dom": "5.2.1",
72
+ "react-router-dom": "5.3.0",
66
73
  "react-virtualized": "9.22.3",
74
+ "react-redux": "7.2.6",
75
+ "redux": "4.1.2",
67
76
  "rimraf": "3.0.2",
77
+ "msw": "0.35.0",
68
78
  "standard-version": "9.3.1",
69
79
  "style-loader": "3.2.1",
70
80
  "stylelint": "13.13.1",
@@ -73,18 +83,18 @@
73
83
  "stylelint-processor-styled-components": "1.10.0",
74
84
  "stylelint-webpack-plugin": "3.0.1",
75
85
  "supertest": "6.1.6",
76
- "terser-webpack-plugin": "5.2.2",
86
+ "terser-webpack-plugin": "5.2.5",
77
87
  "url-loader": "4.1.1",
78
- "validator": "13.6.0",
79
- "webpack": "5.51.2",
88
+ "validator": "13.7.0",
89
+ "webpack": "5.64.0",
80
90
  "webpack-bundle-analyzer": "4.4.2",
81
91
  "webpack-bundle-size-analyzer": "3.1.0",
82
92
  "webpack-cli": "^4.7.2",
83
- "webpack-dev-server": "3.11.2",
93
+ "webpack-dev-server": "3.11.3",
84
94
  "webpack-manifest-plugin": "4.0.2",
85
95
  "webpack-merge": "5.8.0",
86
96
  "whatwg-fetch": "3.6.2",
87
- "xss": "1.0.9"
97
+ "xss": "1.0.10"
88
98
  },
89
99
  "keywords": [
90
100
  "private",
@@ -129,7 +139,7 @@
129
139
  "type-check": "tsc --noEmit -p tsconfig.build.json",
130
140
  "start": "babel-node tools/dev.server.js",
131
141
  "test:clean": "jest --clearCache",
132
- "test": "cross-env BABEL_ENV=test cross-env NODE_ENV=test cross-env TZ=UTC jest --config ./jest/jest.config.js --maxWorkers 2 --passWithNoTests",
142
+ "test": "cross-env BABEL_ENV=test cross-env NODE_ENV=test cross-env TZ=UTC jest --config ./jest/jest.config.js --runInBand",
133
143
  "test:update-snapshot": "yarn run test -- -u",
134
144
  "test:size": "bundlesize",
135
145
  "lint": "pnpm lint:js && pnpm lint:css",
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
-
3
- import storage from 'verdaccio-ui/utils/storage';
4
- import { render, waitFor, fireEvent } from 'verdaccio-ui/utils/test-react-testing-library';
2
+ import {
3
+ act,
4
+ fireEvent,
5
+ renderWithStore,
6
+ screen,
7
+ waitFor,
8
+ } from 'verdaccio-ui/utils/test-react-testing-library';
5
9
 
6
10
  // eslint-disable-next-line jest/no-mocks-import
7
11
  import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
8
-
12
+ import { store } from '../store';
9
13
  import App from './App';
10
14
 
11
15
  jest.mock('verdaccio-ui/utils/storage', () => {
@@ -30,68 +34,88 @@ jest.mock('verdaccio-ui/utils/storage', () => {
30
34
  return new LocalStorageMock();
31
35
  });
32
36
 
33
- jest.mock('verdaccio-ui/providers/API/api', () => ({
34
- // eslint-disable-next-line jest/no-mocks-import
35
- request: require('../../jest/unit/components/__mocks__/api').default.request,
36
- }));
37
+ // force the windows to expand to display items
38
+ // https://github.com/bvaughn/react-virtualized/issues/493#issuecomment-640084107
39
+ jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600);
40
+ jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
37
41
 
38
42
  /* eslint-disable react/jsx-no-bind*/
39
43
  describe('<App />', () => {
40
- // test('should display the Header component ', async () => {
41
- // const { queryByTestId } = render(<App />);
42
- //
43
- // expect(queryByTestId('loading')).toBeTruthy();
44
- //
45
- // // wait for the Header component appearance and return the element
46
- // const headerElement = await waitFor(() => queryByTestId('header'));
47
- // expect(headerElement).toBeTruthy();
48
- // });
49
-
50
- test('handleLogout - logouts the user and clear localstorage', async () => {
51
- storage.setItem('username', 'verdaccio');
52
- storage.setItem('token', generateTokenWithTimeRange(24));
53
-
54
- const { queryByTestId } = render(<App />);
44
+ describe('login - log out', () => {
45
+ test('handleLogout - logouts the user and clear localstorage', async () => {
46
+ const { queryByTestId } = renderWithStore(<App />, store);
47
+ store.dispatch.login.logInUser({
48
+ username: 'verdaccio',
49
+ token: generateTokenWithTimeRange(24),
50
+ });
51
+
52
+ // wait for the Account's circle element component appearance and return the element
53
+ const accountCircleElement = await waitFor(() => queryByTestId('logInDialogIcon'));
54
+ expect(accountCircleElement).toBeTruthy();
55
+
56
+ if (accountCircleElement) {
57
+ fireEvent.click(accountCircleElement);
58
+
59
+ // wait for the Button's logout element component appearance and return the element
60
+ const buttonLogoutElement = await waitFor(() => queryByTestId('logOutDialogIcon'));
61
+ expect(buttonLogoutElement).toBeTruthy();
62
+
63
+ if (buttonLogoutElement) {
64
+ fireEvent.click(buttonLogoutElement);
65
+
66
+ expect(queryByTestId('greetings-label')).toBeFalsy();
67
+ }
68
+ }
69
+ }, 10000);
55
70
 
56
- // wait for the Account's circle element component appearance and return the element
57
- const accountCircleElement = await waitFor(() => queryByTestId('header--menu-accountcircle'));
58
- expect(accountCircleElement).toBeTruthy();
71
+ test('isUserAlreadyLoggedIn: token already available in storage', async () => {
72
+ const { queryByTestId, queryAllByText } = renderWithStore(<App />, store);
73
+ store.dispatch.login.logInUser({
74
+ username: 'verdaccio',
75
+ token: generateTokenWithTimeRange(24),
76
+ });
59
77
 
60
- if (accountCircleElement) {
61
- fireEvent.click(accountCircleElement);
78
+ // wait for the Account's circle element component appearance and return the element
79
+ const accountCircleElement = await waitFor(() => queryByTestId('logInDialogIcon'));
80
+ expect(accountCircleElement).toBeTruthy();
62
81
 
63
- // wait for the Button's logout element component appearance and return the element
64
- const buttonLogoutElement = await waitFor(() => queryByTestId('header--button-logout'));
65
- expect(buttonLogoutElement).toBeTruthy();
82
+ if (accountCircleElement) {
83
+ fireEvent.click(accountCircleElement);
66
84
 
67
- if (buttonLogoutElement) {
68
- fireEvent.click(buttonLogoutElement);
85
+ // wait for the Greeting's label element component appearance and return the element
86
+ const greetingsLabelElement = await waitFor(() => queryByTestId('greetings-label'));
87
+ expect(greetingsLabelElement).toBeTruthy();
69
88
 
70
- expect(queryByTestId('greetings-label')).toBeFalsy();
89
+ if (greetingsLabelElement) {
90
+ expect(queryAllByText('verdaccio')).toBeTruthy();
91
+ }
71
92
  }
72
- }
93
+ }, 10000);
73
94
  });
74
95
 
75
- test('isUserAlreadyLoggedIn: token already available in storage', async () => {
76
- storage.setItem('username', 'verdaccio');
77
- storage.setItem('token', generateTokenWithTimeRange(24));
96
+ describe('list packages', () => {
97
+ test('should display the Header component', async () => {
98
+ renderWithStore(<App />, store);
78
99
 
79
- const { queryByTestId, queryAllByText } = render(<App />);
100
+ await waitFor(() => {
101
+ expect(screen.queryByTestId('loading')).toBeTruthy();
102
+ });
80
103
 
81
- // wait for the Account's circle element component appearance and return the element
82
- const accountCircleElement = await waitFor(() => queryByTestId('header--menu-accountcircle'));
83
- expect(accountCircleElement).toBeTruthy();
104
+ // wait for the Header component appearance and return the element
105
+ const headerElement = await waitFor(() => screen.queryByTestId('header'));
106
+ expect(headerElement).toBeTruthy();
107
+ });
84
108
 
85
- if (accountCircleElement) {
86
- fireEvent.click(accountCircleElement);
109
+ test('should display package lists', async () => {
110
+ act(() => {
111
+ renderWithStore(<App />, store);
112
+ });
87
113
 
88
- // wait for the Greeting's label element component appearance and return the element
89
- const greetingsLabelElement = await waitFor(() => queryByTestId('greetings-label'));
90
- expect(greetingsLabelElement).toBeTruthy();
114
+ await waitFor(() => {
115
+ expect(screen.getByTestId('package-item-list')).toBeInTheDocument();
116
+ });
91
117
 
92
- if (greetingsLabelElement) {
93
- expect(queryAllByText('verdaccio')).toBeTruthy();
94
- }
95
- }
118
+ expect(store.getState().packages.response).toHaveLength(1);
119
+ }, 10000);
96
120
  });
97
121
  });
package/src/App/App.tsx CHANGED
@@ -1,24 +1,18 @@
1
1
  /* eslint-disable react/jsx-max-depth */
2
2
  import styled from '@emotion/styled';
3
- import isNil from 'lodash/isNil';
4
- import React, { useState, useEffect, Suspense } from 'react';
3
+ import React, { Suspense, useEffect } from 'react';
5
4
  import { Router } from 'react-router-dom';
6
-
7
5
  import Box from 'verdaccio-ui/components/Box';
8
6
  import Loading from 'verdaccio-ui/components/Loading';
9
- import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale';
10
7
  import StyleBaseline from 'verdaccio-ui/design-tokens/StyleBaseline';
8
+ import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale';
11
9
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
12
- import { isTokenExpire } from 'verdaccio-ui/utils/login';
13
- import storage from 'verdaccio-ui/utils/storage';
14
10
 
15
- import AppContextProvider from './AppContextProvider';
11
+ import '../i18n/config';
16
12
  import AppRoute, { history } from './AppRoute';
17
13
  import Footer from './Footer';
18
14
  import Header from './Header';
19
15
 
20
- import '../../i18n/config';
21
-
22
16
  const StyledBox = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
23
17
  backgroundColor: theme?.palette.background.default,
24
18
  }));
@@ -32,35 +26,8 @@ const StyledBoxContent = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
32
26
  },
33
27
  }));
34
28
 
35
- /* eslint-disable react/jsx-no-bind */
36
- /* eslint-disable react-hooks/exhaustive-deps */
37
29
  const App: React.FC = () => {
38
- const [user, setUser] = useState<undefined | { username: string | null }>();
39
- /**
40
- * Logout user
41
- * Required by: <Header />
42
- */
43
- const logout = () => {
44
- storage.removeItem('username');
45
- storage.removeItem('token');
46
- setUser(undefined);
47
- };
48
-
49
- const checkUserAlreadyLoggedIn = () => {
50
- // checks for token validity
51
- const token = storage.getItem('token');
52
- const username = storage.getItem('username');
53
-
54
- if (isTokenExpire(token) || isNil(username)) {
55
- logout();
56
- return;
57
- }
58
-
59
- setUser({ username });
60
- };
61
-
62
30
  useEffect(() => {
63
- checkUserAlreadyLoggedIn();
64
31
  loadDayJSLocale();
65
32
  }, []);
66
33
 
@@ -70,12 +37,10 @@ const App: React.FC = () => {
70
37
  <StyledBox display="flex" flexDirection="column" height="100%">
71
38
  <>
72
39
  <Router history={history}>
73
- <AppContextProvider user={user}>
74
- <Header />
75
- <StyledBoxContent flexGrow={1}>
76
- <AppRoute />
77
- </StyledBoxContent>
78
- </AppContextProvider>
40
+ <Header />
41
+ <StyledBoxContent flexGrow={1}>
42
+ <AppRoute />
43
+ </StyledBoxContent>
79
44
  </Router>
80
45
  <Footer />
81
46
  </>
@@ -1,9 +1,7 @@
1
1
  import { createBrowserHistory } from 'history';
2
- import React, { useContext } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { Route as ReactRouterDomRoute, Switch, Router } from 'react-router-dom';
2
+ import React from 'react';
3
+ import { Route as ReactRouterDomRoute, Router, Switch } from 'react-router-dom';
5
4
 
6
- import AppContext from './AppContext';
7
5
  import loadable from './utils/loadable';
8
6
 
9
7
  const NotFound = loadable(
@@ -28,22 +26,11 @@ export const history = createBrowserHistory({
28
26
  });
29
27
 
30
28
  const AppRoute: React.FC = () => {
31
- const appContext = useContext(AppContext);
32
- const { t } = useTranslation();
33
-
34
- if (!appContext) {
35
- throw Error(t('app-context-not-correct-used'));
36
- }
37
-
38
- const { user } = appContext;
39
-
40
- const isUserLoggedIn = user?.username;
41
-
42
29
  return (
43
30
  <Router history={history}>
44
31
  <Switch>
45
32
  <ReactRouterDomRoute exact={true} path={Route.ROOT}>
46
- <HomePage isUserLoggedIn={!!isUserLoggedIn} />
33
+ <HomePage />
47
34
  </ReactRouterDomRoute>
48
35
  <ReactRouterDomRoute exact={true} path={Route.PACKAGE}>
49
36
  <VersionContextProvider>
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
-
3
2
  import { render } from 'verdaccio-ui/utils/test-react-testing-library';
4
3
 
5
4
  import Footer from './Footer';