@digitalculture/ochre-sdk 0.13.7 → 0.13.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.d.mts +6 -0
- package/dist/index.mjs +19 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -649,6 +649,12 @@ type WebElement = {
|
|
|
649
649
|
* Union type of all possible web element components
|
|
650
650
|
*/
|
|
651
651
|
type WebElementComponent = {
|
|
652
|
+
component: "3d-viewer";
|
|
653
|
+
resourceId: string;
|
|
654
|
+
isInteractive: boolean;
|
|
655
|
+
isControlsDisplayed: boolean;
|
|
656
|
+
isLightingDisplayed: boolean;
|
|
657
|
+
} | {
|
|
652
658
|
component: "advanced-search";
|
|
653
659
|
boundElementUuid: string | null;
|
|
654
660
|
href: string | null;
|
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ const websiteSchema = z.object({
|
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
const componentSchema = z.enum([
|
|
40
|
+
"3d-viewer",
|
|
40
41
|
"advanced-search",
|
|
41
42
|
"annotated-document",
|
|
42
43
|
"annotated-image",
|
|
@@ -1706,6 +1707,24 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1706
1707
|
const properties = { component: componentName };
|
|
1707
1708
|
const links = elementResource.links ? parseLinks(Array.isArray(elementResource.links) ? elementResource.links : [elementResource.links]) : [];
|
|
1708
1709
|
switch (componentName) {
|
|
1710
|
+
case "3d-viewer": {
|
|
1711
|
+
const resourceLink = links.find((link) => link.category === "resource" && link.fileFormat === "model/obj");
|
|
1712
|
+
if (!resourceLink) throw new Error(`Resource link not found for the following component: “${componentName}”`);
|
|
1713
|
+
let isInteractive = true;
|
|
1714
|
+
const isInteractiveProperty = getPropertyValueByLabel(componentProperty.properties, "is-interactive");
|
|
1715
|
+
if (isInteractiveProperty !== null) isInteractive = isInteractiveProperty === true;
|
|
1716
|
+
let isControlsDisplayed = true;
|
|
1717
|
+
const isControlsDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "controls-displayed");
|
|
1718
|
+
if (isControlsDisplayedProperty !== null) isControlsDisplayed = isControlsDisplayedProperty === true;
|
|
1719
|
+
let isLightingDisplayed = true;
|
|
1720
|
+
const isLightingDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "lighting-displayed");
|
|
1721
|
+
if (isLightingDisplayedProperty !== null) isLightingDisplayed = isLightingDisplayedProperty === true;
|
|
1722
|
+
properties.resourceId = resourceLink.uuid;
|
|
1723
|
+
properties.isInteractive = isInteractive;
|
|
1724
|
+
properties.isControlsDisplayed = isControlsDisplayed;
|
|
1725
|
+
properties.isLightingDisplayed = isLightingDisplayed;
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1709
1728
|
case "advanced-search": {
|
|
1710
1729
|
const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
|
|
1711
1730
|
const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
|
package/package.json
CHANGED