(file: File)
| 101 | } |
| 102 | |
| 103 | public async uploadFile(file: File) { |
| 104 | const csvFile = await convertCsvFile( |
| 105 | file, |
| 106 | this.importerDefinition.customFileLoaders |
| 107 | ); |
| 108 | |
| 109 | const newParsed = await parseCsv({ file: csvFile }); |
| 110 | |
| 111 | const csvHeaders = newParsed.meta.fields!; |
| 112 | |
| 113 | const suggestedMappings = |
| 114 | this.importerDefinition.customSuggestedMapper != null |
| 115 | ? await this.importerDefinition.customSuggestedMapper( |
| 116 | this.importerDefinition.sheets, |
| 117 | csvHeaders |
| 118 | ) |
| 119 | : buildSuggestedHeaderMappings( |
| 120 | this.importerDefinition.sheets, |
| 121 | csvHeaders |
| 122 | ); |
| 123 | |
| 124 | this.buildSteps.push({ |
| 125 | type: 'FILE_PARSED', |
| 126 | payload: { parsed: newParsed, rowFile: file }, |
| 127 | }); |
| 128 | |
| 129 | this.buildSteps.push({ |
| 130 | type: 'COLUMN_MAPPING_CHANGED', |
| 131 | payload: { |
| 132 | mappings: suggestedMappings, |
| 133 | }, |
| 134 | }); |
| 135 | } |
| 136 | |
| 137 | public setEnterDataManually(amountOfEmptyRowsToAdd?: number) { |
| 138 | this.buildSteps.push({ |
no test coverage detected