imagine-curator-sdk 0.1.1 → 0.1.2

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 (39) hide show
  1. package/README.md +12 -37
  2. package/package.json +60 -200
  3. package/src/assets/scss/index.scss +1 -1
  4. package/src/common/CreateCollectionForm.jsx +1 -1
  5. package/src/common/OrgSection/OrgSection.jsx +2 -2
  6. package/src/components/Configurator/ConfigTab/EditMaterialProperties/EditMaterialProperties.jsx +4 -2
  7. package/src/components/RetailAutomation/RetailAutomationRender/RetailAutomationRender.jsx +1 -1
  8. package/src/components/TeamMembersFilter/TeamMembersFilter.jsx +2 -2
  9. package/src/components/admin/curator/CuratorHeader/CreateProductBuilderPreview.jsx +1 -1
  10. package/src/components/admin/curator/CuratorHeader/NavigationFile.jsx +2 -2
  11. package/src/components/admin/curator/CuratorHeader/useCreatePropGroup.js +3 -3
  12. package/src/components/admin/curator/CuratorHeader/useCreateRoom.js +2 -2
  13. package/src/components/admin/curator/CuratorHeader/useUnityShortcuts.js +2 -2
  14. package/src/components/admin/curator/ProductBuilderComponents/ProductBuilderUnity.jsx +2 -2
  15. package/src/components/admin/curator/RenderPreviewsDialog/RenderPreviewDialog.jsx +1 -1
  16. package/src/components/admin/curator/components/TileGrout/SaveTilePattern.jsx +1 -1
  17. package/src/components/admin/curator/components/TileGrout/SelectNewTiles.jsx +1 -1
  18. package/src/components/admin/curator/components/TileGrout/TileGroutPattern.jsx +1 -1
  19. package/src/components/admin/curator/components/TileGrout/TileGroutTextureList.jsx +1 -1
  20. package/src/components/admin/curator/components/camera/CameraPresetsPopup.jsx +1 -1
  21. package/src/components/admin/curator/components/camera/useCameraActions.js +2 -2
  22. package/src/components/admin/curator/components/camera/useImportCameraPresets.js +1 -1
  23. package/src/components/admin/curator/components/lights/HDRIPopup.jsx +3 -3
  24. package/src/components/admin/curator/components/lights/useHDRIUpload.js +1 -1
  25. package/src/components/admin/curator/components/saveMaterial/SaveMaterialPreset.jsx +1 -1
  26. package/src/components/admin/curator/moreSection/moreSection.jsx +1 -2
  27. package/src/components/admin/curator/sideBar.v2.jsx +1 -1
  28. package/src/components/admin/curator/sidebarProductBuilder.jsx +1 -1
  29. package/src/components/admin/curator/stylesSection/ColorsTab/useColors.js +1 -1
  30. package/src/components/admin/curator/stylesSection/PropertiesTab/useTextureImages.js +1 -1
  31. package/src/components/admin/curator/stylesSection/TexturesTab/useTextures.js +1 -1
  32. package/src/components/admin/curator/stylesSection/TexturesTab/useUploadTexture.js +1 -1
  33. package/src/helpers/idb.js +5 -9
  34. package/src/hooks/useAutomationPopup.js +2 -2
  35. package/src/hooks/useModelActions.jsx +1 -1
  36. package/src/lib.js +1 -8
  37. package/src/pages/admin/curator/curatorAutosave.js +2 -2
  38. package/src/redux/slicers/admin/curatorMenuPreferencesSlicer.js +1 -1
  39. package/src/screens/RenderDetails.jsx +1 -1
package/README.md CHANGED
@@ -1,55 +1,30 @@
1
1
  # Imagine Curator SDK
2
2
 
3
- A complete React application for the Imagine.io 3D Curator.
3
+ React components for 3D visualization and rendering.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install
9
- ```
10
-
11
- ## Development
12
-
13
- ```bash
14
- npm run dev
15
- ```
16
-
17
- ## Build
18
-
19
- ```bash
20
- npm run build
8
+ npm install imagine-curator-sdk
21
9
  ```
22
10
 
23
11
  ## Usage
24
12
 
25
- The main component is `CuratorWrapper` which wraps the entire Curator application with Redux store and routing.
26
-
27
13
  ```jsx
28
- import CuratorWrapper from './src/CuratorWrapper';
14
+ import CuratorWrapper from 'imagine-curator-sdk';
15
+ import 'imagine-curator-sdk/styles';
29
16
 
30
- // Render the curator
31
- <CuratorWrapper />
17
+ function App() {
18
+ return <CuratorWrapper />;
19
+ }
32
20
  ```
33
21
 
34
- ## Project Structure
22
+ ## Peer Dependencies
35
23
 
36
- ```
37
- package/
38
- ├── src/
39
- │ ├── CuratorWrapper.jsx # Main wrapper component
40
- │ ├── screens/
41
- │ │ └── Curator.jsx # Main curator screen
42
- │ ├── redux/
43
- │ │ └── store.js # Redux store configuration
44
- │ ├── components/ # UI components
45
- │ ├── hooks/ # Custom React hooks
46
- │ ├── helpers/ # Utility functions
47
- │ ├── api/ # API calls
48
- │ └── contexts/ # React contexts
49
- ├── public/ # Static assets
50
- ├── package.json
51
- ├── vite.config.js
52
- └── index.html
24
+ This package requires React 18+:
25
+
26
+ ```bash
27
+ npm install react react-dom
53
28
  ```
