@digitalculture/ochre-sdk 0.12.9 → 0.12.11

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.
package/dist/index.d.mts CHANGED
@@ -618,7 +618,8 @@ type WebElement = {
618
618
  */
619
619
  type WebElementComponent = {
620
620
  component: "advanced-search";
621
- boundElementUuid: string;
621
+ boundElementUuid: string | null;
622
+ href: string | null;
622
623
  } | {
623
624
  component: "annotated-document";
624
625
  documentId: string;
@@ -661,11 +662,15 @@ type WebElementComponent = {
661
662
  variant: "full" | "highlights";
662
663
  itemVariant: "detailed" | "card" | "tile";
663
664
  paginationVariant: "default" | "numeric";
664
- isSearchDisplayed: boolean;
665
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
665
666
  isSortDisplayed: boolean;
666
667
  isFilterDisplayed: boolean;
667
668
  filterSort: "default" | "alphabetical";
668
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
669
+ search: {
670
+ isInputDisplayed: boolean;
671
+ isResultsBarDisplayed: boolean;
672
+ isMapDisplayed: boolean;
673
+ };
669
674
  options: {
670
675
  attributeFilters: {
671
676
  bibliographies: boolean;
package/dist/index.mjs CHANGED
@@ -1695,8 +1695,11 @@ function parseWebElementProperties(componentProperty, elementResource) {
1695
1695
  switch (componentName) {
1696
1696
  case "advanced-search": {
1697
1697
  const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
1698
- if (!boundElementPropertyUuid) throw new Error(`Bound element not found for the following component: “${componentName}”`);
1698
+ const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
1699
+ const href = linkToProperty?.values[0]?.href ?? linkToProperty?.values[0]?.slug ?? null;
1700
+ if (!boundElementPropertyUuid && !href) throw new Error(`Bound element or href not found for the following component: “${componentName}”`);
1699
1701
  properties.boundElementUuid = boundElementPropertyUuid;
1702
+ properties.href = href;
1700
1703
  break;
1701
1704
  }
1702
1705
  case "annotated-document": {
@@ -1798,9 +1801,15 @@ function parseWebElementProperties(componentProperty, elementResource) {
1798
1801
  itemVariant ??= "detailed";
1799
1802
  let paginationVariant = getPropertyValueByLabel(componentProperty.properties, "pagination-variant");
1800
1803
  paginationVariant ??= "default";
1801
- let isSearchDisplayed = false;
1802
- const isSearchDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "search-displayed");
1803
- if (isSearchDisplayedProperty !== null) isSearchDisplayed = isSearchDisplayedProperty === true;
1804
+ let isInputDisplayed = false;
1805
+ const isInputDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "input-displayed");
1806
+ if (isInputDisplayedProperty !== null) isInputDisplayed = isInputDisplayedProperty === true;
1807
+ let isResultsBarDisplayed = false;
1808
+ const isResultsBarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "results-bar-displayed");
1809
+ if (isResultsBarDisplayedProperty !== null) isResultsBarDisplayed = isResultsBarDisplayedProperty === true;
1810
+ let isMapDisplayed = false;
1811
+ const isMapDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "map-displayed");
1812
+ if (isMapDisplayedProperty !== null) isMapDisplayed = isMapDisplayedProperty === true;
1804
1813
  let isSortDisplayed = false;
1805
1814
  const isSortDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "sort-displayed");
1806
1815
  if (isSortDisplayedProperty !== null) isSortDisplayed = isSortDisplayedProperty === true;
@@ -1856,7 +1865,11 @@ function parseWebElementProperties(componentProperty, elementResource) {
1856
1865
  properties.variant = variant;
1857
1866
  properties.itemVariant = itemVariant;
1858
1867
  properties.paginationVariant = paginationVariant;
1859
- properties.isSearchDisplayed = isSearchDisplayed;
1868
+ properties.search = {
1869
+ isInputDisplayed,
1870
+ isResultsBarDisplayed,
1871
+ isMapDisplayed
1872
+ };
1860
1873
  properties.isSortDisplayed = isSortDisplayed;
1861
1874
  properties.isFilterDisplayed = isFilterDisplayed;
1862
1875
  properties.filterSort = filterSort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.12.9",
3
+ "version": "0.12.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",