@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.js
CHANGED
|
@@ -30224,9 +30224,13 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30224
30224
|
useConsolidated && initialStep === StepEnum.Validation ? 2 :
|
|
30225
30225
|
useConsolidated && initialStep === StepEnum.Complete ? 3 : 0;
|
|
30226
30226
|
var stepper = useStepper(translatedSteps, initialStepperIndex, skipHeader);
|
|
30227
|
-
// Don't use localStorage in demo mode
|
|
30228
|
-
var
|
|
30227
|
+
// Don't use localStorage in demo mode - use a dummy state instead
|
|
30228
|
+
var localStorageResult = isDemoMode ?
|
|
30229
|
+
[null, function () { }] :
|
|
30230
|
+
useMutableLocalStorage("tf_steps", "");
|
|
30231
|
+
var _b = localStorageResult, storageStep = _b[0], setStorageStep = _b[1];
|
|
30229
30232
|
var _c = React.useState(initialStep), currentStep = _c[0], setCurrentStep = _c[1];
|
|
30233
|
+
console.log('🔧 useStepNavigation - initialStep:', initialStep, 'isDemoMode:', isDemoMode, 'storageStep:', storageStep);
|
|
30230
30234
|
var goBack = function (backStep) {
|
|
30231
30235
|
var targetStep = backStep !== undefined ? backStep : Math.max(0, currentStep - 1);
|
|
30232
30236
|
setStep(targetStep);
|
|
@@ -30250,8 +30254,8 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30250
30254
|
stepper.setCurrent(stepperIndex);
|
|
30251
30255
|
};
|
|
30252
30256
|
React.useEffect(function () {
|
|
30253
|
-
// In demo mode, don't
|
|
30254
|
-
if (isDemoMode) {
|
|
30257
|
+
// In demo mode or when storageStep is null, don't update from localStorage
|
|
30258
|
+
if (isDemoMode || storageStep === null) {
|
|
30255
30259
|
return;
|
|
30256
30260
|
}
|
|
30257
30261
|
var step = storageStep || 0;
|
|
@@ -30266,7 +30270,7 @@ function useStepNavigation(initialStep, skipHeader, useConsolidated, isDemoMode)
|
|
|
30266
30270
|
setCurrentStep(step);
|
|
30267
30271
|
}, [storageStep, isDemoMode]);
|
|
30268
30272
|
return {
|
|
30269
|
-
currentStep: isDemoMode ? currentStep : (storageStep
|
|
30273
|
+
currentStep: isDemoMode ? currentStep : (storageStep !== null && storageStep !== void 0 ? storageStep : currentStep),
|
|
30270
30274
|
setStep: setStep,
|
|
30271
30275
|
goBack: goBack,
|
|
30272
30276
|
goNext: goNext,
|
|
@@ -35813,6 +35817,8 @@ function Main(props) {
|
|
|
35813
35817
|
demoData = props.demoData;
|
|
35814
35818
|
var skipHeader = skipHeaderRowSelection !== null && skipHeaderRowSelection !== void 0 ? skipHeaderRowSelection : false;
|
|
35815
35819
|
var isDemoMode = !!demoData;
|
|
35820
|
+
console.log('🎯 Main Component - demoData:', demoData);
|
|
35821
|
+
console.log('🎯 Main Component - isDemoMode:', isDemoMode);
|
|
35816
35822
|
var t = useTranslation().t;
|
|
35817
35823
|
// Apply custom styles
|
|
35818
35824
|
useCustomStyles(parseObjectOrStringJSON("customStyles", customStyles));
|
|
@@ -35820,7 +35826,9 @@ function Main(props) {
|
|
|
35820
35826
|
var useConsolidatedFlow = true; // Using consolidated flow to combine header selection and mapping
|
|
35821
35827
|
// Start at MapColumns step if demo mode is active
|
|
35822
35828
|
var initialStep = isDemoMode ? StepEnum.MapColumns : StepEnum.Upload;
|
|
35829
|
+
console.log('🚀 Initial step calculation - isDemoMode:', isDemoMode, 'initialStep:', initialStep);
|
|
35823
35830
|
var _e = useStepNavigation(initialStep, skipHeader, useConsolidatedFlow, isDemoMode), currentStep = _e.currentStep, setStep = _e.setStep, goNext = _e.goNext, goBack = _e.goBack, stepper = _e.stepper;
|
|
35831
|
+
console.log('🚀 After useStepNavigation - currentStep:', currentStep);
|
|
35824
35832
|
// Error handling
|
|
35825
35833
|
var _f = React.useState(null), initializationError = _f[0], setInitializationError = _f[1];
|
|
35826
35834
|
var _g = React.useState(null), dataError = _g[0], setDataError = _g[1];
|
|
@@ -35847,27 +35855,36 @@ function Main(props) {
|
|
|
35847
35855
|
var _r = React.useState(false), disableOnInvalidRows = _r[0], setDisableOnInvalidRows = _r[1];
|
|
35848
35856
|
// Initialize demo data if provided
|
|
35849
35857
|
React.useEffect(function () {
|
|
35858
|
+
console.log('📊 Demo Data Effect - isDemoMode:', isDemoMode);
|
|
35859
|
+
console.log('📊 Demo Data Effect - demoData:', demoData);
|
|
35850
35860
|
if (isDemoMode && demoData) {
|
|
35861
|
+
console.log('📊 Starting to parse demo CSV content...');
|
|
35851
35862
|
// Parse the demo CSV content
|
|
35852
35863
|
papaparse_min.parse(demoData.csvContent, {
|
|
35853
35864
|
complete: function (results) {
|
|
35865
|
+
console.log('📊 Papa.parse complete - results:', results);
|
|
35854
35866
|
var csvData = results.data;
|
|
35855
35867
|
var isNotBlankRow = function (row) { return row.some(function (cell) { return cell.toString().trim() !== ""; }); };
|
|
35856
35868
|
var rows = csvData.filter(isNotBlankRow).map(function (row, index) { return ({ index: index, values: row }); });
|
|
35869
|
+
console.log('📊 Parsed rows:', rows);
|
|
35857
35870
|
setData({
|
|
35858
35871
|
fileName: demoData.fileName,
|
|
35859
35872
|
rows: rows,
|
|
35860
35873
|
sheetList: [],
|
|
35861
35874
|
errors: results.errors.map(function (error) { return error.message; }),
|
|
35862
35875
|
});
|
|
35863
|
-
//
|
|
35864
|
-
|
|
35865
|
-
setStep(StepEnum.MapColumns);
|
|
35866
|
-
}
|
|
35876
|
+
// No need to change step - we already start at MapColumns in demo mode
|
|
35877
|
+
console.log('📊 Data loaded, already at MapColumns step');
|
|
35867
35878
|
},
|
|
35879
|
+
error: function (error) {
|
|
35880
|
+
console.error('📊 Papa.parse error:', error);
|
|
35881
|
+
}
|
|
35868
35882
|
});
|
|
35869
35883
|
}
|
|
35870
|
-
|
|
35884
|
+
else {
|
|
35885
|
+
console.log('📊 Demo mode not active or no demo data provided');
|
|
35886
|
+
}
|
|
35887
|
+
}, [isDemoMode, demoData]); // Only parse when demo mode or data changes
|
|
35871
35888
|
// Fetch schema from the backend using importerKey
|
|
35872
35889
|
React.useEffect(function () {
|
|
35873
35890
|
var fetchSchema = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -35942,10 +35959,11 @@ function Main(props) {
|
|
|
35942
35959
|
React.useEffect(function () {
|
|
35943
35960
|
// TODO (client-sdk): Have the importer continue where left off if closed
|
|
35944
35961
|
// Temporary solution to reload state if closed and opened again
|
|
35945
|
-
|
|
35962
|
+
// Don't reload in demo mode - let the demo data load
|
|
35963
|
+
if (!isDemoMode && data.rows.length === 0 && currentStep !== StepEnum.Upload) {
|
|
35946
35964
|
reload();
|
|
35947
35965
|
}
|
|
35948
|
-
}, [data]);
|
|
35966
|
+
}, [data, isDemoMode]);
|
|
35949
35967
|
// Actions
|
|
35950
35968
|
var reload = function () {
|
|
35951
35969
|
setData(emptyData);
|
|
@@ -36089,6 +36107,7 @@ function Main(props) {
|
|
|
36089
36107
|
return (jsxRuntime.jsx("div", __assign$1({ className: style$5.wrapper }, { children: jsxRuntime.jsx(Errors, { error: initializationError, centered: true }) })));
|
|
36090
36108
|
}
|
|
36091
36109
|
var renderContent = function () {
|
|
36110
|
+
console.log('🎨 renderContent - currentStep:', currentStep, 'StepEnum:', StepEnum);
|
|
36092
36111
|
switch (currentStep) {
|
|
36093
36112
|
case StepEnum.Upload:
|
|
36094
36113
|
return (jsxRuntime.jsx(Uploader, { template: parsedTemplate, skipHeaderRowSelection: skipHeader || false, showDownloadTemplateButton: showDownloadTemplateButton, setDataError: setDataError, onSuccess: function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -37869,6 +37888,7 @@ var CSVImporter = React.forwardRef(function (importerProps, forwardRef) {
|
|
|
37869
37888
|
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,
|
|
37870
37889
|
// Any remaining props will be valid DOM props
|
|
37871
37890
|
domProps = __rest$1(importerProps, ["isModal", "modalIsOpen", "modalOnCloseTriggered", "modalCloseOnOutsideClick", "darkMode", "primaryColor", "className", "onComplete", "customStyles", "showDownloadTemplateButton", "skipHeaderRowSelection", "language", "customTranslations", "importerKey", "backendUrl", "user", "metadata", "demoData"]);
|
|
37891
|
+
console.log('🔍 CSVImporter - demoData received:', demoData);
|
|
37872
37892
|
var ref = forwardRef !== null && forwardRef !== void 0 ? forwardRef : React.useRef(null);
|
|
37873
37893
|
var current = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
37874
37894
|
React.useEffect(function () {
|