@package-uploader/ui 1.1.5 → 1.1.6

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.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Package Uploader</title>
8
- <script type="module" crossorigin src="/assets/index-BtMbH61W.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BS61yFPt.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DHoRoGws.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@package-uploader/ui",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "React UI for uploading and browsing courses on LMS platforms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -150,38 +150,32 @@ export default function UploadModal({
150
150
  setParsingStructure(true);
151
151
  setPreviewLoading(true);
152
152
 
153
- // Parse structure firstthis determines if we can proceed
154
- let structure = courseStructure;
155
- if (!structure) {
156
- try {
157
- structure = await api.parseCourseStructure(files[0].file);
158
- } catch {
159
- structure = null;
160
- }
161
- }
153
+ // Run parse + preview in parallel preview shows immediately with loading spinner
154
+ const previewOptions: { skin?: string; classMappings?: CourseClassMappings } = {};
155
+ if (skinName.trim()) previewOptions.skin = skinName.trim();
156
+ if (Object.keys(classMappings).length > 0) previewOptions.classMappings = classMappings;
157
+
158
+ const [structure, preview] = await Promise.all([
159
+ api.parseCourseStructure(files[0].file).catch(() => null),
160
+ api.startPreview(files[0].file, previewOptions).catch(() => null),
161
+ ]);
162
+
163
+ setParsingStructure(false);
162
164
 
163
165
  if (!structure) {
164
166
  setParseFailed(true);
165
- setParsingStructure(false);
166
167
  setPreviewLoading(false);
168
+ // Clean up preview if it succeeded but parse didn't
169
+ if (preview?.token) api.stopPreview(preview.token).catch(() => {});
167
170
  return;
168
171
  }
169
172
 
170
173
  setCourseStructure(structure);
171
174
  setParseFailed(false);
172
- setParsingStructure(false);
173
175
 
174
- // Start preview independently — patches with current skin + classMappings
175
- try {
176
- const previewOptions: { skin?: string; classMappings?: CourseClassMappings } = {};
177
- if (skinName.trim()) previewOptions.skin = skinName.trim();
178
- if (Object.keys(classMappings).length > 0) previewOptions.classMappings = classMappings;
179
- const preview = await api.startPreview(files[0].file, previewOptions);
176
+ if (preview) {
180
177
  setPreviewToken(preview.token);
181
178
  setPreviewUrl(preview.url);
182
- } catch (err) {
183
- console.warn('Preview not available:', err);
184
- // Preview failed but structure is valid — stay in non-preview mode
185
179
  }
186
180
 
187
181
  setPreviewLoading(false);
@@ -351,8 +345,8 @@ export default function UploadModal({
351
345
  : isPreviewMode
352
346
  ? 'Close Preview'
353
347
  : courseStructure
354
- ? `Customize Classes (${courseStructure.lessons.length} lessons)`
355
- : 'Customize Classes';
348
+ ? `Customize Course (${courseStructure.lessons.length} lessons)`
349
+ : 'Customize Course';
356
350
 
357
351
  // Build the preview URL — needs the API base path prepended
358
352
  const fullPreviewUrl = previewUrl