@importcsv/react 0.1.14 → 0.1.15
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.esm.js +32 -12
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -12
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -30197,9 +30197,13 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30197
30197
|
useConsolidated && initialStep === StepEnum.Validation ? 2 :
|
|
30198
30198
|
useConsolidated && initialStep === StepEnum.Complete ? 3 : 0;
|
|
30199
30199
|
var stepper = useStepper(translatedSteps, initialStepperIndex, skipHeader);
|
|
30200
|
-
// Don't use localStorage in demo mode
|
|
30201
|
-
var
|
|
30200
|
+
// Don't use localStorage in demo mode - use a dummy state instead
|
|
30201
|
+
var localStorageResult = isDemoMode ?
|
|
30202
|
+
[null, function () { }] :
|
|
30203
|
+
useMutableLocalStorage("tf_steps", "");
|
|
30204
|
+
var _b = localStorageResult, storageStep = _b[0], setStorageStep = _b[1];
|
|
30202
30205
|
var _c = useState$1(initialStep), currentStep = _c[0], setCurrentStep = _c[1];
|
|
30206
|
+
console.log('🔧 useStepNavigation - initialStep:', initialStep, 'isDemoMode:', isDemoMode, 'storageStep:', storageStep);
|
|
30203
30207
|
var goBack = function (backStep) {
|
|
30204
30208
|
var targetStep = backStep !== undefined ? backStep : Math.max(0, currentStep - 1);
|
|
30205
30209
|
setStep(targetStep);
|
|
@@ -30223,8 +30227,8 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30223
30227
|
stepper.setCurrent(stepperIndex);
|
|
30224
30228
|
};
|
|
30225
30229
|
useEffect$2(function () {
|
|
30226
|
-
// In demo mode, don't
|
|
30227
|
-
if (isDemoMode) {
|
|
30230
|
+
// In demo mode or when storageStep is null, don't update from localStorage
|
|
30231
|
+
if (isDemoMode || storageStep === null) {
|
|
30228
30232
|
return;
|
|
30229
30233
|
}
|
|
30230
30234
|
var step = storageStep || 0;
|
|
@@ -30239,7 +30243,7 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30239
30243
|
setCurrentStep(step);
|
|
30240
30244
|
}, [storageStep, isDemoMode]);
|
|
30241
30245
|
return {
|
|
30242
|
-
currentStep: isDemoMode ? currentStep : (storageStep
|
|
30246
|
+
currentStep: isDemoMode ? currentStep : (storageStep !== null && storageStep !== void 0 ? storageStep : currentStep),
|
|
30243
30247
|
setStep: setStep,
|
|
30244
30248
|
goBack: goBack,
|
|
30245
30249
|
goNext: goNext,
|
|
@@ -35786,6 +35790,8 @@ function Main(props) {
|
|
|
35786
35790
|
demoData = props.demoData;
|
|
35787
35791
|
var skipHeader = skipHeaderRowSelection !== null && skipHeaderRowSelection !== void 0 ? skipHeaderRowSelection : false;
|
|
35788
35792
|
var isDemoMode = !!demoData;
|
|
35793
|
+
console.log('🎯 Main Component - demoData:', demoData);
|
|
35794
|
+
console.log('🎯 Main Component - isDemoMode:', isDemoMode);
|
|
35789
35795
|
var t = useTranslation().t;
|
|
35790
35796
|
// Apply custom styles
|
|
35791
35797
|
useCustomStyles(parseObjectOrStringJSON("customStyles", customStyles));
|
|
@@ -35793,7 +35799,9 @@ function Main(props) {
|
|
|
35793
35799
|
var useConsolidatedFlow = true; // Using consolidated flow to combine header selection and mapping
|
|
35794
35800
|
// Start at MapColumns step if demo mode is active
|
|
35795
35801
|
var initialStep = isDemoMode ? StepEnum.MapColumns : StepEnum.Upload;
|
|
35802
|
+
console.log('🚀 Initial step calculation - isDemoMode:', isDemoMode, 'initialStep:', initialStep);
|
|
35796
35803
|
var _e = useStepNavigation(initialStep, skipHeader, useConsolidatedFlow, isDemoMode), currentStep = _e.currentStep, setStep = _e.setStep, goNext = _e.goNext, goBack = _e.goBack, stepper = _e.stepper;
|
|
35804
|
+
console.log('🚀 After useStepNavigation - currentStep:', currentStep);
|
|
35797
35805
|
// Error handling
|
|
35798
35806
|
var _f = useState$1(null), initializationError = _f[0], setInitializationError = _f[1];
|
|
35799
35807
|
var _g = useState$1(null), dataError = _g[0], setDataError = _g[1];
|
|
@@ -35820,27 +35828,36 @@ function Main(props) {
|
|
|
35820
35828
|
var _r = useState$1(false), disableOnInvalidRows = _r[0], setDisableOnInvalidRows = _r[1];
|
|
35821
35829
|
// Initialize demo data if provided
|
|
35822
35830
|
useEffect$2(function () {
|
|
35831
|
+
console.log('📊 Demo Data Effect - isDemoMode:', isDemoMode);
|
|
35832
|
+
console.log('📊 Demo Data Effect - demoData:', demoData);
|
|
35823
35833
|
if (isDemoMode && demoData) {
|
|
35834
|
+
console.log('📊 Starting to parse demo CSV content...');
|
|
35824
35835
|
// Parse the demo CSV content
|
|
35825
35836
|
papaparse_min.parse(demoData.csvContent, {
|
|
35826
35837
|
complete: function (results) {
|
|
35838
|
+
console.log('📊 Papa.parse complete - results:', results);
|
|
35827
35839
|
var csvData = results.data;
|
|
35828
35840
|
var isNotBlankRow = function (row) { return row.some(function (cell) { return cell.toString().trim() !== ""; }); };
|
|
35829
35841
|
var rows = csvData.filter(isNotBlankRow).map(function (row, index) { return ({ index: index, values: row }); });
|
|
35842
|
+
console.log('📊 Parsed rows:', rows);
|
|
35830
35843
|
setData({
|
|
35831
35844
|
fileName: demoData.fileName,
|
|
35832
35845
|
rows: rows,
|
|
35833
35846
|
sheetList: [],
|
|
35834
35847
|
errors: results.errors.map(function (error) { return error.message; }),
|
|
35835
35848
|
});
|
|
35836
|
-
//
|
|
35837
|
-
|
|
35838
|
-
setStep(StepEnum.MapColumns);
|
|
35839
|
-
}
|
|
35849
|
+
// No need to change step - we already start at MapColumns in demo mode
|
|
35850
|
+
console.log('📊 Data loaded, already at MapColumns step');
|
|
35840
35851
|
},
|
|
35852
|
+
error: function (error) {
|
|
35853
|
+
console.error('📊 Papa.parse error:', error);
|
|
35854
|
+
}
|
|
35841
35855
|
});
|
|
35842
35856
|
}
|
|
35843
|
-
|
|
35857
|
+
else {
|
|
35858
|
+
console.log('📊 Demo mode not active or no demo data provided');
|
|
35859
|
+
}
|
|
35860
|
+
}, [isDemoMode, demoData]); // Only parse when demo mode or data changes
|
|
35844
35861
|
// Fetch schema from the backend using importerKey
|
|
35845
35862
|
useEffect$2(function () {
|
|
35846
35863
|
var fetchSchema = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -35915,10 +35932,11 @@ function Main(props) {
|
|
|
35915
35932
|
useEffect$2(function () {
|
|
35916
35933
|
// TODO (client-sdk): Have the importer continue where left off if closed
|
|
35917
35934
|
// Temporary solution to reload state if closed and opened again
|
|
35918
|
-
|
|
35935
|
+
// Don't reload in demo mode - let the demo data load
|
|
35936
|
+
if (!isDemoMode && data.rows.length === 0 && currentStep !== StepEnum.Upload) {
|
|
35919
35937
|
reload();
|
|
35920
35938
|
}
|
|
35921
|
-
}, [data]);
|
|
35939
|
+
}, [data, isDemoMode]);
|
|
35922
35940
|
// Actions
|
|
35923
35941
|
var reload = function () {
|
|
35924
35942
|
setData(emptyData);
|
|
@@ -36062,6 +36080,7 @@ function Main(props) {
|
|
|
36062
36080
|
return (jsx("div", __assign$1({ className: style$5.wrapper }, { children: jsx(Errors, { error: initializationError, centered: true }) })));
|
|
36063
36081
|
}
|
|
36064
36082
|
var renderContent = function () {
|
|
36083
|
+
console.log('🎨 renderContent - currentStep:', currentStep, 'StepEnum:', StepEnum);
|
|
36065
36084
|
switch (currentStep) {
|
|
36066
36085
|
case StepEnum.Upload:
|
|
36067
36086
|
return (jsx(Uploader, { template: parsedTemplate, skipHeaderRowSelection: skipHeader || false, showDownloadTemplateButton: showDownloadTemplateButton, setDataError: setDataError, onSuccess: function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -37842,6 +37861,7 @@ var CSVImporter = forwardRef(function (importerProps, forwardRef) {
|
|
|
37842
37861
|
var _a = importerProps.isModal, isModal = _a === void 0 ? true : _a, _b = importerProps.modalIsOpen, modalIsOpen = _b === void 0 ? true : _b, _c = importerProps.modalOnCloseTriggered, modalOnCloseTriggered = _c === void 0 ? function () { return null; } : _c, modalCloseOnOutsideClick = importerProps.modalCloseOnOutsideClick, _d = importerProps.darkMode, darkMode = _d === void 0 ? false : _d, _e = importerProps.primaryColor, primaryColor = _e === void 0 ? "#2563eb" : _e, className = importerProps.className, onComplete = importerProps.onComplete, customStyles = importerProps.customStyles, showDownloadTemplateButton = importerProps.showDownloadTemplateButton, skipHeaderRowSelection = importerProps.skipHeaderRowSelection, language = importerProps.language, customTranslations = importerProps.customTranslations, importerKey = importerProps.importerKey, backendUrl = importerProps.backendUrl, user = importerProps.user, metadata = importerProps.metadata, demoData = importerProps.demoData,
|
|
37843
37862
|
// Any remaining props will be valid DOM props
|
|
37844
37863
|
domProps = __rest$1(importerProps, ["isModal", "modalIsOpen", "modalOnCloseTriggered", "modalCloseOnOutsideClick", "darkMode", "primaryColor", "className", "onComplete", "customStyles", "showDownloadTemplateButton", "skipHeaderRowSelection", "language", "customTranslations", "importerKey", "backendUrl", "user", "metadata", "demoData"]);
|
|
37864
|
+
console.log('🔍 CSVImporter - demoData received:', demoData);
|
|
37845
37865
|
var ref = forwardRef !== null && forwardRef !== void 0 ? forwardRef : useRef$1(null);
|
|
37846
37866
|
var current = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
37847
37867
|
useEffect$2(function () {
|