@collectionspace/cspace-public-browser 1.5.1

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 (233) hide show
  1. package/LICENSE.md +71 -0
  2. package/README.md +38 -0
  3. package/dist/cspacePublicBrowser.js +4680 -0
  4. package/dist/cspacePublicBrowser.min.js +2 -0
  5. package/dist/cspacePublicBrowser.min.js.LICENSE.txt +56 -0
  6. package/images/check.svg +3 -0
  7. package/images/close.svg +3 -0
  8. package/images/collapse.svg +3 -0
  9. package/images/collapseActive.svg +3 -0
  10. package/images/expand.svg +3 -0
  11. package/images/expandActive.svg +3 -0
  12. package/images/filter.svg +4 -0
  13. package/images/hideLeft.svg +4 -0
  14. package/images/linkBack.svg +4 -0
  15. package/images/linkDown.svg +4 -0
  16. package/images/linkNext.svg +4 -0
  17. package/images/linkPrev.svg +4 -0
  18. package/images/openNew.svg +4 -0
  19. package/images/search.svg +4 -0
  20. package/images/select.svg +4 -0
  21. package/images/top.svg +1 -0
  22. package/lib/actions/detailActions.js +177 -0
  23. package/lib/actions/filterActions.js +16 -0
  24. package/lib/actions/mediaActions.js +63 -0
  25. package/lib/actions/prefsActions.js +84 -0
  26. package/lib/actions/searchActions.js +140 -0
  27. package/lib/actions/searchEntryFormActions.js +19 -0
  28. package/lib/components/App.js +24 -0
  29. package/lib/components/detail/DetailNavBar.js +98 -0
  30. package/lib/components/detail/DetailPanel.js +171 -0
  31. package/lib/components/detail/DetailPanelContainer.js +22 -0
  32. package/lib/components/detail/ExhibitionSection.js +54 -0
  33. package/lib/components/detail/FieldList.js +95 -0
  34. package/lib/components/detail/FieldValueList.js +30 -0
  35. package/lib/components/detail/ImageGallery.js +137 -0
  36. package/lib/components/detail/ImageGalleryContainer.js +19 -0
  37. package/lib/components/detail/InstitutionHoldingList.js +155 -0
  38. package/lib/components/detail/InstitutionHoldingListContainer.js +22 -0
  39. package/lib/components/detail/InstitutionIndex.js +53 -0
  40. package/lib/components/detail/InstitutionIndexContainer.js +15 -0
  41. package/lib/components/detail/InstitutionSection.js +44 -0
  42. package/lib/components/detail/InstitutionSectionContainer.js +15 -0
  43. package/lib/components/layout/Fixed.js +26 -0
  44. package/lib/components/layout/IconButton.js +41 -0
  45. package/lib/components/layout/Panel.js +56 -0
  46. package/lib/components/layout/PanelContainer.js +19 -0
  47. package/lib/components/layout/PanelTitle.js +38 -0
  48. package/lib/components/layout/ScrollTopButton.js +70 -0
  49. package/lib/components/layout/ToggleFilterPanelButton.js +42 -0
  50. package/lib/components/pages/DetailPage.js +93 -0
  51. package/lib/components/pages/DetailPageContainer.js +20 -0
  52. package/lib/components/pages/RootPage.js +41 -0
  53. package/lib/components/pages/SearchPage.js +130 -0
  54. package/lib/components/pages/SearchPageContainer.js +23 -0
  55. package/lib/components/search/entry/SearchEntryForm.js +74 -0
  56. package/lib/components/search/entry/SearchEntryFormContainer.js +20 -0
  57. package/lib/components/search/entry/SearchEntryPanel.js +30 -0
  58. package/lib/components/search/entry/SearchQueryInput.js +89 -0
  59. package/lib/components/search/entry/SearchSubmitButton.js +22 -0
  60. package/lib/components/search/entry/SortSelect.js +89 -0
  61. package/lib/components/search/entry/SortSelectContainer.js +15 -0
  62. package/lib/components/search/result/ClearSearchParamsLink.js +42 -0
  63. package/lib/components/search/result/Filter.js +186 -0
  64. package/lib/components/search/result/FilterContainer.js +22 -0
  65. package/lib/components/search/result/FilterGroup.js +72 -0
  66. package/lib/components/search/result/FilterList.js +48 -0
  67. package/lib/components/search/result/FilterPanel.js +115 -0
  68. package/lib/components/search/result/FilterPanelContainer.js +16 -0
  69. package/lib/components/search/result/FilterSearchInput.js +63 -0
  70. package/lib/components/search/result/RemoveSearchParamLink.js +66 -0
  71. package/lib/components/search/result/SearchError.js +29 -0
  72. package/lib/components/search/result/SearchLoadMore.js +36 -0
  73. package/lib/components/search/result/SearchParamList.js +41 -0
  74. package/lib/components/search/result/SearchPending.js +21 -0
  75. package/lib/components/search/result/SearchResultImage.js +227 -0
  76. package/lib/components/search/result/SearchResultList.js +119 -0
  77. package/lib/components/search/result/SearchResultPanel.js +139 -0
  78. package/lib/components/search/result/SearchResultPanelContainer.js +23 -0
  79. package/lib/components/search/result/SearchResultStats.js +39 -0
  80. package/lib/components/search/result/SearchResultTile.js +61 -0
  81. package/lib/config/anthro.js +123 -0
  82. package/lib/config/bonsai.js +50 -0
  83. package/lib/config/botgarden.js +10 -0
  84. package/lib/config/default.js +530 -0
  85. package/lib/config/fcart.js +36 -0
  86. package/lib/config/herbarium.js +10 -0
  87. package/lib/config/index.js +53 -0
  88. package/lib/config/lhmc.js +10 -0
  89. package/lib/config/materials.js +982 -0
  90. package/lib/config/publicart.js +10 -0
  91. package/lib/constants/actionCodes.js +46 -0
  92. package/lib/constants/ids.js +12 -0
  93. package/lib/helpers/bodyClassName.js +11 -0
  94. package/lib/helpers/esQueryHelpers.js +206 -0
  95. package/lib/helpers/formatHelpers.js +293 -0
  96. package/lib/helpers/searchDimensions.js +28 -0
  97. package/lib/helpers/urlHelpers.js +43 -0
  98. package/lib/index.js +53 -0
  99. package/lib/intl/index.js +16 -0
  100. package/lib/reducers/detailReducer.js +145 -0
  101. package/lib/reducers/filterReducer.js +22 -0
  102. package/lib/reducers/index.js +66 -0
  103. package/lib/reducers/mediaReducer.js +43 -0
  104. package/lib/reducers/prefsReducer.js +27 -0
  105. package/lib/reducers/searchEntryFormReducer.js +24 -0
  106. package/lib/reducers/searchReducer.js +88 -0
  107. package/package.json +118 -0
  108. package/src/actions/detailActions.js +231 -0
  109. package/src/actions/filterActions.js +10 -0
  110. package/src/actions/mediaActions.js +65 -0
  111. package/src/actions/prefsActions.js +95 -0
  112. package/src/actions/searchActions.js +188 -0
  113. package/src/actions/searchEntryFormActions.js +15 -0
  114. package/src/components/App.jsx +18 -0
  115. package/src/components/detail/DetailNavBar.jsx +132 -0
  116. package/src/components/detail/DetailPanel.jsx +215 -0
  117. package/src/components/detail/DetailPanelContainer.js +29 -0
  118. package/src/components/detail/ExhibitionSection.jsx +71 -0
  119. package/src/components/detail/FieldList.jsx +122 -0
  120. package/src/components/detail/FieldValueList.jsx +31 -0
  121. package/src/components/detail/ImageGallery.jsx +153 -0
  122. package/src/components/detail/ImageGalleryContainer.js +17 -0
  123. package/src/components/detail/InstitutionHoldingList.jsx +188 -0
  124. package/src/components/detail/InstitutionHoldingListContainer.js +29 -0
  125. package/src/components/detail/InstitutionIndex.jsx +57 -0
  126. package/src/components/detail/InstitutionIndexContainer.js +11 -0
  127. package/src/components/detail/InstitutionSection.jsx +48 -0
  128. package/src/components/detail/InstitutionSectionContainer.js +11 -0
  129. package/src/components/layout/Fixed.jsx +29 -0
  130. package/src/components/layout/IconButton.jsx +41 -0
  131. package/src/components/layout/Panel.jsx +60 -0
  132. package/src/components/layout/PanelContainer.js +20 -0
  133. package/src/components/layout/PanelTitle.jsx +43 -0
  134. package/src/components/layout/ScrollTopButton.jsx +76 -0
  135. package/src/components/layout/ToggleFilterPanelButton.jsx +43 -0
  136. package/src/components/pages/DetailPage.jsx +101 -0
  137. package/src/components/pages/DetailPageContainer.js +18 -0
  138. package/src/components/pages/RootPage.jsx +37 -0
  139. package/src/components/pages/SearchPage.jsx +160 -0
  140. package/src/components/pages/SearchPageContainer.js +21 -0
  141. package/src/components/search/entry/SearchEntryForm.jsx +82 -0
  142. package/src/components/search/entry/SearchEntryFormContainer.js +22 -0
  143. package/src/components/search/entry/SearchEntryPanel.jsx +28 -0
  144. package/src/components/search/entry/SearchQueryInput.jsx +95 -0
  145. package/src/components/search/entry/SearchSubmitButton.jsx +22 -0
  146. package/src/components/search/entry/SortSelect.jsx +104 -0
  147. package/src/components/search/entry/SortSelectContainer.js +12 -0
  148. package/src/components/search/result/ClearSearchParamsLink.jsx +43 -0
  149. package/src/components/search/result/Filter.jsx +226 -0
  150. package/src/components/search/result/FilterContainer.js +20 -0
  151. package/src/components/search/result/FilterGroup.jsx +83 -0
  152. package/src/components/search/result/FilterList.jsx +51 -0
  153. package/src/components/search/result/FilterPanel.jsx +143 -0
  154. package/src/components/search/result/FilterPanelContainer.js +16 -0
  155. package/src/components/search/result/FilterSearchInput.jsx +68 -0
  156. package/src/components/search/result/RemoveSearchParamLink.jsx +79 -0
  157. package/src/components/search/result/SearchError.jsx +30 -0
  158. package/src/components/search/result/SearchLoadMore.jsx +37 -0
  159. package/src/components/search/result/SearchParamList.jsx +47 -0
  160. package/src/components/search/result/SearchPending.jsx +19 -0
  161. package/src/components/search/result/SearchResultImage.jsx +275 -0
  162. package/src/components/search/result/SearchResultList.jsx +144 -0
  163. package/src/components/search/result/SearchResultPanel.jsx +169 -0
  164. package/src/components/search/result/SearchResultPanelContainer.js +31 -0
  165. package/src/components/search/result/SearchResultStats.jsx +38 -0
  166. package/src/components/search/result/SearchResultTile.jsx +70 -0
  167. package/src/config/anthro.js +153 -0
  168. package/src/config/bonsai.js +50 -0
  169. package/src/config/botgarden.js +3 -0
  170. package/src/config/default.js +604 -0
  171. package/src/config/fcart.js +38 -0
  172. package/src/config/herbarium.js +3 -0
  173. package/src/config/index.js +51 -0
  174. package/src/config/lhmc.js +3 -0
  175. package/src/config/materials.js +1173 -0
  176. package/src/config/publicart.js +3 -0
  177. package/src/constants/actionCodes.js +26 -0
  178. package/src/constants/ids.js +3 -0
  179. package/src/helpers/bodyClassName.js +5 -0
  180. package/src/helpers/esQueryHelpers.js +224 -0
  181. package/src/helpers/formatHelpers.jsx +361 -0
  182. package/src/helpers/searchDimensions.js +21 -0
  183. package/src/helpers/urlHelpers.js +49 -0
  184. package/src/index.jsx +59 -0
  185. package/src/intl/index.js +16 -0
  186. package/src/reducers/detailReducer.js +201 -0
  187. package/src/reducers/filterReducer.js +16 -0
  188. package/src/reducers/index.js +56 -0
  189. package/src/reducers/mediaReducer.js +44 -0
  190. package/src/reducers/prefsReducer.js +24 -0
  191. package/src/reducers/searchEntryFormReducer.js +19 -0
  192. package/src/reducers/searchReducer.js +118 -0
  193. package/styles/colors.css +7 -0
  194. package/styles/cspace/DetailNavBar.css +17 -0
  195. package/styles/cspace/DetailPage.css +3 -0
  196. package/styles/cspace/DetailPanel.css +69 -0
  197. package/styles/cspace/ExhibitionSection.css +9 -0
  198. package/styles/cspace/FieldList.css +15 -0
  199. package/styles/cspace/FieldListField.css +7 -0
  200. package/styles/cspace/FieldListGroup.css +27 -0
  201. package/styles/cspace/FieldValueList.css +19 -0
  202. package/styles/cspace/Filter.css +64 -0
  203. package/styles/cspace/FilterGroup.css +21 -0
  204. package/styles/cspace/FilterPanel.css +45 -0
  205. package/styles/cspace/FilterSearchInput.css +13 -0
  206. package/styles/cspace/Fixed.css +8 -0
  207. package/styles/cspace/IconButton.css +11 -0
  208. package/styles/cspace/ImageGallery.css +43 -0
  209. package/styles/cspace/InstitutionHoldingList.css +109 -0
  210. package/styles/cspace/InstitutionIndex.css +13 -0
  211. package/styles/cspace/InstitutionSection.css +4 -0
  212. package/styles/cspace/Link.css +39 -0
  213. package/styles/cspace/Panel.css +53 -0
  214. package/styles/cspace/PanelTitle.css +48 -0
  215. package/styles/cspace/RemoveSearchParamLink.css +15 -0
  216. package/styles/cspace/RootPage.css +60 -0
  217. package/styles/cspace/ScrollTopButton.css +32 -0
  218. package/styles/cspace/SearchEntryForm.css +4 -0
  219. package/styles/cspace/SearchEntryPanel.css +11 -0
  220. package/styles/cspace/SearchPage.css +2 -0
  221. package/styles/cspace/SearchParamLink.css +21 -0
  222. package/styles/cspace/SearchParamList.css +6 -0
  223. package/styles/cspace/SearchQueryInput.css +30 -0
  224. package/styles/cspace/SearchResultImage.css +29 -0
  225. package/styles/cspace/SearchResultList.css +10 -0
  226. package/styles/cspace/SearchResultPanel.css +31 -0
  227. package/styles/cspace/SearchResultStats.css +4 -0
  228. package/styles/cspace/SearchResultTile.css +67 -0
  229. package/styles/cspace/SearchStatus.css +12 -0
  230. package/styles/cspace/SearchSubmitButton.css +3 -0
  231. package/styles/cspace/SortSelect.css +19 -0
  232. package/styles/cspace/ToggleFilterPanelButton.css +44 -0
  233. package/styles/dimensions.css +9 -0
