@digitalculture/ochre-sdk 0.12.7 → 0.12.9

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
@@ -755,7 +755,8 @@ type WebElementComponent = {
755
755
  variant: "default" | "full";
756
756
  placeholder: string | null;
757
757
  baseQuery: string | null;
758
- boundElementUuid: string;
758
+ boundElementUuid: string | null;
759
+ href: string | null;
759
760
  } | {
760
761
  component: "table";
761
762
  tableId: string;
package/dist/index.mjs CHANGED
@@ -2062,7 +2062,9 @@ function parseWebElementProperties(componentProperty, elementResource) {
2062
2062
  }
2063
2063
  case "search-bar": {
2064
2064
  const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
2065
- if (!boundElementPropertyUuid) throw new Error(`Bound element not found for the following component: “${componentName}”`);
2065
+ const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
2066
+ const href = linkToProperty?.values[0]?.href ?? linkToProperty?.values[0]?.slug ?? null;
2067
+ if (!boundElementPropertyUuid && !href) throw new Error(`Bound element or href not found for the following component: “${componentName}”`);
2066
2068
  let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
2067
2069
  variant ??= "default";
2068
2070
  const placeholder = getPropertyValueByLabel(componentProperty.properties, "placeholder-text");
@@ -2071,6 +2073,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
2071
2073
  properties.placeholder = placeholder !== null ? String(placeholder) : null;
2072
2074
  properties.baseQuery = baseQuery !== null ? String(baseQuery).replaceAll(String.raw`\{`, "{").replaceAll(String.raw`\}`, "}") : null;
2073
2075
  properties.boundElementUuid = boundElementPropertyUuid;
2076
+ properties.href = href;
2074
2077
  break;
2075
2078
  }
2076
2079
  case "text": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.12.7",
3
+ "version": "0.12.9",
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",