@webspatial/react-sdk 0.0.8 → 0.0.10

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.
@@ -3251,15 +3251,18 @@ function parseChildren(child) {
3251
3251
  }
3252
3252
  const gltfSources = sourceElements.filter((node) => {
3253
3253
  const type = node.props?.type.trim();
3254
- return type.startsWith("model/gltf-binary") || type.startsWith("model/gltf+json");
3254
+ const source = node.props?.src.trim().toLowerCase();
3255
+ const isGLFT = source.endsWith(".gltf");
3256
+ const isGLB = source.endsWith(".glb");
3257
+ return type.startsWith("model/gltf-binary") && isGLB || type.startsWith("model/gltf+json") && isGLFT;
3255
3258
  });
3256
3259
  const usdzSources = sourceElements.filter(
3257
3260
  (node) => node.props?.type.trim().startsWith("model/vnd.usdz+zip")
3258
3261
  );
3259
3262
  let lastChild = children[children.length - 1];
3260
3263
  const placeHolder = sourceElements.indexOf(lastChild) < 0 ? lastChild : void 0;
3261
- const gltfSourceURL = gltfSources.length > 0 && gltfSources[0].props?.src;
3262
- const usdzSourceURL = usdzSources.length > 0 && usdzSources[0].props?.src;
3264
+ const gltfSourceURL = gltfSources.length > 0 ? gltfSources[0].props?.src : "";
3265
+ const usdzSourceURL = usdzSources.length > 0 ? usdzSources[0].props?.src : "";
3263
3266
  return {
3264
3267
  placeHolder,
3265
3268
  gltfSourceURL: getAbsoluteURL(gltfSourceURL),
@@ -3286,6 +3289,15 @@ function ModelBase(inProps, ref) {
3286
3289
  if (!modelViewerExists) {
3287
3290
  return;
3288
3291
  }
3292
+ myModelViewer.current.addEventListener("error", (event) => {
3293
+ if (event.detail.type == "loadfailure") {
3294
+ if (props2.onLoad) {
3295
+ props2.onLoad({
3296
+ target: { ready: false, currentSrc: gltfSourceURL }
3297
+ });
3298
+ }
3299
+ }
3300
+ });
3289
3301
  myModelViewer.current.addEventListener("load", (event) => {
3290
3302
  if (props2.onLoad) {
3291
3303
  props2.onLoad({