@digitalculture/ochre-sdk 0.2.6 → 0.2.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/README.md +3 -3
- package/dist/index.cjs +35 -29
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +35 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,19 +5,19 @@ This is the OCHRE JavaScript/TypeScript SDK for interacting with OCHRE (Online C
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add @
|
|
8
|
+
pnpm add @digitalculture/ochre-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
or
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install @
|
|
14
|
+
npm install @digitalculture/ochre-sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
or
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
bun add @
|
|
20
|
+
bun add @digitalculture/ochre-sdk
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Start development server
|
package/dist/index.cjs
CHANGED
|
@@ -898,7 +898,7 @@ function parseProperties(properties, language = "eng") {
|
|
|
898
898
|
for (const property of properties) {
|
|
899
899
|
const valuesToParse = "value" in property && property.value ? Array.isArray(property.value) ? property.value : [property.value] : [];
|
|
900
900
|
const values = valuesToParse.map(
|
|
901
|
-
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object"
|
|
901
|
+
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object" ? {
|
|
902
902
|
content: parseStringContent(value),
|
|
903
903
|
type: value.type,
|
|
904
904
|
category: value.category !== "value" ? value.category ?? null : null,
|
|
@@ -1513,6 +1513,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1513
1513
|
height: imageLink.image?.height ?? 0
|
|
1514
1514
|
});
|
|
1515
1515
|
}
|
|
1516
|
+
let variant = getPropertyValueByLabel(
|
|
1517
|
+
componentProperty.properties,
|
|
1518
|
+
"variant"
|
|
1519
|
+
);
|
|
1520
|
+
if (variant === null) {
|
|
1521
|
+
variant = "default";
|
|
1522
|
+
}
|
|
1516
1523
|
let captionLayout = getPropertyValueByLabel(
|
|
1517
1524
|
componentProperty.properties,
|
|
1518
1525
|
"caption-layout"
|
|
@@ -1541,40 +1548,39 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1541
1548
|
if (altTextSource === null) {
|
|
1542
1549
|
altTextSource = "name";
|
|
1543
1550
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
if (
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
);
|
|
1568
|
-
if (carouselIsFullHeight !== null) {
|
|
1569
|
-
carousel.isFullHeight = carouselIsFullHeight === "Yes";
|
|
1570
|
-
}
|
|
1551
|
+
let secondsPerImage = images.length > 1 ? 5 : null;
|
|
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";
|
|
1571
1574
|
}
|
|
1572
1575
|
properties.images = images;
|
|
1576
|
+
properties.variant = variant;
|
|
1573
1577
|
properties.imageQuality = imageQuality;
|
|
1574
1578
|
properties.captionLayout = captionLayout;
|
|
1575
1579
|
properties.captionSource = captionSource;
|
|
1576
1580
|
properties.altTextSource = altTextSource;
|
|
1577
|
-
properties.
|
|
1581
|
+
properties.secondsPerImage = secondsPerImage;
|
|
1582
|
+
properties.isFullWidth = isFullWidth;
|
|
1583
|
+
properties.isFullHeight = isFullHeight;
|
|
1578
1584
|
break;
|
|
1579
1585
|
}
|
|
1580
1586
|
case "image-gallery": {
|
package/dist/index.d.cts
CHANGED
|
@@ -499,11 +499,9 @@ type WebElementComponent = {
|
|
|
499
499
|
captionSource: "name" | "abbreviation" | "description";
|
|
500
500
|
captionLayout: "top" | "bottom" | "suppress";
|
|
501
501
|
altTextSource: "name" | "abbreviation" | "description";
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
isFullHeight: boolean;
|
|
506
|
-
} | null;
|
|
502
|
+
secondsPerImage: number | null;
|
|
503
|
+
isFullWidth: boolean | null;
|
|
504
|
+
isFullHeight: boolean | null;
|
|
507
505
|
} | {
|
|
508
506
|
component: "image-gallery";
|
|
509
507
|
galleryId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -499,11 +499,9 @@ type WebElementComponent = {
|
|
|
499
499
|
captionSource: "name" | "abbreviation" | "description";
|
|
500
500
|
captionLayout: "top" | "bottom" | "suppress";
|
|
501
501
|
altTextSource: "name" | "abbreviation" | "description";
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
isFullHeight: boolean;
|
|
506
|
-
} | null;
|
|
502
|
+
secondsPerImage: number | null;
|
|
503
|
+
isFullWidth: boolean | null;
|
|
504
|
+
isFullHeight: boolean | null;
|
|
507
505
|
} | {
|
|
508
506
|
component: "image-gallery";
|
|
509
507
|
galleryId: string;
|
package/dist/index.js
CHANGED
|
@@ -820,7 +820,7 @@ function parseProperties(properties, language = "eng") {
|
|
|
820
820
|
for (const property of properties) {
|
|
821
821
|
const valuesToParse = "value" in property && property.value ? Array.isArray(property.value) ? property.value : [property.value] : [];
|
|
822
822
|
const values = valuesToParse.map(
|
|
823
|
-
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object"
|
|
823
|
+
(value) => !["string", "number", "boolean"].includes(typeof value) && typeof value === "object" ? {
|
|
824
824
|
content: parseStringContent(value),
|
|
825
825
|
type: value.type,
|
|
826
826
|
category: value.category !== "value" ? value.category ?? null : null,
|
|
@@ -1435,6 +1435,13 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1435
1435
|
height: imageLink.image?.height ?? 0
|
|
1436
1436
|
});
|
|
1437
1437
|
}
|
|
1438
|
+
let variant = getPropertyValueByLabel(
|
|
1439
|
+
componentProperty.properties,
|
|
1440
|
+
"variant"
|
|
1441
|
+
);
|
|
1442
|
+
if (variant === null) {
|
|
1443
|
+
variant = "default";
|
|
1444
|
+
}
|
|
1438
1445
|
let captionLayout = getPropertyValueByLabel(
|
|
1439
1446
|
componentProperty.properties,
|
|
1440
1447
|
"caption-layout"
|
|
@@ -1463,40 +1470,39 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1463
1470
|
if (altTextSource === null) {
|
|
1464
1471
|
altTextSource = "name";
|
|
1465
1472
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
);
|
|
1490
|
-
if (carouselIsFullHeight !== null) {
|
|
1491
|
-
carousel.isFullHeight = carouselIsFullHeight === "Yes";
|
|
1492
|
-
}
|
|
1473
|
+
let secondsPerImage = images.length > 1 ? 5 : null;
|
|
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";
|
|
1493
1496
|
}
|
|
1494
1497
|
properties.images = images;
|
|
1498
|
+
properties.variant = variant;
|
|
1495
1499
|
properties.imageQuality = imageQuality;
|
|
1496
1500
|
properties.captionLayout = captionLayout;
|
|
1497
1501
|
properties.captionSource = captionSource;
|
|
1498
1502
|
properties.altTextSource = altTextSource;
|
|
1499
|
-
properties.
|
|
1503
|
+
properties.secondsPerImage = secondsPerImage;
|
|
1504
|
+
properties.isFullWidth = isFullWidth;
|
|
1505
|
+
properties.isFullHeight = isFullHeight;
|
|
1500
1506
|
break;
|
|
1501
1507
|
}
|
|
1502
1508
|
case "image-gallery": {
|
package/package.json
CHANGED