@digitalculture/ochre-sdk 0.12.15 → 0.12.16

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
@@ -676,6 +676,7 @@ type WebElementComponent = {
676
676
  } | {
677
677
  component: "collection";
678
678
  collectionIds: Array<string>;
679
+ displayedPropertyUuids: Array<string> | null;
679
680
  variant: "full" | "highlights";
680
681
  itemVariant: "detailed" | "card" | "tile";
681
682
  paginationVariant: "default" | "numeric";
@@ -683,10 +684,11 @@ type WebElementComponent = {
683
684
  isSortDisplayed: boolean;
684
685
  isFilterDisplayed: boolean;
685
686
  filterSort: "default" | "alphabetical";
687
+ isUsingQueryParams: boolean;
686
688
  search: {
687
- isUsingQueryParams: boolean;
688
689
  isResultsBarDisplayed: boolean;
689
690
  isMapDisplayed: boolean;
691
+ isInputDisplayed: boolean;
690
692
  };
691
693
  options: {
692
694
  attributeFilters: {
@@ -774,9 +776,8 @@ type WebElementComponent = {
774
776
  }>;
775
777
  } | {
776
778
  component: "search-bar";
777
- variant: "default" | "full";
778
779
  placeholder: string | null;
779
- baseQuery: string | null;
780
+ baseFilterQueries: string | null;
780
781
  boundElementUuid: string | null;
781
782
  href: string | null;
782
783
  } | {
package/dist/index.mjs CHANGED
@@ -1795,6 +1795,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
1795
1795
  case "collection": {
1796
1796
  const collectionLinks = links.filter((link) => link.category === "set");
1797
1797
  if (collectionLinks.length === 0) throw new Error(`Collection links not found for the following component: “${componentName}”`);
1798
+ const displayedProperties = getPropertyByLabel(componentProperty.properties, "use-property");
1798
1799
  let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
1799
1800
  variant ??= "full";
1800
1801
  let itemVariant = getPropertyValueByLabel(componentProperty.properties, "item-variant");
@@ -1804,20 +1805,23 @@ function parseWebElementProperties(componentProperty, elementResource) {
1804
1805
  let isUsingQueryParams = false;
1805
1806
  const isUsingQueryParamsProperty = getPropertyValueByLabel(componentProperty.properties, "is-using-query-params");
1806
1807
  if (isUsingQueryParamsProperty !== null) isUsingQueryParams = isUsingQueryParamsProperty === 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;
1808
+ let isFilterResultsBarDisplayed = false;
1809
+ const isFilterResultsBarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-results-bar-displayed");
1810
+ if (isFilterResultsBarDisplayedProperty !== null) isFilterResultsBarDisplayed = isFilterResultsBarDisplayedProperty === true;
1811
+ let isFilterMapDisplayed = false;
1812
+ const isFilterMapDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-map-displayed");
1813
+ if (isFilterMapDisplayedProperty !== null) isFilterMapDisplayed = isFilterMapDisplayedProperty === true;
1814
+ let isFilterInputDisplayed = false;
1815
+ const isFilterInputDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-input-displayed");
1816
+ if (isFilterInputDisplayedProperty !== null) isFilterInputDisplayed = isFilterInputDisplayedProperty === true;
1813
1817
  let isSortDisplayed = false;
1814
1818
  const isSortDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "sort-displayed");
1815
1819
  if (isSortDisplayedProperty !== null) isSortDisplayed = isSortDisplayedProperty === true;
1816
- let isFilterDisplayed = false;
1817
- const isFilterDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-displayed");
1818
- if (isFilterDisplayedProperty !== null) isFilterDisplayed = isFilterDisplayedProperty === true;
1819
- let filterSort = getPropertyValueByLabel(componentProperty.properties, "filter-sort");
1820
- filterSort ??= "default";
1820
+ let isFilterSidebarDisplayed = false;
1821
+ const isFilterSidebarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-sidebar-displayed");
1822
+ if (isFilterSidebarDisplayedProperty !== null) isFilterSidebarDisplayed = isFilterSidebarDisplayedProperty === true;
1823
+ let filterSidebarSort = getPropertyValueByLabel(componentProperty.properties, "filter-sidebar-sort");
1824
+ filterSidebarSort ??= "default";
1821
1825
  let layout = getPropertyValueByLabel(componentProperty.properties, "layout");
1822
1826
  layout ??= "image-start";
1823
1827
  const options = {
@@ -1862,17 +1866,19 @@ function parseWebElementProperties(componentProperty, elementResource) {
1862
1866
  };
1863
1867
  }
1864
1868
  properties.collectionIds = collectionLinks.map((link) => link.uuid);
1869
+ properties.displayedPropertyUuids = displayedProperties?.values.map((value) => value.uuid).filter(Boolean) ?? null;
1865
1870
  properties.variant = variant;
1866
1871
  properties.itemVariant = itemVariant;
1867
1872
  properties.paginationVariant = paginationVariant;
1868
- properties.search = {
1869
- isUsingQueryParams,
1870
- isResultsBarDisplayed,
1871
- isMapDisplayed
1873
+ properties.isUsingQueryParams = isUsingQueryParams;
1874
+ properties.filter = {
1875
+ isSidebarDisplayed: isFilterSidebarDisplayed,
1876
+ isResultsBarDisplayed: isFilterResultsBarDisplayed,
1877
+ isMapDisplayed: isFilterMapDisplayed,
1878
+ isInputDisplayed: isFilterInputDisplayed,
1879
+ sidebarSort: filterSidebarSort
1872
1880
  };
1873
1881
  properties.isSortDisplayed = isSortDisplayed;
1874
- properties.isFilterDisplayed = isFilterDisplayed;
1875
- properties.filterSort = filterSort;
1876
1882
  properties.layout = layout;
1877
1883
  properties.options = options;
1878
1884
  break;
@@ -2078,13 +2084,10 @@ function parseWebElementProperties(componentProperty, elementResource) {
2078
2084
  const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
2079
2085
  const href = linkToProperty?.values[0]?.href ?? linkToProperty?.values[0]?.slug ?? null;
2080
2086
  if (!boundElementPropertyUuid && !href) throw new Error(`Bound element or href not found for the following component: “${componentName}”`);
2081
- let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
2082
- variant ??= "default";
2083
2087
  const placeholder = getPropertyValueByLabel(componentProperty.properties, "placeholder-text");
2084
- const baseQuery = getPropertyValueByLabel(componentProperty.properties, "base-query");
2085
- properties.variant = variant;
2088
+ const baseFilterQueries = getPropertyValueByLabel(componentProperty.properties, "base-filter-queries");
2086
2089
  properties.placeholder = placeholder !== null ? String(placeholder) : null;
2087
- properties.baseQuery = baseQuery !== null ? String(baseQuery).replaceAll(String.raw`\{`, "{").replaceAll(String.raw`\}`, "}") : null;
2090
+ properties.baseFilterQueries = baseFilterQueries !== null ? String(baseFilterQueries).replaceAll(String.raw`\{`, "{").replaceAll(String.raw`\}`, "}") : null;
2088
2091
  properties.boundElementUuid = boundElementPropertyUuid;
2089
2092
  properties.href = href;
2090
2093
  break;
@@ -2260,7 +2263,7 @@ function parseWebpage(webpageResource) {
2260
2263
  let isHeaderSearchBarDisplayed = true;
2261
2264
  const webpageSubProperties = webpageProperties.find((property) => property.label === "presentation" && property.values[0]?.content === "page")?.properties;
2262
2265
  if (webpageSubProperties) {
2263
- const headerProperty = webpageSubProperties.find((property) => property.label === "header")?.values[0];
2266
+ const headerProperty = webpageSubProperties.find((property) => property.label === "displayed-in-navbar")?.values[0];
2264
2267
  if (headerProperty) displayedInHeader = headerProperty.content === true;
2265
2268
  const widthProperty = webpageSubProperties.find((property) => property.label === "width")?.values[0];
2266
2269
  if (widthProperty) width = widthProperty.content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.12.15",
3
+ "version": "0.12.16",
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",
@@ -40,7 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "dependencies": {
43
- "zod": "^4.1.12"
43
+ "zod": "^4.1.13"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@antfu/eslint-config": "^6.2.0",
@@ -49,9 +49,9 @@
49
49
  "eslint": "^9.39.1",
50
50
  "prettier": "^3.6.2",
51
51
  "terser": "^5.44.1",
52
- "tsdown": "^0.16.3",
52
+ "tsdown": "^0.16.7",
53
53
  "typescript": "^5.9.3",
54
- "vitest": "^4.0.8"
54
+ "vitest": "^4.0.14"
55
55
  },
56
56
  "scripts": {
57
57
  "dev": "tsdown src/index.ts --watch",