@importcsv/react 0.4.7 → 0.6.0

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.
@@ -100,13 +100,39 @@ export interface ThemeConfig {
100
100
  };
101
101
  }
102
102
 
103
+ /**
104
+ * Result structure returned by onComplete callback.
105
+ * Contains imported rows with their data and column metadata.
106
+ */
107
+ export interface ImportResult<T = Record<string, unknown>> {
108
+ rows: (T & {
109
+ /** Values from dynamicColumns, keyed by column id */
110
+ _custom_fields?: Record<string, unknown>;
111
+ /** Values from unmapped CSV columns (when includeUnmatchedColumns is true) */
112
+ _unmatched?: Record<string, unknown>;
113
+ })[];
114
+ columns: {
115
+ /** Columns from the columns prop */
116
+ predefined: Column[];
117
+ /** Columns from the dynamicColumns prop */
118
+ dynamic: Column[];
119
+ /** CSV column names that were not mapped to any column */
120
+ unmatched: string[];
121
+ };
122
+ }
123
+
103
124
  export interface CSVImporterProps {
104
125
  columns?: Column[];
126
+ /**
127
+ * Customer-specific dynamic columns passed at runtime.
128
+ * These appear after predefined columns in the mapping dropdown.
129
+ * Output is nested under _custom_fields in each row.
130
+ */
131
+ dynamicColumns?: Column[];
105
132
  importerKey?: string;
106
- onComplete?: (data: any) => void;
133
+ onComplete?: (data: ImportResult) => void;
107
134
  backendUrl?: string;
108
- user?: Record<string, any>;
109
- metadata?: Record<string, any>;
135
+ context?: Record<string, any>;
110
136
  theme?: ThemeConfig | 'default' | 'minimal' | 'modern' | 'compact' | 'dark';
111
137
  darkMode?: boolean;
112
138
  primaryColor?: string;