@@ -0,0 +1,56 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ Copyright (c) 2018 Jed Watson.
9
+ Licensed under the MIT License (MIT), see
10
+ http://jedwatson.github.io/classnames
11
+ */
12
+
13
+ /** @license React v0.19.1
14
+ * scheduler.production.min.js
15
+ *
16
+ * Copyright (c) Facebook, Inc. and its affiliates.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+
22
+ /** @license React v16.13.1
23
+ * react-is.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+
31
+ /** @license React v16.14.0
32
+ * react-dom.production.min.js
33
+ *
34
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */
39
+
40
+ /** @license React v16.14.0
41
+ * react.production.min.js
42
+ *
43
+ * Copyright (c) Facebook, Inc. and its affiliates.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE file in the root directory of this source tree.
47
+ */
48
+
49
+ /** @license React v17.0.2
50
+ * react-is.production.min.js
51
+ *
52
+ * Copyright (c) Facebook, Inc. and its affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ */
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <path fill="#000000" d="M9,16.2,4.8,12,3.4,13.4,9,19,21,7,19.6,5.6Z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 24 24">
2
+ <path fill="#000000" d="M19,6.41,17.59,5,12,10.59,6.41,5,5,6.41,10.59,12,5,17.59,6.41,19,12,13.41,17.59,19,19,17.59,13.41,12Z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#424242" d="M16.59 15.71L12 11.13L7.41 15.71L6 14.3L12 8.3L18 14.3L16.59 15.71Z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#424242" d="M14.66 1.53L15.91 1.92L17.08 2.46L18.17 3.13L19.18 3.92L20.08 4.83L20.87 5.83L21.54 6.92L22.08 8.1L22.48 9.34L22.72 10.64L22.81 12L22.72 13.35L22.48 14.66L22.08 15.9L21.54 17.07L20.87 18.17L20.08 19.17L19.18 20.07L18.17 20.86L17.08 21.53L15.91 22.07L14.66 22.47L13.36 22.72L12.01 22.8L10.65 22.72L9.35 22.47L8.1 22.07L6.93 21.53L5.84 20.86L4.83 20.07L3.93 19.17L3.14 18.17L2.47 17.07L1.93 15.9L1.53 14.66L1.29 13.35L1.2 12L1.29 10.64L1.53 9.34L1.93 8.1L2.47 6.92L3.14 5.83L3.93 4.83L4.83 3.92L5.84 3.13L6.93 2.46L8.1 1.92L9.35 1.53L10.65 1.28L12.01 1.2L13.36 1.28L14.66 1.53ZM7.42 14.87L12.01 10.29L16.6 14.87L18.01 13.46L12.01 7.46L6.01 13.46L7.42 14.87Z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#424242" d="M16.59 8.3L12 12.88L7.41 8.3L6 9.71L12 15.71L18 9.71L16.59 8.3Z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#424242" d="M14.66 1.53L15.91 1.93L17.08 2.47L18.17 3.14L19.18 3.93L20.08 4.83L20.87 5.83L21.54 6.93L22.08 8.1L22.48 9.34L22.72 10.65L22.81 12L22.72 13.36L22.48 14.66L22.08 15.9L21.54 17.08L20.87 18.17L20.08 19.17L19.18 20.08L18.17 20.87L17.08 21.54L15.91 22.08L14.66 22.47L13.36 22.72L12.01 22.8L10.65 22.72L9.35 22.47L8.1 22.08L6.93 21.54L5.84 20.87L4.83 20.08L3.93 19.17L3.14 18.17L2.47 17.08L1.93 15.9L1.53 14.66L1.29 13.36L1.2 12L1.29 10.65L1.53 9.34L1.93 8.1L2.47 6.93L3.14 5.83L3.93 4.83L4.83 3.93L5.84 3.14L6.93 2.47L8.1 1.93L9.35 1.53L10.65 1.28L12.01 1.2L13.36 1.28L14.66 1.53ZM7.42 9.13L6.01 10.54L12.01 16.54L18.01 10.54L16.6 9.13L12.01 13.71L7.42 9.13Z" id="ahUZWbPiU"></path>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
3
+ <path d="M0 0h24v24H0z" fill="none"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
3
+ <path d="M0 0h24v24H0z" fill="none"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="none" d="M0 0h24v24H0z"/>
3
+ <path fill="#337ab7" d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="none" d="M0 0h24v24H0V0z"/>
3
+ <path fill="#337ab7" d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#337ab7" d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
3
+ <path fill="none" d="M0 0h24v24H0z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#337ab7" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
3
+ <path fill="none" d="M0 0h24v24H0z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path d="M0 0h24v24H0z" fill="none"/>
3
+ <path fill="#337ab7" d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#444444" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
3
+ <path d="M0 0h24v24H0z" fill="none"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path d="M0 0h24v24H0z" fill="none"/>
3
+ <path fill="#444444" d="M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"/>
4
+ </svg>
package/images/top.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/></svg>
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setDetailParams = exports.readDetail = exports.findInstitutionHoldings = exports.findAllInstitutionHoldings = exports.clearDetail = void 0;
7
+ var _config = _interopRequireDefault(require("../config"));
8
+ var _urlHelpers = require("../helpers/urlHelpers");
9
+ var _reducers = require("../reducers");
10
+ var _actionCodes = require("../constants/actionCodes");
11
+ var _esQueryHelpers = require("../helpers/esQueryHelpers");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ /* global fetch */
14
+
15
+ const clearDetail = () => ({
16
+ type: _actionCodes.CLEAR_DETAIL
17
+ });
18
+ exports.clearDetail = clearDetail;
19
+ const setDetailParams = (location, match) => {
20
+ const params = (0, _urlHelpers.locationToDetailParams)(location, match);
21
+ return {
22
+ type: _actionCodes.SET_DETAIL_PARAMS,
23
+ payload: params
24
+ };
25
+ };
26
+ exports.setDetailParams = setDetailParams;
27
+ const findInstitutionHoldings = institutionId => (dispatch, getState) => {
28
+ const params = (0, _reducers.getDetailParams)(getState());
29
+ const data = (0, _reducers.getDetailData)(getState());
30
+ if (!params || !data || (0, _reducers.isDetailPending)(getState()) || (0, _reducers.isDetailInstSearchPending)(getState(), institutionId)) {
31
+ return Promise.resolve();
32
+ }
33
+ const holdingsConfig = _config.default.get('institutionHoldings') || {};
34
+ const {
35
+ sortField,
36
+ sortOrder,
37
+ query: queryBuilder
38
+ } = holdingsConfig;
39
+ const institutionsConfig = _config.default.get('institutions') || {};
40
+ const institutionConfig = institutionsConfig[institutionId];
41
+ if (!queryBuilder || !institutionConfig) {
42
+ return Promise.resolve();
43
+ }
44
+ const {
45
+ gatewayUrl
46
+ } = institutionConfig;
47
+ const url = `${gatewayUrl}/es/doc/_search`;
48
+ const query = queryBuilder(data);
49
+ const payload = {
50
+ query,
51
+ from: 0,
52
+ size: 500
53
+ };
54
+ if (sortField) {
55
+ payload.sort = {
56
+ [sortField]: {
57
+ order: sortOrder || 'asc'
58
+ }
59
+ };
60
+ }
61
+ dispatch({
62
+ type: _actionCodes.INST_SEARCH_STARTED,
63
+ meta: {
64
+ institutionId,
65
+ params
66
+ }
67
+ });
68
+ return fetch(url, {
69
+ method: 'POST',
70
+ headers: {
71
+ 'Content-Type': 'application/json'
72
+ },
73
+ body: JSON.stringify(payload)
74
+ }).then(response => {
75
+ if (!response.ok) {
76
+ const error = new Error();
77
+ error.response = response;
78
+ return Promise.reject(error);
79
+ }
80
+ return response.json();
81
+ }).then(responseData => {
82
+ dispatch({
83
+ type: _actionCodes.INST_SEARCH_FULFILLED,
84
+ payload: responseData,
85
+ meta: {
86
+ institutionId,
87
+ params
88
+ }
89
+ });
90
+ }).catch(error => {
91
+ dispatch({
92
+ type: _actionCodes.INST_SEARCH_REJECTED,
93
+ payload: error,
94
+ meta: {
95
+ institutionId,
96
+ params
97
+ }
98
+ });
99
+ });
100
+ };
101
+ exports.findInstitutionHoldings = findInstitutionHoldings;
102
+ const findAllInstitutionHoldings = () => dispatch => {
103
+ const institutionsConfig = _config.default.get('institutions');
104
+ if (!institutionsConfig) {
105
+ return Promise.resolve();
106
+ }
107
+ return Promise.all(Object.keys(institutionsConfig).map(institutionId => dispatch(findInstitutionHoldings(institutionId))));
108
+ };
109
+ exports.findAllInstitutionHoldings = findAllInstitutionHoldings;
110
+ const readDetail = () => (dispatch, getState) => {
111
+ const params = (0, _reducers.getDetailParams)(getState());
112
+ if (!params || (0, _reducers.isDetailPending)(getState())) {
113
+ return Promise.resolve();
114
+ }
115
+ const gatewayUrl = _config.default.get('gatewayUrl');
116
+ const url = `${gatewayUrl}/es/doc/_msearch`;
117
+ const csid = params.get('csid');
118
+ const index = params.get('index');
119
+ const searchParams = params.get('searchParams');
120
+ const detailPayload = {
121
+ query: {
122
+ term: {
123
+ 'ecm:name': csid
124
+ }
125
+ },
126
+ from: 0,
127
+ size: 1
128
+ };
129
+ const bodyParts = [JSON.stringify({
130
+ preference: 'detail'
131
+ }), JSON.stringify(detailPayload)];
132
+ if (searchParams && typeof index !== 'undefined') {
133
+ const adjacentResultsPayload = (0, _esQueryHelpers.getSearchResultPayload)(searchParams, 3, Math.max(0, index - 1));
134
+ bodyParts.push(JSON.stringify({
135
+ preference: 'adjacent'
136
+ }));
137
+ bodyParts.push(JSON.stringify(adjacentResultsPayload));
138
+ }
139
+ dispatch({
140
+ type: _actionCodes.DETAIL_READ_STARTED,
141
+ meta: {
142
+ params
143
+ }
144
+ });
145
+ return fetch(url, {
146
+ method: 'POST',
147
+ headers: {
148
+ 'Content-Type': 'application/x-ndjson'
149
+ },
150
+ body: bodyParts.join('\n')
151
+ }).then(response => {
152
+ if (!response.ok) {
153
+ const error = new Error();
154
+ error.response = response;
155
+ return Promise.reject(error);
156
+ }
157
+ return response.json();
158
+ }).then(data => {
159
+ dispatch({
160
+ type: _actionCodes.DETAIL_READ_FULFILLED,
161
+ payload: data,
162
+ meta: {
163
+ params
164
+ }
165
+ });
166
+ dispatch(findAllInstitutionHoldings());
167
+ }).catch(error => {
168
+ dispatch({
169
+ type: _actionCodes.DETAIL_READ_REJECTED,
170
+ payload: error,
171
+ meta: {
172
+ params
173
+ }
174
+ });
175
+ });
176
+ };
177
+ exports.readDetail = readDetail;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setFilterSearchValue = void 0;
7
+ var _actionCodes = require("../constants/actionCodes");
8
+ // eslint-disable-next-line import/prefer-default-export
9
+ const setFilterSearchValue = (id, value) => ({
10
+ type: _actionCodes.SET_FILTER_SEARCH_VALUE,
11
+ payload: value,
12
+ meta: {
13
+ id
14
+ }
15
+ });
16
+ exports.setFilterSearchValue = setFilterSearchValue;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setMedia = exports.findMedia = void 0;
7
+ var _get = _interopRequireDefault(require("lodash/get"));
8
+ var _config = _interopRequireDefault(require("../config"));
9
+ var _reducers = require("../reducers");
10
+ var _actionCodes = require("../constants/actionCodes");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /* global fetch */
13
+
14
+ const setMedia = (referenceValue, institutionId, mediaCsids, mediaAltTexts, title) => ({
15
+ type: _actionCodes.SET_MEDIA,
16
+ payload: {
17
+ title,
18
+ csids: mediaCsids,
19
+ altTexts: mediaAltTexts
20
+ },
21
+ meta: {
22
+ institutionId,
23
+ referenceValue
24
+ }
25
+ });
26
+ exports.setMedia = setMedia;
27
+ const findMedia = (referenceValue, institutionId) => (dispatch, getState) => {
28
+ if ((0, _reducers.getMedia)(getState(), referenceValue, institutionId)) {
29
+ return Promise.resolve();
30
+ }
31
+ let gatewayUrl;
32
+ if (institutionId === null) {
33
+ gatewayUrl = _config.default.get('gatewayUrl');
34
+ } else {
35
+ gatewayUrl = _config.default.get(['institutions', institutionId, 'gatewayUrl']);
36
+ }
37
+ const url = `${gatewayUrl}/es/doc/_search`;
38
+ const referenceField = _config.default.get('referenceField');
39
+ const query = {
40
+ _source: ['collectionspace_denorm:mediaCsid', 'collectionspace_denorm:mediaAltText', 'collectionspace_denorm:title'],
41
+ query: {
42
+ term: {
43
+ [referenceField]: referenceValue
44
+ }
45
+ },
46
+ size: 1,
47
+ terminate_after: 1
48
+ };
49
+ return fetch(url, {
50
+ method: 'POST',
51
+ headers: {
52
+ 'Content-Type': 'application/json'
53
+ },
54
+ body: JSON.stringify(query)
55
+ }).then(response => response.json()).then(data => {
56
+ const source = (0, _get.default)(data, ['hits', 'hits', 0, '_source']);
57
+ const title = (0, _get.default)(source, 'collectionspace_denorm:title');
58
+ const mediaCsids = (0, _get.default)(source, 'collectionspace_denorm:mediaCsid') || [];
59
+ const mediaAltTexts = (0, _get.default)(source, 'collectionspace_denorm:mediaAltText') || [];
60
+ return dispatch(setMedia(referenceValue, institutionId, mediaCsids, mediaAltTexts, title));
61
+ });
62
+ };
63
+ exports.findMedia = findMedia;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.togglePanel = exports.savePrefs = exports.loadPrefs = exports.expandPanel = void 0;
7
+ var _immutable = _interopRequireDefault(require("immutable"));
8
+ var _actionCodes = require("../constants/actionCodes");
9
+ var _config = _interopRequireDefault(require("../config"));
10
+ var _reducers = require("../reducers");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /* global window */
13
+
14
+ // Username to use for pref storage when user is not logged in
15
+ const anonymousUsername = '*';
16
+ const loadPrefs = () => dispatch => {
17
+ const username = anonymousUsername;
18
+ const storageKey = _config.default.get('storageKey');
19
+ let userPrefs = null;
20
+ if (username) {
21
+ const serializedPrefs = window.localStorage.getItem(storageKey);
22
+ if (serializedPrefs) {
23
+ try {
24
+ userPrefs = _immutable.default.fromJS(JSON.parse(serializedPrefs)[username]);
25
+ } catch (error) {
26
+ userPrefs = null;
27
+ }
28
+ }
29
+ }
30
+ const defaultUserPrefs = _config.default.get('defaultUserPrefs');
31
+ if (defaultUserPrefs) {
32
+ userPrefs = _immutable.default.fromJS(defaultUserPrefs).mergeDeep(userPrefs);
33
+ }
34
+ dispatch({
35
+ type: _actionCodes.PREFS_LOADED,
36
+ payload: userPrefs
37
+ });
38
+ };
39
+ exports.loadPrefs = loadPrefs;
40
+ const savePrefs = () => (dispatch, getState) => {
41
+ const username = anonymousUsername;
42
+ const storageKey = _config.default.get('storageKey');
43
+ let prefs;
44
+ if (username) {
45
+ const serializedPrefs = window.localStorage.getItem(storageKey);
46
+ if (serializedPrefs) {
47
+ try {
48
+ prefs = JSON.parse(serializedPrefs);
49
+ } catch (error) {
50
+ prefs = null;
51
+ }
52
+ }
53
+ if (!prefs) {
54
+ prefs = {};
55
+ }
56
+ prefs[username] = (0, _reducers.getPrefs)(getState()).toJS();
57
+ window.localStorage.setItem(storageKey, JSON.stringify(prefs));
58
+ }
59
+ };
60
+ exports.savePrefs = savePrefs;
61
+ const expandPanel = function (id) {
62
+ let expanded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
63
+ return dispatch => {
64
+ dispatch({
65
+ type: _actionCodes.EXPAND_PANEL,
66
+ payload: expanded,
67
+ meta: {
68
+ id
69
+ }
70
+ });
71
+ dispatch(savePrefs());
72
+ };
73
+ };
74
+ exports.expandPanel = expandPanel;
75
+ const togglePanel = id => dispatch => {
76
+ dispatch({
77
+ type: _actionCodes.TOGGLE_PANEL,
78
+ meta: {
79
+ id
80
+ }
81
+ });
82
+ dispatch(savePrefs());
83
+ };
84
+ exports.togglePanel = togglePanel;
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setSearchParams = exports.setSearchPageSize = exports.search = exports.openSearch = exports.applySortOrder = exports.applyFilter = void 0;
7
+ var _immutable = _interopRequireDefault(require("immutable"));
8
+ var _config = _interopRequireDefault(require("../config"));
9
+ var _ids = require("../constants/ids");
10
+ var _urlHelpers = require("../helpers/urlHelpers");
11
+ var _reducers = require("../reducers");
12
+ var _actionCodes = require("../constants/actionCodes");
13
+ var _esQueryHelpers = require("../helpers/esQueryHelpers");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ /* global fetch, window */
16
+
17
+ const openSearch = function (history) {
18
+ let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _immutable.default.Map();
19
+ const queryString = (0, _urlHelpers.searchParamsToQueryString)(params);
20
+ history.push({
21
+ search: `?${queryString}`
22
+ });
23
+ return {
24
+ type: _actionCodes.OPEN_SEARCH,
25
+ payload: queryString
26
+ };
27
+ };
28
+ exports.openSearch = openSearch;
29
+ const search = function () {
30
+ let fetchDelay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
31
+ return (dispatch, getState) => {
32
+ const params = (0, _reducers.getSearchParams)(getState());
33
+ if (!params || (0, _reducers.isSearchPending)(getState()) || !(0, _reducers.searchHasMore)(getState())) {
34
+ return Promise.resolve();
35
+ }
36
+ const gatewayUrl = _config.default.get('gatewayUrl');
37
+ const url = `${gatewayUrl}/es/doc/_msearch`;
38
+ const offset = (0, _reducers.getSearchNextOffset)(getState()) || 0;
39
+ const pageSize = (0, _reducers.getSearchPageSize)(getState()) || 15;
40
+ const resultPayload = (0, _esQueryHelpers.getSearchResultPayload)(params, pageSize, offset);
41
+ let filterAggPayloads = [];
42
+ if (offset === 0) {
43
+ // When loading the first page, get aggregations.
44
+
45
+ resultPayload.aggs = (0, _esQueryHelpers.getAggs)(params);
46
+ filterAggPayloads = params.delete(_ids.SORT_ID).delete(_ids.SEARCH_QUERY_ID).keySeq().flatMap(id => {
47
+ const filterFieldConfig = _config.default.getFilterFieldConfig(id);
48
+ return [{
49
+ preference: id
50
+ }, {
51
+ query: (0, _esQueryHelpers.getQuery)(params.delete(id)),
52
+ size: 0,
53
+ aggs: {
54
+ [id]: (0, _esQueryHelpers.getFilterAgg)(filterFieldConfig)
55
+ }
56
+ }];
57
+ }).toJS();
58
+ }
59
+ dispatch({
60
+ type: _actionCodes.SEARCH_STARTED
61
+ });
62
+ const delay = new Promise(resolve => {
63
+ window.setTimeout(() => {
64
+ resolve();
65
+ }, fetchDelay);
66
+ });
67
+ return delay.then(() => fetch(url, {
68
+ method: 'POST',
69
+ headers: {
70
+ 'Content-Type': 'application/x-ndjson'
71
+ },
72
+ body: [JSON.stringify({
73
+ preference: 'result'
74
+ }), JSON.stringify(resultPayload), ...filterAggPayloads.map(payload => JSON.stringify(payload))].join('\n')
75
+ })).then(response => {
76
+ if (!response.ok) {
77
+ const error = new Error();
78
+ error.response = response;
79
+ return Promise.reject(error);
80
+ }
81
+ return response.json();
82
+ }).then(data => {
83
+ dispatch({
84
+ type: _actionCodes.SEARCH_FULFILLED,
85
+ payload: data,
86
+ meta: {
87
+ offset,
88
+ pageSize,
89
+ params
90
+ }
91
+ });
92
+ }).catch(error => {
93
+ dispatch({
94
+ type: _actionCodes.SEARCH_REJECTED,
95
+ payload: error,
96
+ meta: {
97
+ offset,
98
+ pageSize,
99
+ params
100
+ }
101
+ });
102
+ });
103
+ };
104
+ };
105
+ exports.search = search;
106
+ const setSearchPageSize = pageSize => ({
107
+ type: _actionCodes.SET_SEARCH_PAGE_SIZE,
108
+ payload: pageSize
109
+ });
110
+ exports.setSearchPageSize = setSearchPageSize;
111
+ const setSearchParams = location => {
112
+ const params = (0, _urlHelpers.locationToSearchParams)(location);
113
+ return {
114
+ type: _actionCodes.SET_SEARCH_PARAMS,
115
+ payload: params
116
+ };
117
+ };
118
+ exports.setSearchParams = setSearchParams;
119
+ const applyFilter = (history, id, value, isSelected) => (dispatch, getState) => {
120
+ const params = (0, _reducers.getSearchParams)(getState());
121
+ let selectedValues = params.get(id) || _immutable.default.List();
122
+ if (!_immutable.default.List.isList(selectedValues)) {
123
+ selectedValues = _immutable.default.List.of(selectedValues);
124
+ }
125
+ let nextParams;
126
+ if (isSelected) {
127
+ nextParams = params.set(id, selectedValues.push(value));
128
+ } else {
129
+ const selectedIndex = selectedValues.indexOf(value);
130
+ if (selectedIndex >= 0) {
131
+ nextParams = selectedValues.size > 1 ? params.set(id, selectedValues.delete(selectedIndex)) : params.delete(id);
132
+ } else {
133
+ nextParams = params;
134
+ }
135
+ }
136
+ return dispatch(openSearch(history, nextParams));
137
+ };
138
+ exports.applyFilter = applyFilter;
139
+ const applySortOrder = (history, sortOrder) => (dispatch, getState) => dispatch(openSearch(history, (0, _reducers.getSearchParams)(getState()).set(_ids.SORT_ID, sortOrder)));
140
+ exports.applySortOrder = applySortOrder;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setSearchEntryFormParam = exports.applySearchEntryForm = void 0;
7
+ var _searchActions = require("./searchActions");
8
+ var _reducers = require("../reducers");
9
+ var _actionCodes = require("../constants/actionCodes");
10
+ const setSearchEntryFormParam = (id, value) => ({
11
+ type: _actionCodes.SET_SEARCH_ENTRY_FORM_PARAM,
12
+ payload: value,
13
+ meta: {
14
+ id
15
+ }
16
+ });
17
+ exports.setSearchEntryFormParam = setSearchEntryFormParam;
18
+ const applySearchEntryForm = history => (dispatch, getState) => dispatch((0, _searchActions.openSearch)(history, (0, _reducers.getSearchEntryFormParams)(getState())));
19
+ exports.applySearchEntryForm = applySearchEntryForm;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = App;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactRouter = require("react-router");
9
+ var _reactRouterDom = require("react-router-dom");
10
+ var _config = _interopRequireDefault(require("../config"));
11
+ var _RootPage = _interopRequireDefault(require("./pages/RootPage"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function App() {
14
+ const basename = _config.default.get('basename');
15
+ return /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, {
16
+ basename: basename
17
+ }, /*#__PURE__*/_react.default.createElement(_reactRouter.Switch, null, /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
18
+ exact: true,
19
+ path: "/",
20
+ to: "/search"
21
+ }), /*#__PURE__*/_react.default.createElement(_reactRouter.Route, {
22
+ component: _RootPage.default
23
+ })));
24
+ }