@neurodyn/react-room-viewer 0.0.18 → 0.0.19

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8414,6 +8414,13 @@ function progress_Progress({ className, value, max = 100, ...props }) {
8414
8414
  });
8415
8415
  }
8416
8416
  const fullscreenDialogContentClassName = 'inset-0 h-dvh min-w-full max-w-none translate-x-0 translate-y-0 rounded-none border-none bg-transparent p-0 shadow-none sm:p-0 sm:max-w-none';
8417
+ function getRoomPhotoUrl(room) {
8418
+ const source = room.image_url;
8419
+ if (!/^https?:\/\//i.test(source)) return source;
8420
+ const url = new URL(source);
8421
+ url.searchParams.set('v', '1');
8422
+ return url.href;
8423
+ }
8417
8424
  const RoomViewerMetadataContext = createContext(null);
8418
8425
  const RoomViewerSurfaceContext = createContext(null);
8419
8426
  const RoomViewerRoomsContext = createContext(null);
@@ -10666,7 +10673,9 @@ function FloorResource({ glbUrl, position, quaternion, materialPatch }) {
10666
10673
  function RoomBackground() {
10667
10674
  const { room } = useRoomViewerRooms();
10668
10675
  const scene = useThree((state)=>state.scene);
10669
- const texture = useLoader(TextureLoader, room.image_url);
10676
+ const texture = useLoader(TextureLoader, getRoomPhotoUrl(room), (loader)=>{
10677
+ loader.setCrossOrigin('anonymous');
10678
+ });
10670
10679
  useLayoutEffect(()=>{
10671
10680
  texture.colorSpace = SRGBColorSpace;
10672
10681
  scene.background = texture;
@@ -11952,6 +11961,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
11952
11961
  className: "absolute top-[-52px] right-[-1.36%] bottom-[-52px] left-[-1.36%] blur-[40px]",
11953
11962
  "data-testid": "floor-blur-background",
11954
11963
  children: /*#__PURE__*/ jsx_runtime_jsx("img", {
11964
+ crossOrigin: "anonymous",
11955
11965
  src: room.imageUrl,
11956
11966
  alt: "",
11957
11967
  className: "block size-full max-w-none object-cover object-center opacity-50"
@@ -12062,6 +12072,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12062
12072
  "data-neurodyn-room-viewer-room": "",
12063
12073
  children: [
12064
12074
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12075
+ crossOrigin: "anonymous",
12065
12076
  src: room.imageUrl,
12066
12077
  alt: "",
12067
12078
  className: "size-16 shrink-0 rounded-lg object-cover"
@@ -12094,6 +12105,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12094
12105
  "data-neurodyn-room-viewer-try-at-home": "",
12095
12106
  children: [
12096
12107
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12108
+ crossOrigin: "anonymous",
12097
12109
  src: room.imageUrl,
12098
12110
  alt: "",
12099
12111
  className: "size-16 shrink-0 rounded-lg object-cover"
@@ -12147,6 +12159,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12147
12159
  className: "flex min-w-0 items-center gap-2",
12148
12160
  children: [
12149
12161
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12162
+ crossOrigin: "anonymous",
12150
12163
  src: room.imageUrl,
12151
12164
  alt: "",
12152
12165
  className: "size-10 shrink-0 rounded-full object-cover"
@@ -12222,6 +12235,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12222
12235
  className: "flex min-w-0 items-center gap-2",
12223
12236
  children: [
12224
12237
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12238
+ crossOrigin: "anonymous",
12225
12239
  src: room.imageUrl,
12226
12240
  alt: "",
12227
12241
  className: "size-10 shrink-0 rounded-full object-cover"
@@ -12316,7 +12330,8 @@ function InteriorSelectionEntry({ rooms, customRooms, selectedRoomId, isInvalidF
12316
12330
  onClick: ()=>onSelectRoom(room.id),
12317
12331
  children: [
12318
12332
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12319
- src: room.image_url,
12333
+ crossOrigin: "anonymous",
12334
+ src: getRoomPhotoUrl(room),
12320
12335
  alt: "",
12321
12336
  decoding: "async",
12322
12337
  className: "size-full scale-[1.02] transform-gpu object-cover transition duration-200 group-hover:scale-105"
@@ -13732,7 +13747,7 @@ function FloorViewerLayout({ showDialogCloseButton = false }) {
13732
13747
  },
13733
13748
  portalContainer: activeDialogPortalContainer,
13734
13749
  room: {
13735
- imageUrl: room.image_url,
13750
+ imageUrl: getRoomPhotoUrl(room),
13736
13751
  name: roomName
13737
13752
  },
13738
13753
  scene: {
@@ -14034,10 +14049,10 @@ function RoomSwiper({ className, ...props }) {
14034
14049
  className: "size-full relative h-17 sm:h-19 rounded-[0.75rem] overflow-hidden",
14035
14050
  children: [
14036
14051
  /*#__PURE__*/ jsx_runtime_jsx("img", {
14037
- src: r.image_url,
14052
+ crossOrigin: "anonymous",
14053
+ src: getRoomPhotoUrl(r),
14038
14054
  alt: getRoomName(r.name, r.id),
14039
- className: "size-full object-cover",
14040
- crossOrigin: "anonymous"
14055
+ className: "size-full object-cover"
14041
14056
  }),
14042
14057
  /*#__PURE__*/ jsx_runtime_jsx(RadioGroupItem, {
14043
14058
  value: r.id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neurodyn/react-room-viewer",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },