@digitalculture/ochre-sdk 0.2.10 → 0.2.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.cjs CHANGED
@@ -1548,37 +1548,47 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1548
1548
  if (altTextSource === null) {
1549
1549
  altTextSource = "name";
1550
1550
  }
1551
- let secondsPerImage = 5;
1552
- const secondsPerImageProperty = getPropertyValueByLabel(
1553
- componentProperty.properties,
1554
- "seconds-per-image"
1555
- );
1556
- if (secondsPerImageProperty !== null) {
1557
- secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1558
- }
1559
- let isFullWidth = false;
1560
- const isFullWidthProperty = getPropertyValueByLabel(
1561
- componentProperty.properties,
1562
- "is-full-width"
1563
- );
1564
- if (isFullWidthProperty !== null) {
1565
- isFullWidth = isFullWidthProperty === "Yes";
1566
- }
1567
- let isFullHeight = false;
1568
- const isFullHeightProperty = getPropertyValueByLabel(
1569
- componentProperty.properties,
1570
- "is-full-height"
1571
- );
1572
- if (isFullHeightProperty !== null) {
1573
- isFullHeight = isFullHeightProperty === "Yes";
1551
+ let carouselOptions = null;
1552
+ if (images.length > 1) {
1553
+ const variantProperty = getPropertyByLabel(
1554
+ componentProperty.properties,
1555
+ "variant"
1556
+ );
1557
+ let secondsPerImage = 5;
1558
+ let isFullWidth = false;
1559
+ let isFullHeight = false;
1560
+ if (variantProperty && variantProperty.values[0].content === "carousel") {
1561
+ const secondsPerImageProperty = getPropertyValueByLabel(
1562
+ variantProperty.properties,
1563
+ "seconds-per-image"
1564
+ );
1565
+ if (secondsPerImageProperty !== null) {
1566
+ secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1567
+ }
1568
+ const isFullWidthProperty = getPropertyValueByLabel(
1569
+ variantProperty.properties,
1570
+ "is-full-width"
1571
+ );
1572
+ if (isFullWidthProperty !== null) {
1573
+ isFullWidth = isFullWidthProperty === "Yes";
1574
+ }
1575
+ const isFullHeightProperty = getPropertyValueByLabel(
1576
+ variantProperty.properties,
1577
+ "is-full-height"
1578
+ );
1579
+ if (isFullHeightProperty !== null) {
1580
+ isFullHeight = isFullHeightProperty === "Yes";
1581
+ }
1582
+ }
1583
+ carouselOptions = {
1584
+ secondsPerImage,
1585
+ isFullWidth,
1586
+ isFullHeight
1587
+ };
1574
1588
  }
1575
1589
  properties.images = images;
1576
1590
  properties.variant = variant;
1577
- properties.carouselOptions = images.length > 1 ? {
1578
- secondsPerImage,
1579
- isFullWidth,
1580
- isFullHeight
1581
- } : null;
1591
+ properties.carouselOptions = carouselOptions;
1582
1592
  properties.imageQuality = imageQuality;
1583
1593
  properties.captionLayout = captionLayout;
1584
1594
  properties.captionSource = captionSource;
package/dist/index.js CHANGED
@@ -1470,37 +1470,47 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1470
1470
  if (altTextSource === null) {
1471
1471
  altTextSource = "name";
1472
1472
  }
1473
- let secondsPerImage = 5;
1474
- const secondsPerImageProperty = getPropertyValueByLabel(
1475
- componentProperty.properties,
1476
- "seconds-per-image"
1477
- );
1478
- if (secondsPerImageProperty !== null) {
1479
- secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1480
- }
1481
- let isFullWidth = false;
1482
- const isFullWidthProperty = getPropertyValueByLabel(
1483
- componentProperty.properties,
1484
- "is-full-width"
1485
- );
1486
- if (isFullWidthProperty !== null) {
1487
- isFullWidth = isFullWidthProperty === "Yes";
1488
- }
1489
- let isFullHeight = false;
1490
- const isFullHeightProperty = getPropertyValueByLabel(
1491
- componentProperty.properties,
1492
- "is-full-height"
1493
- );
1494
- if (isFullHeightProperty !== null) {
1495
- isFullHeight = isFullHeightProperty === "Yes";
1473
+ let carouselOptions = null;
1474
+ if (images.length > 1) {
1475
+ const variantProperty = getPropertyByLabel(
1476
+ componentProperty.properties,
1477
+ "variant"
1478
+ );
1479
+ let secondsPerImage = 5;
1480
+ let isFullWidth = false;
1481
+ let isFullHeight = false;
1482
+ if (variantProperty && variantProperty.values[0].content === "carousel") {
1483
+ const secondsPerImageProperty = getPropertyValueByLabel(
1484
+ variantProperty.properties,
1485
+ "seconds-per-image"
1486
+ );
1487
+ if (secondsPerImageProperty !== null) {
1488
+ secondsPerImage = Number.parseFloat(secondsPerImageProperty);
1489
+ }
1490
+ const isFullWidthProperty = getPropertyValueByLabel(
1491
+ variantProperty.properties,
1492
+ "is-full-width"
1493
+ );
1494
+ if (isFullWidthProperty !== null) {
1495
+ isFullWidth = isFullWidthProperty === "Yes";
1496
+ }
1497
+ const isFullHeightProperty = getPropertyValueByLabel(
1498
+ variantProperty.properties,
1499
+ "is-full-height"
1500
+ );
1501
+ if (isFullHeightProperty !== null) {
1502
+ isFullHeight = isFullHeightProperty === "Yes";
1503
+ }
1504
+ }
1505
+ carouselOptions = {
1506
+ secondsPerImage,
1507
+ isFullWidth,
1508
+ isFullHeight
1509
+ };
1496
1510
  }
1497
1511
  properties.images = images;
1498
1512
  properties.variant = variant;
1499
- properties.carouselOptions = images.length > 1 ? {
1500
- secondsPerImage,
1501
- isFullWidth,
1502
- isFullHeight
1503
- } : null;
1513
+ properties.carouselOptions = carouselOptions;
1504
1514
  properties.imageQuality = imageQuality;
1505
1515
  properties.captionLayout = captionLayout;
1506
1516
  properties.captionSource = captionSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.2.10",
3
+ "version": "0.2.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",