54
29
 
55
30
  ## License
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "imagine-curator-sdk",
3
- "version": "0.1.1",
4
- "description": "Imagine Curator SDK - 3D visualization and rendering component",
3
+ "version": "0.1.2",
4
+ "description": "Imagine Curator SDK - React components for 3D visualization and rendering",
5
5
  "type": "module",
6
- "homepage": "/",
7
6
  "main": "src/lib.js",
8
7
  "module": "src/lib.js",
9
8
  "exports": {
@@ -14,213 +13,74 @@
14
13
  "src",
15
14
  "public"
16
15
  ],
17
- "dependencies": {
18
- "@djthoms/pretty-checkbox": "^3.1.0",
19
- "@egjs/view360": "3.6.2",
20
- "@hookform/resolvers": "^2.8.8",
21
- "@lottiefiles/dotlottie-react": "^0.12.0",
22
- "@pathofdev/react-tag-input": "^1.0.7",
23
- "@react-oauth/google": "^0.7.0",
24
- "@react-pdf/renderer": "^4.3.0",
25
- "@reduxjs/toolkit": "^1.7.2",
26
- "@sentry/cli": "^2.41.1",
27
- "@sentry/react": "^8.52.0",
28
- "@sentry/wizard": "^3.40.0",
29
- "@stripe/react-stripe-js": "^1.7.0",
30
- "@stripe/stripe-js": "^1.25.0",
31
- "@techstark/opencv-js": "^4.8.0-release.4",
32
- "@testing-library/jest-dom": "^5.16.2",
33
- "@testing-library/react": "^14.0.0",
34
- "@testing-library/user-event": "^13.5.0",
35
- "assert": "^2.0.0",
36
- "autoprefixer": "10.4.5",
37
- "axios": "^0.25.0",
38
- "bootstrap": "^5.1.3",
39
- "browser-image-compression": "^2.0.0",
40
- "concurrently": "^7.0.0",
41
- "country-state-city": "^3.0.1",
42
- "date-fns": "^2.28.0",
43
- "decompress-response": "^8.0.0",
44
- "detect-browser": "^5.3.0",
45
- "device-detector-js": "^3.0.3",
46
- "dom-to-image-more": "^3.3.0",
47
- "downloadjs": "^1.4.7",
48
- "draft-js": "^0.11.7",
49
- "draft-js-export-html": "^1.4.1",
50
- "draft-js-plugins-editor": "^3.0.0",
51
- "exiftool.js": "^0.3.0",
52
- "fflate": "^0.8.2",
53
- "file-saver": "^2.0.5",
54
- "filesize": "^9.0.11",
55
- "formik": "^2.2.9",
56
- "gapi-script": "^1.2.0",
57
- "gltf-validator": "^2.0.0-dev.3.9",
58
- "history": "^5.3.0",
59
- "hotkeys-js": "^3.9.2",
60
- "idb": "^7.0.1",
61
- "immutable": "^4.1.0",
62
- "is-hotkey": "^0.2.0",
63
- "javascript-time-ago": "^2.3.13",
64
- "jszip": "^3.10.0",
65
- "jszip-utils": "^0.1.0",
66
- "jwt-decode": "^3.1.2",
67
- "lodash": "^4.17.21",
68
- "memoizee": "^0.4.15",
69
- "memory-stats": "^1.0.2",
70
- "mixpanel-browser": "^2.47.0",
71
- "moment": "^2.29.1",
72
- "moment-timezone": "^0.5.43",
73
- "multiselect-react-dropdown": "^2.0.17",
74
- "mz-react-round-slider": "^1.0.3",
75
- "online-3d-viewer": "^0.14.0",
76
- "piexifjs": "^1.0.6",
77
- "pluralize": "^8.0.0",
78
- "posthog-js": "^1.260.3",
79
- "pretty-checkbox-react": "^3.2.0",
80
- "pubsub-js": "^1.9.4",
81
- "pure-color": "^1.3.0",
82
- "rc-progress": "^3.3.3",
83
- "rc-slider": "^11.1.7",
84
- "react": "^18.2.0",
85
- "react-360-view": "^0.1.3",
86
- "react-alice-carousel": "^2.6.1",
87
- "react-aria": "^3.36.0",
88
- "react-beautiful-dnd": "^13.1.0",
89
- "react-beforeunload": "^2.5.3",
90
- "react-bootstrap": "^2.2.2",
91
- "react-bootstrap-toggle": "^2.3.2",
92
- "react-bootstrap-typeahead": "^6.0.0-alpha.11",
93
- "react-code-input": "^3.10.1",
94
- "react-color": "^2.19.3",
95
- "react-compare-slider": "^3.1.0",
96
- "react-confirm-alert": "^2.8.0",
97
- "react-contenteditable": "^3.3.6",
98
- "react-datepicker": "^4.7.0",
99
- "react-device-detect": "^2.2.3",
100
- "react-dom": "^18.2.0",
101
- "react-draggable": "^4.4.5",
102
- "react-dropzone": "^12.0.5",
103
- "react-easy-crop": "^5.0.2",
104
- "react-full-screen": "^1.1.0",
105
- "react-google-drive-picker": "^1.2.0",
106
- "react-google-recaptcha": "^3.1.0",
107
- "react-gtm-module": "^2.0.11",
108
- "react-helmet": "^6.1.0",
109
- "react-hook-form": "^7.29.0",
110
- "react-hubspot-form": "^1.3.7",
111
- "react-icons": "^4.3.1",
112
- "react-image-crop": "^10.1.8",
113
- "react-image-file-resizer": "^0.4.8",
114
- "react-image-lightbox": "^5.1.4",
115
- "react-infinite-scroll-component": "^6.1.0",
116
- "react-infinite-scroll-hook": "^4.0.3",
117
- "react-infinite-scroller": "^1.2.6",
118
- "react-js-pagination": "^3.0.3",
119
- "react-loading": "^2.0.3",
120
- "react-loading-skeleton": "^3.1.0",
121
- "react-magnifier": "^3.0.4",
122
- "react-multi-carousel": "^2.8.4",
123
- "react-number-format": "^4.9.4",
124
- "react-overlays": "^5.1.1",
125
- "react-paginate": "^8.1.3",
126
- "react-phone-input-2": "^2.14.0",
127
- "react-qr-code": "^2.0.11",
128
- "react-redux": "^7.2.6",
129
- "react-responsive-carousel": "^3.2.23",
130
- "react-router-dom": "^6.2.1",
131
- "react-scroll": "^1.8.7",
132
- "react-select": "^5.2.2",
133
- "react-select-async-paginate": "^0.6.1",
134
- "react-slick": "^0.28.1",
135
- "react-sortablejs": "^6.0.0",
136
- "react-tagsinput": "^3.19.0",
137
- "react-time-ago": "^7.1.9",
138
- "react-toastify": "^8.1.1",
139
- "react-unity-webgl": "^8.7.4",
140
- "react-use": "^17.3.2",
141
- "react-video-thumbnail": "^0.1.3",
142
- "react-youtube": "^10.1.0",
143
- "react-zoom-pan-pinch": "^2.1.3",
144
- "reselect": "^4.1.8",
145
- "rgb-hex": "^4.0.0",
146
- "sass": "^1.49.7",
147
- "shaka-player-react": "^1.1.5",
148
- "slick-carousel": "^1.8.1",
149
- "sortablejs": "^1.14.0",
150
- "source-map-explorer": "^2.5.2",
151
- "spritespin": "^5.0.0-beta.1",
152
- "swiper": "^8.1.3",
153
- "three": "^0.132.2",
154
- "three-usdz-loader": "^1.0.9",
155
- "unzipit": "^1.4.0",
156
- "use-dropbox-chooser": "^0.0.5",
157
- "userpilot": "^1.3.5",
158
- "utif": "^3.1.0",
159
- "uuid": "^8.3.2",
160
- "validator": "^13.11.0",
161
- "web-vitals": "^2.1.4",
162
- "xlsx": "^0.18.5",
163
- "yup": "^0.32.11"
164
- },
165
- "scripts": {
166
- "dev": "vite",
167
- "start": "cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e development vite",
168
- "start-dev-v3": "cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e dev vite",
169
- "start-stage": "cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e stage vite",
170
- "start-staging": "env-cmd -e staging vite",
171
- "start-prod": "env-cmd -e production vite",
172
- "prebuild": "rimraf build && echo $(git rev-parse HEAD) > public/version.txt",
173
- "build": "vite build",
174
- "build-local": "npm run prebuild && cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e local vite build",
175
- "build-dev": "npm run prebuild && cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e development vite build",
176
- "build-dev-v3": "npm run prebuild && cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e dev vite build",
177
- "build-stage": "npm run prebuild && cross-env VITE_VERSION=$(git rev-parse HEAD) env-cmd -e stage vite build",
178
- "build-staging": "npm run prebuild && cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e staging vite build",
179
- "build-prod": "npm run prebuild && cross-env VITE_VERSION=\"$(git rev-parse HEAD)\" env-cmd -e production vite build --sourcemap",
180
- "build-lib": "rimraf dist && env-cmd -e production vite build --mode library",
181
- "preview": "vite preview",
182
- "lint": "eslint src --ext .js,.jsx"
183
- },
184
- "browserslist": {
185
- "production": [
186
- ">0.2%",
187
- "not dead",
188
- "not op_mini all"
189
- ],
190
- "development": [
191
- "last 1 chrome version",
192
- "last 1 firefox version",
193
- "last 1 safari version"
194
- ]
195
- },
196
16
  "peerDependencies": {
197
17
  "react": "^18.0.0",
198
18
  "react-dom": "^18.0.0"
199
19
  },
