@digitalculture/ochre-sdk 0.12.8 → 0.12.10

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;
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": {
@@ -2062,7 +2065,8 @@ function parseWebElementProperties(componentProperty, elementResource) {
2062
2065
  }
2063
2066
  case "search-bar": {
2064
2067
  const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
2065
- const href = getPropertyValueByLabel(componentProperty.properties, "link-to")?.toString() ?? null;
2068
+ const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
2069
+ const href = linkToProperty?.values[0]?.href ?? linkToProperty?.values[0]?.slug ?? null;
2066
2070
  if (!boundElementPropertyUuid && !href) throw new Error(`Bound element or href not found for the following component: “${componentName}”`);
2067
2071
  let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
2068
2072
  variant ??= "default";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.12.8",
3
+ "version": "0.12.10",
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",