@digitalculture/ochre-sdk 0.5.7 → 0.5.8

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.cjs CHANGED
@@ -1467,6 +1467,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1467
1467
  break;
1468
1468
  }
1469
1469
  case "collection": {
1470
+ const collectionLink = links.find((link) => link.category === "set");
1471
+ if (!collectionLink) {
1472
+ throw new Error(
1473
+ `Collection link not found for the following component: \u201C${componentName}\u201D`
1474
+ );
1475
+ }
1470
1476
  let variant = getPropertyValueByLabel(
1471
1477
  componentProperty.properties,
1472
1478
  "variant"
@@ -1477,21 +1483,33 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1477
1483
  "item-variant"
1478
1484
  );
1479
1485
  itemVariant ??= "default";
1486
+ let showCount = false;
1487
+ const showCountProperty = getPropertyValueByLabel(
1488
+ componentProperty.properties,
1489
+ "show-count"
1490
+ );
1491
+ if (showCountProperty !== null) {
1492
+ showCount = showCountProperty === "Yes";
1493
+ }
1494
+ let isSearchable = false;
1495
+ const isSearchableProperty = getPropertyValueByLabel(
1496
+ componentProperty.properties,
1497
+ "is-searchable"
1498
+ );
1499
+ if (isSearchableProperty !== null) {
1500
+ isSearchable = isSearchableProperty === "Yes";
1501
+ }
1480
1502
  let layout = getPropertyValueByLabel(
1481
1503
  componentProperty.properties,
1482
1504
  "layout"
1483
1505
  );
1484
1506
  layout ??= "image-start";
1485
- const collectionLink = links.find((link) => link.category === "set");
1486
- if (!collectionLink) {
1487
- throw new Error(
1488
- `Collection link not found for the following component: \u201C${componentName}\u201D`
1489
- );
1490
- }
1507
+ properties.collectionId = collectionLink.uuid;
1491
1508
  properties.variant = variant;
1492
1509
  properties.itemVariant = itemVariant;
1510
+ properties.isSearchable = isSearchable;
1511
+ properties.showCount = showCount;
1493
1512
  properties.layout = layout;
1494
- properties.collectionId = collectionLink.uuid;
1495
1513
  break;
1496
1514
  }
1497
1515
  case "empty-space": {
package/dist/index.d.cts CHANGED
@@ -505,8 +505,9 @@ type WebElementComponent = {
505
505
  collectionId: string;
506
506
  variant: "full" | "highlights";
507
507
  itemVariant: "default" | "card";
508
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
509
508
  isSearchable: boolean;
509
+ showCount: boolean;
510
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
510
511
  } | {
511
512
  component: "empty-space";
512
513
  height: string | null;
package/dist/index.d.ts CHANGED
@@ -505,8 +505,9 @@ type WebElementComponent = {
505
505
  collectionId: string;
506
506
  variant: "full" | "highlights";
507
507
  itemVariant: "default" | "card";
508
- layout: "image-top" | "image-bottom" | "image-start" | "image-end";
509
508
  isSearchable: boolean;
509
+ showCount: boolean;
510
+ layout: "image-top" | "image-bottom" | "image-start" | "image-end";
510
511
  } | {
511
512
  component: "empty-space";
512
513
  height: string | null;
package/dist/index.js CHANGED
@@ -1390,6 +1390,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1390
1390
  break;
1391
1391
  }
1392
1392
  case "collection": {
1393
+ const collectionLink = links.find((link) => link.category === "set");
1394
+ if (!collectionLink) {
1395
+ throw new Error(
1396
+ `Collection link not found for the following component: \u201C${componentName}\u201D`
1397
+ );
1398
+ }
1393
1399
  let variant = getPropertyValueByLabel(
1394
1400
  componentProperty.properties,
1395
1401
  "variant"
@@ -1400,21 +1406,33 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1400
1406
  "item-variant"
1401
1407
  );
1402
1408
  itemVariant ??= "default";
1409
+ let showCount = false;
1410
+ const showCountProperty = getPropertyValueByLabel(
1411
+ componentProperty.properties,
1412
+ "show-count"
1413
+ );
1414
+ if (showCountProperty !== null) {
1415
+ showCount = showCountProperty === "Yes";
1416
+ }
1417
+ let isSearchable = false;
1418
+ const isSearchableProperty = getPropertyValueByLabel(
1419
+ componentProperty.properties,
1420
+ "is-searchable"
1421
+ );
1422
+ if (isSearchableProperty !== null) {
1423
+ isSearchable = isSearchableProperty === "Yes";
1424
+ }
1403
1425
  let layout = getPropertyValueByLabel(
1404
1426
  componentProperty.properties,
1405
1427
  "layout"
1406
1428
  );
1407
1429
  layout ??= "image-start";
1408
- const collectionLink = links.find((link) => link.category === "set");
1409
- if (!collectionLink) {
1410
- throw new Error(
1411
- `Collection link not found for the following component: \u201C${componentName}\u201D`
1412
- );
1413
- }
1430
+ properties.collectionId = collectionLink.uuid;
1414
1431
  properties.variant = variant;
1415
1432
  properties.itemVariant = itemVariant;
1433
+ properties.isSearchable = isSearchable;
1434
+ properties.showCount = showCount;
1416
1435
  properties.layout = layout;
1417
- properties.collectionId = collectionLink.uuid;
1418
1436
  break;
1419
1437
  }
1420
1438
  case "empty-space": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
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",