200
- "devDependencies": {
201
- "@vitejs/plugin-react": "^4.2.1",
202
- "cross-env": "^7.0.3",
203
- "env-cmd": "^10.1.0",
204
- "eslint": "^8.13.0",
205
- "rimraf": "^5.0.5",
206
- "vite": "^5.4.2"
207
- },
208
- "browser": {
209
- "crypto": false,
210
- "fs": false,
211
- "os": false,
212
- "path": false,
213
- "stream": false
20
+ "dependencies": {
21
+ "@dnd-kit/core": "^6.0.8",
22
+ "@dnd-kit/sortable": "^7.0.2",
23
+ "@dnd-kit/utilities": "^3.2.1",
24
+ "@hello-pangea/dnd": "^16.6.0",
25
+ "@hookform/resolvers": "^3.3.4",
26
+ "@lottiefiles/react-lottie-player": "^3.5.3",
27
+ "@popperjs/core": "^2.11.8",
28
+ "@react-spring/web": "^9.7.3",
29
+ "@reduxjs/toolkit": "^2.2.1",
30
+ "@sentry/react": "^8.0.0",
31
+ "@types/uuid": "^9.0.8",
32
+ "axios": "^1.6.7",
33
+ "bootstrap": "^5.3.3",
34
+ "classnames": "^2.5.1",
35
+ "colord": "^2.9.3",
36
+ "copy-to-clipboard": "^3.3.3",
37
+ "crypto-js": "^4.2.0",
38
+ "dexie": "^3.2.5",
39
+ "formik": "^2.4.5",
40
+ "fuse.js": "^7.0.0",
41
+ "idb": "^8.0.0",
42
+ "javascript-time-ago": "^2.5.10",
43
+ "js-cookie": "^3.0.5",
44
+ "lodash": "^4.17.21",
45
+ "lottie-react": "^2.4.0",
46
+ "moment": "^2.30.1",
47
+ "pako": "^2.1.0",
48
+ "papaparse": "^5.4.1",
49
+ "react-bootstrap": "^2.10.2",
50
+ "react-colorful": "^5.6.1",
51
+ "react-datepicker": "^6.2.0",
52
+ "react-dom": "^18.2.0",
53
+ "react-hook-form": "^7.51.0",
54
+ "react-infinite-scroll-component": "^6.1.0",
55
+ "react-range": "^1.8.14",
56
+ "react-redux": "^9.1.0",
57
+ "react-router-dom": "^6.22.2",
58
+ "react-select": "^5.8.0",
59
+ "react-time-ago": "^7.3.1",
60
+ "react-toastify": "^10.0.4",
61
+ "react-tooltip": "^5.26.3",
62
+ "react-unity-webgl": "^9.5.2",
63
+ "react-zoom-pan-pinch": "^3.4.4",
64
+ "redux": "^5.0.1",
65
+ "reselect": "^5.1.0",
66
+ "sass": "^1.71.1",
67
+ "swiper": "^11.0.7",
68
+ "uuid": "^9.0.1",
69
+ "yup": "^1.4.0"
214
70
  },
215
71
  "keywords": [
216
72
  "react",
217
73
  "3d",
218
74
  "visualization",
219
75
  "curator",
220
- "rendering",
76
+ "imagine",
221
77
  "sdk",
222
- "imagine"
78
+ "rendering"
223
79
  ],
224
- "author": "Imagine.io",
225
- "license": "MIT"
80
+ "author": "",
81
+ "license": "MIT",
82
+ "repository": {
83
+ "type": "git",
84
+ "url": ""
85
+ }
226
86
  }
