@neurodyn/react-room-viewer 0.0.14 → 0.0.16

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.ts CHANGED
@@ -273,9 +273,11 @@ declare const resources: {
273
273
 
274
274
  export declare function RoomViewer({ type, src, tinuuid, name, language, width, height, dimensionUnit, displayUnit, apiKey, source, widgetSession, className, ...props }: RoomViewerProps & React_2.ComponentProps<'div'>): JSX.Element;
275
275
 
276
- export declare function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, displayUnit, name, language, apiKey, source, widgetSession, open, defaultOpen, onOpenChange, ...props }: RoomViewerDialogProps): JSX.Element;
276
+ export declare function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, displayUnit, name, language, apiKey, source, widgetSession, disableClose, open, defaultOpen, onOpenChange, ...props }: RoomViewerDialogProps): JSX.Element;
277
277
 
278
278
  declare interface RoomViewerDialogProps extends Omit<RoomViewerRootProps, 'showDialogCloseButton' | 'viewerSurface' | 'dialogPortalContainer' | 'viewerDialogOpen' | 'onViewerDialogOpenChange'>, Omit<DialogProps, 'children' | 'modal'> {
279
+ /** Hide close controls and prevent user dismissal for rugs and flooring. Defaults to false. */
280
+ disableClose?: boolean;
279
281
  /** The controlled open state of the dialog. */
280
282
  open?: boolean;
281
283
  /** The open state of the dialog when it is initially rendered. */
package/dist/index.js CHANGED
@@ -11799,6 +11799,7 @@ function MaterialSummaryCard({ actionLabel, actionClassName, actionPlacement, cl
11799
11799
  });
11800
11800
  return /*#__PURE__*/ jsxs("div", {
11801
11801
  className: className,
11802
+ "data-neurodyn-room-viewer-product": "",
11802
11803
  "data-testid": testId,
11803
11804
  children: [
11804
11805
  /*#__PURE__*/ jsx_runtime_jsx("div", {
@@ -11974,6 +11975,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
11974
11975
  type: "button",
11975
11976
  variant: "secondary",
11976
11977
  "aria-label": t('floor.scene.share'),
11978
+ "data-neurodyn-room-viewer-share": "",
11977
11979
  disabled: !canShare || isSharing,
11978
11980
  onClick: handleShare,
11979
11981
  className: "size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",
@@ -11991,6 +11993,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
11991
11993
  type: "button",
11992
11994
  variant: "secondary",
11993
11995
  "aria-label": t('floor.scene.download'),
11996
+ "data-neurodyn-room-viewer-download": "",
11994
11997
  disabled: isDownloading,
11995
11998
  onClick: handleDownload,
11996
11999
  className: "size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",
@@ -12056,6 +12059,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12056
12059
  /*#__PURE__*/ jsxs("div", {
12057
12060
  className: "flex h-24 w-[254px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-left text-text-dark shadow-[var(--shadow-login)]",
12058
12061
  "data-testid": "floor-room-card",
12062
+ "data-neurodyn-room-viewer-room": "",
12059
12063
  children: [
12060
12064
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12061
12065
  src: room.imageUrl,
@@ -12087,6 +12091,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12087
12091
  canShowAr && /*#__PURE__*/ jsxs("div", {
12088
12092
  className: "pointer-events-auto flex h-24 w-[280px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-text-dark shadow-[var(--shadow-login)]",
12089
12093
  "data-testid": "floor-ar-card",
12094
+ "data-neurodyn-room-viewer-try-at-home": "",
12090
12095
  children: [
12091
12096
  /*#__PURE__*/ jsx_runtime_jsx("img", {
12092
12097
  src: room.imageUrl,
@@ -12136,6 +12141,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12136
12141
  /*#__PURE__*/ jsxs("div", {
12137
12142
  className: "flex h-[72px] items-center justify-between gap-3 overflow-hidden rounded-2xl bg-background-containers p-4 text-left text-text-dark shadow-[var(--shadow-login)]",
12138
12143
  "data-testid": "floor-tablet-room-card",
12144
+ "data-neurodyn-room-viewer-room": "",
12139
12145
  children: [
12140
12146
  /*#__PURE__*/ jsxs("span", {
12141
12147
  className: "flex min-w-0 items-center gap-2",
@@ -12173,6 +12179,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12173
12179
  }),
12174
12180
  canShowAr && /*#__PURE__*/ jsx_runtime_jsx(AR, {
12175
12181
  className: "w-full",
12182
+ "data-neurodyn-room-viewer-try-at-home": "",
12176
12183
  buttonLabel: t('floor.scene.tryAtHome'),
12177
12184
  buttonLeadingIcon: /*#__PURE__*/ jsx_runtime_jsx(Vizbl, {
12178
12185
  className: "size-5"
@@ -12209,6 +12216,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12209
12216
  children: [
12210
12217
  /*#__PURE__*/ jsxs("div", {
12211
12218
  className: "flex w-full items-center justify-between gap-3 rounded-full bg-background-containers text-left",
12219
+ "data-neurodyn-room-viewer-room": "",
12212
12220
  children: [
12213
12221
  /*#__PURE__*/ jsxs("span", {
12214
12222
  className: "flex min-w-0 items-center gap-2",
@@ -12246,6 +12254,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
12246
12254
  }),
12247
12255
  canShowAr && /*#__PURE__*/ jsx_runtime_jsx(AR, {
12248
12256
  className: "w-full",
12257
+ "data-neurodyn-room-viewer-try-at-home": "",
12249
12258
  buttonLabel: t('floor.scene.tryAtHome'),
12250
12259
  buttonLeadingIcon: /*#__PURE__*/ jsx_runtime_jsx(Vizbl, {
12251
12260
  className: "size-6"
@@ -12437,7 +12446,7 @@ function InteriorSelectionScreen(props) {
12437
12446
  })
12438
12447
  });
12439
12448
  }
12440
- function InteriorSelectionDialog({ open, portalContainer, onOpenChange, ...entryProps }) {
12449
+ function InteriorSelectionDialog({ open, showCloseButton = true, portalContainer, onOpenChange, ...entryProps }) {
12441
12450
  const { t } = useTranslation();
12442
12451
  return /*#__PURE__*/ jsx_runtime_jsx(Dialog, {
12443
12452
  open: open,
@@ -12458,7 +12467,7 @@ function InteriorSelectionDialog({ open, portalContainer, onOpenChange, ...entry
12458
12467
  }),
12459
12468
  /*#__PURE__*/ jsx_runtime_jsx(InteriorSelectionEntry, {
12460
12469
  ...entryProps,
12461
- showCloseButton: true
12470
+ showCloseButton: showCloseButton
12462
12471
  })
12463
12472
  ]
12464
12473
  })
@@ -13647,6 +13656,7 @@ function FloorViewerLayout({ showDialogCloseButton = false }) {
13647
13656
  if (!floorController.interiorSelection.shouldRender) return null;
13648
13657
  if ('dialog' === floorController.interiorSelection.presentation) return /*#__PURE__*/ jsx_runtime_jsx(InteriorSelectionDialog, {
13649
13658
  open: floorController.interiorSelection.open,
13659
+ showCloseButton: showDialogCloseButton || floorController.scene.shouldRender,
13650
13660
  portalContainer: activeDialogPortalContainer,
13651
13661
  rooms: floorController.sourceRooms,
13652
13662
  customRooms: floorController.customRooms,
@@ -14379,15 +14389,16 @@ function RoomViewerProvider({ children, src, tinuuid: initialTinuuid, type, view
14379
14389
  const hasRooms = rooms.length > 0;
14380
14390
  if (!selectedRoom && rooms[0] && roomId !== rooms[0].id) setRoomId(rooms[0].id);
14381
14391
  const objectQuery = react_query_useQuery({
14382
- queryKey: roomViewerObjectQueryKey(initialTinuuid ?? void 0, {
14392
+ queryKey: roomViewerObjectQueryKey(tinuuid ?? void 0, {
14383
14393
  apiKey,
14384
14394
  baseURL,
14385
14395
  source
14386
14396
  }),
14387
- enabled: (!shouldActivatePublicApi || activationQuery.isSuccess || activationQuery.isError && null === activationAccessError) && usesTinuuid && null === material && Boolean(initialTinuuid),
14397
+ enabled: (!shouldActivatePublicApi || activationQuery.isSuccess || activationQuery.isError && null === activationAccessError) && usesTinuuid && Boolean(tinuuid),
14398
+ placeholderData: keepPreviousData,
14388
14399
  queryFn: async ({ signal })=>{
14389
- if (!initialTinuuid) throw new Error('Tinuuid is required.');
14390
- return fetchRoomViewerObject(initialTinuuid, {
14400
+ if (!tinuuid) throw new Error('Tinuuid is required.');
14401
+ return fetchRoomViewerObject(tinuuid, {
14391
14402
  apiKey,
14392
14403
  baseURL,
14393
14404
  signal,
@@ -14726,9 +14737,10 @@ configureApiClient({
14726
14737
  configureNodeApiClient({
14727
14738
  baseURL: config_env.NODE_API_BASE_URL
14728
14739
  });
14729
- function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, displayUnit, name, language, apiKey, source, widgetSession, open, defaultOpen, onOpenChange, ...props }) {
14740
+ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, displayUnit, name, language, apiKey, source, widgetSession, disableClose = false, open, defaultOpen, onOpenChange, ...props }) {
14730
14741
  const [themeRoot, setThemeRoot] = useState(null);
14731
14742
  const placement = resolveResourcePlacement(normalizeResourceType(type));
14743
+ const isCloseDisabled = 'floor' === placement && disableClose;
14732
14744
  const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);
14733
14745
  const dialogOpen = open ?? uncontrolledOpen;
14734
14746
  const [hasRenderedDialogContent, setHasRenderedDialogContent] = useState(dialogOpen);
@@ -14739,6 +14751,7 @@ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, di
14739
14751
  dialogOpen
14740
14752
  ]);
14741
14753
  function handleOpenChange(nextOpen) {
14754
+ if (!nextOpen && isCloseDisabled) return;
14742
14755
  if (void 0 === open) setUncontrolledOpen(nextOpen);
14743
14756
  onOpenChange?.(nextOpen);
14744
14757
  }
@@ -14755,7 +14768,7 @@ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, di
14755
14768
  apiKey: apiKey,
14756
14769
  source: source,
14757
14770
  widgetSession: widgetSession,
14758
- showDialogCloseButton: true,
14771
+ showDialogCloseButton: !isCloseDisabled,
14759
14772
  viewerSurface: "dialog",
14760
14773
  dialogPortalContainer: themeRoot,
14761
14774
  viewerDialogOpen: dialogOpen,
@@ -14767,6 +14780,7 @@ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, di
14767
14780
  children: fontsinline.A
14768
14781
  }), document.head),
14769
14782
  /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs(react_shadow.div, {
14783
+ "data-neurodyn-room-viewer-root": "",
14770
14784
  style: {
14771
14785
  display: 'block',
14772
14786
  letterSpacing: 'normal',
@@ -14834,6 +14848,7 @@ function RoomViewer({ type, src, tinuuid, name, language, width, height, dimensi
14834
14848
  width: '100%'
14835
14849
  },
14836
14850
  ...props,
14851
+ "data-neurodyn-room-viewer-root": "",
14837
14852
  children: [
14838
14853
  /*#__PURE__*/ jsx_runtime_jsx("style", {
14839
14854
  children: shadowRootCssText
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.14",
4
+ "version": "0.0.16",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },