@importcsv/react 0.1.13 → 0.1.14
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/build/index.js
CHANGED
|
@@ -30213,13 +30213,19 @@ var getStepConfig = function (skipHeader, useConsolidated) {
|
|
|
30213
30213
|
{ label: "Validation", id: Steps.Validation },
|
|
30214
30214
|
];
|
|
30215
30215
|
};
|
|
30216
|
-
function useStepNavigation(initialStep, skipHeader, useConsolidated) {
|
|
30216
|
+
function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode) {
|
|
30217
30217
|
var _a;
|
|
30218
30218
|
if (useConsolidated === void 0) { useConsolidated = true; }
|
|
30219
|
+
if (isDemoMode === void 0) { isDemoMode = false; }
|
|
30219
30220
|
var t = useTranslation().t;
|
|
30220
30221
|
var translatedSteps = getStepConfig(skipHeader, useConsolidated).map(function (step) { return (__assign$1(__assign$1({}, step), { label: t(step.label) })); });
|
|
30221
|
-
|
|
30222
|
-
var
|
|
30222
|
+
// Map initial step to stepper index for consolidated flow
|
|
30223
|
+
var initialStepperIndex = useConsolidated && initialStep === StepEnum.MapColumns ? 1 :
|
|
30224
|
+
useConsolidated && initialStep === StepEnum.Validation ? 2 :
|
|
30225
|
+
useConsolidated && initialStep === StepEnum.Complete ? 3 : 0;
|
|
30226
|
+
var stepper = useStepper(translatedSteps, initialStepperIndex, skipHeader);
|
|
30227
|
+
// Don't use localStorage in demo mode
|
|
30228
|
+
var _b = useMutableLocalStorage("tf_steps", isDemoMode ? "" : ""), storageStep = _b[0], setStorageStep = _b[1];
|
|
30223
30229
|
var _c = React.useState(initialStep), currentStep = _c[0], setCurrentStep = _c[1];
|
|
30224
30230
|
var goBack = function (backStep) {
|
|
30225
30231
|
var targetStep = backStep !== undefined ? backStep : Math.max(0, currentStep - 1);
|
|
@@ -30244,6 +30250,10 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated) {
|
|
|
30244
30250
|
stepper.setCurrent(stepperIndex);
|
|
30245
30251
|
};
|
|
30246
30252
|
React.useEffect(function () {
|
|
30253
|
+
// In demo mode, don't use localStorage
|
|
30254
|
+
if (isDemoMode) {
|
|
30255
|
+
return;
|
|
30256
|
+
}
|
|
30247
30257
|
var step = storageStep || 0;
|
|
30248
30258
|
// Map the step to the correct stepper index for consolidated flow
|
|
30249
30259
|
var stepperIndex = useConsolidated ?
|
|
@@ -30254,9 +30264,9 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated) {
|
|
|
30254
30264
|
: step;
|
|
30255
30265
|
stepper.setCurrent(stepperIndex);
|
|
30256
30266
|
setCurrentStep(step);
|
|
30257
|
-
}, [storageStep]);
|
|
30267
|
+
}, [storageStep, isDemoMode]);
|
|
30258
30268
|
return {
|
|
30259
|
-
currentStep: storageStep || currentStep,
|
|
30269
|
+
currentStep: isDemoMode ? currentStep : (storageStep || currentStep),
|
|
30260
30270
|
setStep: setStep,
|
|
30261
30271
|
goBack: goBack,
|
|
30262
30272
|
goNext: goNext,
|
|
@@ -35810,7 +35820,7 @@ function Main(props) {
|
|
|
35810
35820
|
var useConsolidatedFlow = true; // Using consolidated flow to combine header selection and mapping
|
|
35811
35821
|
// Start at MapColumns step if demo mode is active
|
|
35812
35822
|
var initialStep = isDemoMode ? StepEnum.MapColumns : StepEnum.Upload;
|
|
35813
|
-
var _e = useStepNavigation(initialStep, skipHeader, useConsolidatedFlow), currentStep = _e.currentStep, setStep = _e.setStep, goNext = _e.goNext, goBack = _e.goBack, stepper = _e.stepper;
|
|
35823
|
+
var _e = useStepNavigation(initialStep, skipHeader, useConsolidatedFlow, isDemoMode), currentStep = _e.currentStep, setStep = _e.setStep, goNext = _e.goNext, goBack = _e.goBack, stepper = _e.stepper;
|
|
35814
35824
|
// Error handling
|
|
35815
35825
|
var _f = React.useState(null), initializationError = _f[0], setInitializationError = _f[1];
|
|
35816
35826
|
var _g = React.useState(null), dataError = _g[0], setDataError = _g[1];
|
|
@@ -35850,6 +35860,10 @@ function Main(props) {
|
|
|
35850
35860
|
sheetList: [],
|
|
35851
35861
|
errors: results.errors.map(function (error) { return error.message; }),
|
|
35852
35862
|
});
|
|
35863
|
+
// Ensure we're on the correct step after data is loaded
|
|
35864
|
+
if (currentStep === StepEnum.Upload) {
|
|
35865
|
+
setStep(StepEnum.MapColumns);
|
|
35866
|
+
}
|
|
35853
35867
|
},
|
|
35854
35868
|
});
|
|
35855
35869
|
}
|