@@ -1,7 +1,7 @@
1
1
  // Bootstrap
2
2
  @import "./_variables";
3
3
  @import './bootstrapVariables'; // Overrides
4
- @import '../../../node_modules/bootstrap/scss/bootstrap';
4
+ @import 'bootstrap/scss/bootstrap';
5
5
  @import "../fonts/fonts.scss";
6
6
 
7
7
  // Variables
@@ -59,7 +59,7 @@ export const CreateCollectionForm = ({ onCancel, onSuccess }) => {
59
59
  const createCollection = async (values) => {
60
60
 
61
61
  const payload = { ...values };
62
- payload.owner = currentUser.id;
62
+ payload.owner = currentUser?.id;
63
63
 
64
64
  try {
65
65
  const result = await apiCreateCollection(payload);
@@ -99,7 +99,7 @@ function OrgOwnerModal(props) {
99
99
 
100
100
  const formattedMemberList = useMemo(() => {
101
101
  return memberList
102
- .filter((m) => m.id !== currentUser.id)
102
+ .filter((m) => m.id !== currentUser?.id)
103
103
  .map((m) => ({
104
104
  id: m.id,
105
105
  image: m.user.profile_image,
@@ -207,7 +207,7 @@ export default function OrgSection(props) {
207
207
 
208
208
  useEffect(() => {
209
209
  getOrgInfo();
210
- }, [userDetails, userCtx.currentUser.organization, userCtx.currentUser.role.is_owner]);
210
+ }, [userDetails, userCtx.currentUser?.organization, userCtx.currentUser?.role?.is_owner]);
211
211
 
212
212
  useEffect(() => {
213
213
  getOrgOwner();
@@ -113,8 +113,10 @@ export const EditMaterialProperties = () => {
113
113
  }, [customMapSelectionActive, editTextureActive]);
114
114
 
115
115
  useEffect(() => {
116
- dispatch(getCuratorSettings({ userId: currentUser.user.id }));
117
- }, []);
116
+ if (currentUser?.user?.id) {
117
+ dispatch(getCuratorSettings({ userId: currentUser.user.id }));
118
+ }
119
+ }, [currentUser?.user?.id]);
118
120
 
119
121
  if (!option) {
120
122
  return <EditMaterialWhileNoData option={option} labelId={labelId} />;
@@ -353,7 +353,7 @@ export const RetailAutomationRender = ({ show, onClose, popupHeader }) => {
353
353
  errorToastV2('Collection with the same name already exists. Please add another name.');
354
354
  return;
355
355
  } else {
356
- selectedCollectionLocal = await createANewCollection(collectionName, currentUser.id);
356
+ selectedCollectionLocal = await createANewCollection(collectionName, currentUser?.id);
357
357
  }
358
358
  } else {
359
359
  selectedCollectionLocal = selectedCollection;
@@ -91,8 +91,8 @@ const TeamMembersFilterOverlayController = (props) => {
91
91
  });
92
92
 
93
93
  // const listWithCurrentUserAsFirst = memberList;
94
- const listWithCurrentUserAsFirst = memberList.filter((m) => m.id !== currentUser.id);
95
- listWithCurrentUserAsFirst.unshift(currentUser);
94
+ const listWithCurrentUserAsFirst = memberList.filter((m) => m.id !== currentUser?.id);
95
+ if (currentUser) listWithCurrentUserAsFirst.unshift(currentUser);
96
96
 
97
97
  useEffect(() => {
98
98
  if (dataLoadedOnce) {
@@ -66,7 +66,7 @@ export const CreateProductBuilderPreview = ({ show, onClose }) => {
66
66
  const dispatch = useDispatch();
67
67
  const { room_id } = useParams();
68
68
  const { currentUser } = useUserContext();
69
- const organisationId = currentUser.organization;
69
+ const organisationId = currentUser?.organization;
70
70
  const [resolutionExceedMsg, setResolutionExceedMsg] = useState('');
71
71
  const [selectedCameraId, setSelectedCameraId] = useState(null);
72
72
  const selectedCamera = cameras.find((c) => c?.id === selectedCameraId);
@@ -90,8 +90,8 @@ export const NavigationFile = ({ onLiveOnAppClick, combinedWithConfiguratorId })
90
90
  const saveEnabled =
91
91
  type !== 'room' &&
92
92
  currentUser &&
93
- projectOwner?.owner_organization === currentUser.organization &&
94
- (projectOwner?.id === currentUser.user?.id || projectOwner?.user_id == currentUser.user?.id);
93
+ projectOwner?.owner_organization === currentUser?.organization &&
94
+ (projectOwner?.id === currentUser?.user?.id || projectOwner?.user_id == currentUser?.user?.id);
95
95
  const disableMenuItems = !curatorInitialized || exportProjectLoading || isOnboarding;
96
96
 
97
97
  useEffect(() => {
@@ -161,9 +161,9 @@ export const useCreatePropGroup = ({ visible, onHide }) => {
161
161
  });
162
162
 
163
163
  const currentOrg = {
164
- id: currentUser.organization_detail.id,
165
- value: currentUser.organization_detail.id,
166
- label: currentUser.organization_detail.name,
164
+ id: currentUser?.organization_detail?.id,
165
+ value: currentUser?.organization_detail?.id,
166
+ label: currentUser?.organization_detail?.name,
167
167
  };
168
168
  setCreatePropGroup({
169
169
  ...createPropGroup,
@@ -238,7 +238,7 @@ export const useCreateRoom = ({ visible, onHide, saveMaterial = false, showInter
238
238
  // field: 'owner_organization',
239
239
  // message: 'Please Enter Material Owner',
240
240
  // });
241
- if (createRoom.organization.length === 0 && currentUser.is_live_on_app)
241
+ if (createRoom.organization.length === 0 && currentUser?.is_live_on_app)
242
242
  errorList.push({
243
243
  field: 'organization',
244
244
  message: 'Please add atleast one Organisation',
@@ -353,7 +353,7 @@ export const useCreateRoom = ({ visible, onHide, saveMaterial = false, showInter
353
353
  filterOptions?.forEach((data) => {
354
354
  materialFormData.append('filteroptions', data)
355
355
  })
356
- if (currentUser.is_live_on_app) {
356
+ if (currentUser?.is_live_on_app) {
357
357
  materialFormData.append('owner', createRoom?.owner_organization?.value || currentUser?.organization || currentUser?.organization_detail?.id);
358
358
  const allOrgSelected = createRoom?.organization?.map((data) => data.value);
359
359
  if (allOrgSelected?.includes('all')) {
@@ -1028,8 +1028,8 @@ export const useUnityShortcuts = () => {
1028
1028
 
1029
1029
  const projectOwner = selectProjectOwner(getAppState());
1030
1030
  const isOwner =
1031
- projectOwner?.owner_organization === currentUser.organization &&
1032
- projectOwner?.id === currentUser.user.id;
1031
+ projectOwner?.owner_organization === currentUser?.organization &&
1032
+ projectOwner?.id === currentUser?.user?.id;
1033
1033
  if (!isOwner) {
1034
1034
  saveProjectAsNew();
1035
1035
  return;
@@ -75,7 +75,7 @@ export const ProductBuilderUnity = React.memo(() => {
75
75
  const curatorInitialized = useSelector(selectCuratorInitialized);
76
76
  const saveAsModal = useSelector(selectSaveAsModal);
77
77
  const { currentUser } = useUserContext();
78
- const organisationId = currentUser.organization;
78
+ const organisationId = currentUser?.organization;
79
79
  const { filterData } = useSelector(filterSelector);
80
80
  const [isMapsSet, setIsMapsSet] = useState(false);
81
81
  const [isInitializing, setIsInitializing] = useState(false);
@@ -518,7 +518,7 @@ export const ProductBuilderUnity = React.memo(() => {
518
518
  ) {
519
519
  return;
520
520
  }
521
- const brands = currentUser.organization;
521
+ const brands = currentUser?.organization;
522
522
  const params = {
523
523
  brands,
524
524
  search: '',
@@ -342,7 +342,7 @@ const RenderPreviewDialogContent = (props) => {
342
342
  isCallback: callback ? true : false,
343
343
  };
344
344
  if (isBuilder) {
345
- const organisationId = currentUser.organization;
345
+ const organisationId = currentUser?.organization;
346
346
  const roomId = await roomIdForMattressBuilder({ organisationId });
347
347
  data.mattressBuilderObj = {
348
348
  roomId,
@@ -65,7 +65,7 @@ export const SaveTilePattern = ({ show, handleClose }) => {
65
65
  const [metallicMapImageDetail, setMetallicMapImageDetail] = useState();
66
66
  const dispatch = useDispatch();
67
67
  const { currentUser } = useUserContext();
68
- const brands = currentUser.organization;
68
+ const brands = currentUser?.organization;
69
69
  const selectedPattern = useSelector(selectSelectedPattern);
70
70
  const [heightWidthFromUnity, setHeightWidthFromUnity] = useState();
71
71
  const erosionValues = useSelector(selectErosionValues);
@@ -36,7 +36,7 @@ export const SelectNewTiles = ({ closeTexture, isNewTextureScreen }) => {
36
36
  const [loading, setLoading] = useState(false);
37
37
  const [hasMore, setHasMore] = useState(false);
38
38
  const { currentUser } = useUserContext();
39
- const brands = currentUser.organization;
39
+ const brands = currentUser?.organization;
40
40
  let textureParams = {
41
41
  brands,
42
42
  per_page: 20,
@@ -50,7 +50,7 @@ export const TileGroutPattern = ({ resetValues, changeTabToProp }) => {
50
50
  const [allData, setAllData] = useState([]);
51
51
  const [allCopyData, setAllCopyData] = useState([]);
52
52
  const { currentUser } = useUserContext();
53
- const brands = currentUser.organization;
53
+ const brands = currentUser?.organization;
54
54
  const selectedPatternFromStore = useSelector(selectSelectedPattern);
55
55
  let allGroutColors = useSelector(selectAllColors);
56
56
  const unity = useUnityContext();
@@ -43,7 +43,7 @@ export const TileGroutTextureList = ({ closeTexture, isTextureScreen }) => {
43
43
  const [loading, setLoading] = useState(false);
44
44
  const [hasMore, setHasMore] = useState(false);
45
45
  const { currentUser } = useUserContext();
46
- const brands = currentUser.organization;
46
+ const brands = currentUser?.organization;
47
47
  let textureParams = {
48
48
  brands,
49
49
  per_page: 20,
@@ -111,7 +111,7 @@ export const CameraPresetsPopup = ({ open, onClose, originalTemplateId, lightRoo
111
111
 
112
112
  <CuratorAccordion hideArrows activeKey="NONE">
113
113
  {sortedCameraPresetsList?.map((camera) => {
114
- const belongsToUser = camera.member === currentUser.id;
114
+ const belongsToUser = camera.member === currentUser?.id;
115
115
  const selected = selectedIds.includes(camera.id);
116
116
 
117
117
  return (
@@ -127,7 +127,7 @@ export const useCameraActions = () => {
127
127
  camDetails.lensShiftY = camDetails.lensShiftY;
128
128
 
129
129
  camDetails.cameraName = name;
130
- camDetails.member = currentUser.id;
130
+ camDetails.member = currentUser?.id;
131
131
 
132
132
  const canvasSize = selectCanvasSize(getAppState());
133
133
  camDetails.canvas_width = decimals(canvasSize.width || 0, 4);
@@ -166,7 +166,7 @@ export const useCameraActions = () => {
166
166
 
167
167
  const cameraCopy = {
168
168
  ...camera,
169
- member: currentUser.id,
169
+ member: currentUser?.id,
170
170
  isdepthOfField: false,
171
171
  selectedObjectName: '',
172
172
  focusXPos: '',
@@ -59,7 +59,7 @@ export const useImportCameraPresets = () => {
59
59
  let projectTypeKey = type === 'project' ? 'project' : 'room';
60
60
  let keyToSave = roomId;
61
61
  formData.append(projectTypeKey, keyToSave);
62
- formData.append('member', currentUser.id);
62
+ formData.append('member', currentUser?.id);
63
63
  formData.append('data', JSON.stringify(presetList));
64
64
 
65
65
 
@@ -49,10 +49,10 @@ export const HDRIPopup = () => {
49
49
  const isMyHdriOpen = hdriPopup === HDRI_POPUP.MY;
50
50
 
51
51
  const requestParams = useMemo(() => {
52
- return isMyHdriOpen
53
- ? { created_by: currentUser.id }
52
+ return isMyHdriOpen
53
+ ? { created_by: currentUser?.id }
54
54
  : { is_preset: true }
55
- }, [isMyHdriOpen])
55
+ }, [isMyHdriOpen, currentUser?.id])
56
56
 
57
57
  let {
58
58
  list: hdriList,
@@ -86,7 +86,7 @@ export const useHDRIUpload = () => {
86
86
  file: hdriFile,
87
87
  thumbnail: imageFile,
88
88
  output_reference: imageFile,
89
- member: currentUser.id,
89
+ member: currentUser?.id,
90
90
 
91
91
  name,
92
92
  });
@@ -211,7 +211,7 @@ export const SaveMaterialPresetContent = memo(({ modalProps }) => {
211
211
  </Col>
212
212
  </Row>
213
213
  )} */}
214
- {currentUser.is_live_on_app && (
214
+ {currentUser?.is_live_on_app && (
215
215
  <div className="mb-3">
216
216
  <SelectFormGroupV2
217
217
  label="Organization"
@@ -76,7 +76,7 @@ const MoreSection = memo(() => {
76
76
  };
77
77
 
78
78
  const menuItems = useMemo(() => {
79
- const items = (sidebarConfig || [])
79
+ const items = sidebarConfig
80
80
  .map((item) => {
81
81
  if (item.name === CURATOR_MENU_SECTION.AUTOMATION && !hasPermission(PERMISSION.CAN_CREATE_AUTOMATION)) return null;
82
82
  if (item.name === CURATOR_MENU_SECTION.TILE_GROUT && !hasPermission(PERMISSION.CAN_CREATE_TILE_GROUT)) return null;
@@ -91,7 +91,6 @@ const MoreSection = memo(() => {
91
91
  };
92
92
  })
93
93
  .filter((item) => {
94
- if (!item) return false;
95
94
  if (HIDDEN_SECTIONS.includes(item.name)) return false;
96
95
 
97
96
  return !item.isDefault;
@@ -181,7 +181,7 @@ export const SidebarV2 = memo(() => {
181
181
  // },
182
182
  };
183
183
 
184
- let menuConfig = (sidebarConfig || []).map((item) => {
184
+ let menuConfig = sidebarConfig.map((item) => {
185
185
  return {
186
186
  name: item.unique_name,
187
187
  label: item.short_name || item.display_name,
@@ -170,7 +170,7 @@ export const SidebarProductBuilder = memo(() => {
170
170
  Icon: CuratorLayerIconSmall,
171
171
  },
172
172
  };
173
- const menuConfig = (sidebarConfig || []).map((item) => {
173
+ const menuConfig = sidebarConfig.map((item) => {
174
174
  return {
175
175
  name: item.unique_name,
176
176
  label: item.short_name || item.display_name,
@@ -47,7 +47,7 @@ export const useColors = ({ undoRedoDisabled } = {}) => {
47
47
  const result = await dispatch(
48
48
  ColorCodeAddApi({
49
49
  color: hex,
50
- memberId: currentUser.id,
50
+ memberId: currentUser?.id,
51
51
  ...(name && { name })
52
52
  })
53
53
  );
@@ -105,7 +105,7 @@ export const useTextureImages = (changedMapsPath, properties) => {
105
105
  label: t.label,
106
106
  type: t.type,
107
107
  // organizationId: textureData?.owner_organization,
108
- organizationName: currentUser.organization !== orgId ? brand?.name : null,
108
+ organizationName: currentUser?.organization !== orgId ? brand?.name : null,
109
109
  name: textureData?.name || 'Default',
110
110
  };
111
111
  })
@@ -23,7 +23,7 @@ export const useTextures = ({
23
23
 
24
24
  const requestParams = useMemo(() => {
25
25
  const baseFilter = {
26
- ...(useBrandsFilter ? { brands: currentUser.organization } : {}),
26
+ ...(useBrandsFilter ? { brands: currentUser?.organization } : {}),
27
27
  ...params,
28
28
  };
29
29
 
@@ -65,7 +65,7 @@ export const useUploadTexture = ({ applyTexture, type, isBuilder } = {}) => {
65
65
  const { isUnlimitedTextures, hideNewPlans, isFreemiumUser } = useCurrentOrganizationInfo();
66
66
  const availableTextures = useSelector(selectAvailableTextures);
67
67
  const { isGuestLogin, currentUser } = useUserContext();
68
- const brands = currentUser.organization;
68
+ const brands = currentUser?.organization;
69
69
 
70
70
  const uploadTexture = handlePermissionEvent(PERMISSION.UPLOAD_TEXTURE, async (files) => {
71
71
  if (files.length > availableTextures && !isUnlimitedTextures && !isMattressBuilderPage()) {
@@ -659,12 +659,8 @@ export const clearAllUploadedFilesIDB = async () => {
659
659
  }
660
660
  // endregion
661
661
 
662
- // Ensure window.LFApp exists before setting idb
663
- if (typeof window !== 'undefined') {
664
- window.LFApp = window.LFApp || {};
665
- window.LFApp.idb = {
666
- getAsset,
667
- STORE,
668
- getAllFiles,
669
- };
670
- }
662
+ window.LFApp.idb = {
663
+ getAsset,
664
+ STORE,
665
+ getAllFiles,
666
+ };
@@ -211,8 +211,8 @@ export const useCreateAutomation = () => {
211
211
  // formObj.append('room_id', calculatedRoomId);
212
212
  // }
213
213
  formObj.append('room_id', calculatedRoomId);
214
- formObj.append('created_by', currentUser.id);
215
- formObj.append('owner_organization', currentUser.organization);
214
+ formObj.append('created_by', currentUser?.id);
215
+ formObj.append('owner_organization', currentUser?.organization);
216
216
  formObj.append('json_file', blob, 'room_info.json');
217
217
 
218
218
  addIdsToRequestData({
@@ -60,7 +60,7 @@ export const useModelActions = ({
60
60
  const member_id =
61
61
  modelType === MODEL_TYPES.COLLECTION ? owner_detail.user.member_id : member_details.member_id;
62
62
 
63
- if (!isAdminOrOwner(currentUser) && member_id !== currentUser.id) {
63
+ if (!isAdminOrOwner(currentUser) && member_id !== currentUser?.id) {
64
64
  warningToast('You do not have ownership to delete this item.', {
65
65
  toastId: `CAN_NOT_DELETE_${item.id}`,
66
66
  });
package/src/lib.js CHANGED
@@ -1,23 +1,16 @@
1
1
  // Library entry point for npm package
2
-
3
- // Initialize global variables first
4
2
  import './globalVars';
5
-
6
- // Initialize javascript-time-ago locale (required for react-time-ago)
7
3
  import TimeAgo from 'javascript-time-ago';
8
4
  import en from 'javascript-time-ago/locale/en';
5
+
9
6
  TimeAgo.addDefaultLocale(en);
10
7
 
11
- // Global styles
12
8
  import './assets/scss/index.scss';
13
9
  import './assets/css/__theme.scss';
14
10
 
15
11
  import CuratorWrapper from './CuratorWrapper';
16
12
  import store from './redux/store';
17
13
 
18
- // Export main component
19
14
  export { CuratorWrapper };
20
15
  export { store };
21
-
22
- // Default export
23
16
  export default CuratorWrapper;
@@ -143,8 +143,8 @@ const updateBackendAutosave = async ({ roomInfo }) => {
143
143
 
144
144
  const currentUser = getCurrentUser();
145
145
  const canEditFile =
146
- projectData?.created_by === currentUser.id ||
147
- (isAdminOrOwner(currentUser) && projectData?.organization === currentUser.organization);
146
+ projectData?.created_by === currentUser?.id ||
147
+ (isAdminOrOwner(currentUser) && projectData?.organization === currentUser?.organization);
148
148
 
149
149
  const formData = new FormData();
150
150
 
@@ -76,7 +76,7 @@ export default curatorMenuPreferencesReducer;
76
76
  export const selectEnabledSections = (state) => {
77
77
  return state.curatorMenuPreferences.enabledSections
78
78
  }
79
- export const selectSidebarDefaultConfig = (state) => state.curatorMenuPreferences?.config || [];
79
+ export const selectSidebarDefaultConfig = (state) => state.curatorMenuPreferences.config;
80
80
  export const selectEnabledSectionsIds = (state) => {
81
81
  const { enabledSections, config } = state.curatorMenuPreferences;
82
82
 
@@ -1299,7 +1299,7 @@ const RenderDetails = memo(
1299
1299
  icon: BinIcon,
1300
1300
  title: isPreviewOrUpload ? 'Delete' : 'Archive',
1301
1301
  clickFunction: () => {
1302
- if (memberDetails.id !== currentUser.user.id && !isAdminOrOwner(currentUser)) {
1302
+ if (memberDetails.id !== currentUser?.user?.id && !isAdminOrOwner(currentUser)) {
1303
1303
  errorToast('You cannot delete other members file', {
1304
1304
  toastId: 'DELETE_FORBIDDEN',
1305
1305
  });