@visns-studio/visns-components 5.14.1 → 5.14.3

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/package.json CHANGED
@@ -88,7 +88,7 @@
88
88
  "react-dom": "^17.0.0 || ^18.0.0"
89
89
  },
90
90
  "name": "@visns-studio/visns-components",
91
- "version": "5.14.1",
91
+ "version": "5.14.3",
92
92
  "description": "Various packages to assist in the development of our Custom Applications.",
93
93
  "main": "src/index.js",
94
94
  "files": [
@@ -122,15 +122,17 @@ const OcrTemplateEnhanced = ({
122
122
  });
123
123
  setCompletedSteps(newCompletedSteps);
124
124
 
125
- // Auto-advance to next step if current step is completed
126
- const currentStepData = journeySteps.find(s => s.id === currentStep);
127
- if (currentStepData?.isCompleted() && currentStep < journeySteps.length) {
128
- const nextIncompleteStep = journeySteps.find(s => s.id > currentStep && !newCompletedSteps.has(s.id));
129
- if (nextIncompleteStep) {
130
- setCurrentStep(nextIncompleteStep.id);
125
+ // Only auto-advance if we haven't manually navigated
126
+ if (!hasAutoJumped) {
127
+ const currentStepData = journeySteps.find(s => s.id === currentStep);
128
+ if (currentStepData?.isCompleted() && currentStep < journeySteps.length) {
129
+ const nextIncompleteStep = journeySteps.find(s => s.id > currentStep && !newCompletedSteps.has(s.id));
130
+ if (nextIncompleteStep) {
131
+ setCurrentStep(nextIncompleteStep.id);
132
+ }
131
133
  }
132
134
  }
133
- }, [ocrTemplateBuilder, data, currentStep]);
135
+ }, [ocrTemplateBuilder, data, currentStep, hasAutoJumped]);
134
136
 
135
137
  // Initial step detection - jump to latest completed step on load (only once)
136
138
  React.useEffect(() => {
@@ -168,8 +170,31 @@ const OcrTemplateEnhanced = ({
168
170
 
169
171
  // Manual navigation function to prevent auto-jump interference
170
172
  const navigateToStep = (stepId) => {
171
- setCurrentStep(stepId);
172
- setHasAutoJumped(true); // Prevent future auto-jumping after manual navigation
173
+ // Validate step ID
174
+ if (stepId < 1 || stepId > journeySteps.length) {
175
+ console.warn(`Invalid step ID: ${stepId}`);
176
+ return;
177
+ }
178
+
179
+ const targetStep = journeySteps.find(s => s.id === stepId);
180
+ if (!targetStep) {
181
+ console.warn(`Step not found: ${stepId}`);
182
+ return;
183
+ }
184
+
185
+ // Check if we can access this step
186
+ const stepIndex = journeySteps.findIndex(s => s.id === stepId);
187
+ const canAccess = stepIndex === 0 ||
188
+ completedSteps.has(stepId) ||
189
+ completedSteps.has(journeySteps[stepIndex - 1].id);
190
+
191
+ if (canAccess) {
192
+ console.log(`Navigating to step ${stepId}`);
193
+ setCurrentStep(stepId);
194
+ setHasAutoJumped(true); // Prevent future auto-jumping after manual navigation
195
+ } else {
196
+ console.warn(`Cannot access step ${stepId}. Step index: ${stepIndex}, Completed steps:`, Array.from(completedSteps));
197
+ }
173
198
  };
174
199
 
175
200
  // Enhanced smart categorization utility
@@ -615,11 +640,6 @@ const OcrTemplateEnhanced = ({
615
640
  title="OCR Analysis"
616
641
  description="Extracting text and detecting templates..."
617
642
  />
618
- <ProcessingStep
619
- status={processingStage.analysis}
620
- title="Template Detection"
621
- description="Checking for multiple templates to split..."
622
- />
623
643
  </div>
624
644
  </div>
625
645
  )}
@@ -1130,7 +1150,14 @@ const OcrTemplateEnhanced = ({
1130
1150
  <div
1131
1151
  key={step.id}
1132
1152
  className={`${styles.progressStep} ${isActive ? styles.active : ''} ${isCompleted ? styles.completed : ''} ${!canAccess ? styles.disabled : ''}`}
1133
- onClick={() => canAccess && navigateToStep(step.id)}
1153
+ onClick={() => {
1154
+ if (canAccess) {
1155
+ navigateToStep(step.id);
1156
+ } else {
1157
+ console.log(`Step ${step.id} not accessible. Completed steps:`, Array.from(completedSteps));
1158
+ }
1159
+ }}
1160
+ style={{ cursor: canAccess ? 'pointer' : 'not-allowed' }}
1134
1161
  >
1135
1162
  <div className={styles.stepIcon}>
1136
1163
  {isCompleted ? (
@@ -1299,7 +1326,7 @@ const OcrTemplateEnhanced = ({
1299
1326
  <div className={styles.journeyNavigation}>
1300
1327
  <button
1301
1328
  className={styles.navBtn}
1302
- onClick={() => navigateToStep(Math.max(1, currentStep - 1))}
1329
+ onClick={() => navigateToStep(currentStep - 1)}
1303
1330
  disabled={currentStep === 1}
1304
1331
  >
1305
1332
  <ArrowLeft size={16} />
@@ -1308,11 +1335,17 @@ const OcrTemplateEnhanced = ({
1308
1335
 
1309
1336
  <div className={styles.stepIndicator}>
1310
1337
  Step {currentStep} of {journeySteps.length}
1338
+ {completedSteps.has(currentStep) && (
1339
+ <span className={styles.completedBadge}>
1340
+ <CheckCircle2 size={14} />
1341
+ Completed
1342
+ </span>
1343
+ )}
1311
1344
  </div>
1312
1345
 
1313
1346
  <button
1314
1347
  className={styles.navBtn}
1315
- onClick={() => navigateToStep(Math.min(journeySteps.length, currentStep + 1))}
1348
+ onClick={() => navigateToStep(currentStep + 1)}
1316
1349
  disabled={currentStep === journeySteps.length}
1317
1350
  >
1318
1351
  Next Step