fuse-importer 0.13.0 → 0.16.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.
Files changed (51) hide show
  1. package/lib/esm/Importer/ImporterContextProvider.d.ts +7 -6
  2. package/lib/esm/Importer/ImporterContextProvider.js +19 -17
  3. package/lib/esm/Importer/{LoadFonts.d.ts → ImporterFonts.d.ts} +0 -0
  4. package/lib/esm/Importer/{LoadFonts.js → ImporterFonts.js} +0 -0
  5. package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +20 -4
  6. package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/tableColumns.js +6 -5
  7. package/lib/esm/Importer/Matcher/HeaderMatcher/index.js +19 -4
  8. package/lib/esm/Importer/Matcher/HeaderMatcher/tableColumns.d.ts +0 -5
  9. package/lib/esm/Importer/Matcher/HeaderMatcher/tableColumns.js +7 -14
  10. package/lib/esm/Importer/Matcher/common/index.d.ts +4 -2
  11. package/lib/esm/Importer/Matcher/common/index.js +32 -2
  12. package/lib/esm/Importer/Review/AppResponseModal.js +1 -1
  13. package/lib/esm/Importer/Review/index.js +32 -22
  14. package/lib/esm/Importer/SpreadsheetReviewContextProvider.js +2 -2
  15. package/lib/esm/Importer/Stepper.js +7 -6
  16. package/lib/esm/Importer/TrialModeBanner.js +1 -1
  17. package/lib/esm/Importer/Uploader/HeadersPreview.js +2 -2
  18. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +4 -4
  19. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +21 -24
  20. package/lib/esm/Importer/common/Spreadsheet/common/fields/SpeadsheetAutocomplete.js +5 -4
  21. package/lib/esm/Importer/common/Spreadsheet/common/fields/SpreadsheetInput.d.ts +12 -0
  22. package/lib/esm/Importer/common/Spreadsheet/common/fields/{SpreadsheetTextInput.js → SpreadsheetInput.js} +15 -4
  23. package/lib/esm/Importer/common/Spreadsheet/common/index.js +17 -14
  24. package/lib/esm/Importer/common/Spreadsheet/index.d.ts +3 -3
  25. package/lib/esm/Importer/common/Spreadsheet/index.js +39 -30
  26. package/lib/esm/Importer/common/index.d.ts +8 -0
  27. package/lib/esm/Importer/common/index.js +6 -0
  28. package/lib/esm/Importer/common/utils.d.ts +3 -2
  29. package/lib/esm/Importer/common/utils.js +21 -4
  30. package/lib/esm/Importer/index.d.ts +4 -5
  31. package/lib/esm/Importer/index.js +7 -7
  32. package/lib/esm/common/Table/TableView/TableHeaders.d.ts +2 -1
  33. package/lib/esm/common/Table/TableView/TableHeaders.js +4 -4
  34. package/lib/esm/common/Table/TableView/common.d.ts +1 -1
  35. package/lib/esm/common/Table/TableView/common.js +1 -1
  36. package/lib/esm/common/Table/TableView/index.d.ts +2 -1
  37. package/lib/esm/common/Table/TableView/index.js +3 -7
  38. package/lib/esm/common/TooltipProvider.js +8 -0
  39. package/lib/esm/common/index.d.ts +0 -1
  40. package/lib/esm/common/index.js +7 -9
  41. package/lib/esm/common/inputs/Autocomplete.d.ts +3 -2
  42. package/lib/esm/common/inputs/Autocomplete.js +19 -10
  43. package/lib/esm/common/inputs/TextInput.d.ts +1 -0
  44. package/lib/esm/common/inputs/TextInput.js +2 -2
  45. package/lib/esm/index.d.ts +4 -3
  46. package/lib/esm/index.js +17 -9
  47. package/lib/esm/styled/utils.d.ts +2 -0
  48. package/lib/esm/types.d.ts +16 -4
  49. package/lib/main.js +1 -1
  50. package/package.json +3 -3
  51. package/lib/esm/Importer/common/Spreadsheet/common/fields/SpreadsheetTextInput.d.ts +0 -13
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { AppResponse } from "../../..";
2
+ import { AppResponse, SpreadsheetOptions } from "../../..";
3
3
  import { BatchValidationErrors, Field, OnValidateBatch, OnValidateRecord, Record } from "../../../types";
4
- export declare const getBatchErrors: (records: any, onValidateRecord: any) => Promise<any>;
4
+ export declare const getBatchErrors: (records: Record[], onValidateRecord: OnValidateRecord) => Promise<BatchValidationErrors>;
5
5
  declare type State = {
6
6
  rowWidth?: number;
7
7
  data: Record[];
@@ -33,13 +33,13 @@ declare type Props = {
33
33
  appResponse?: AppResponse;
34
34
  onValidateRecord: OnValidateRecord;
35
35
  onValidateBatch?: OnValidateBatch;
36
- validationBatchSize?: number;
37
36
  children: JSX.Element;
38
37
  fields: Field[];
38
+ options: SpreadsheetOptions;
39
39
  highlightFirstRow: boolean;
40
40
  submittedData?: Record[];
41
41
  setReviewedData?: React.Dispatch<React.SetStateAction<Record[]>>;
42
42
  };
43
- export declare const SpreadsheetContextProvider: ({ initialData, rowWidth, onValidateRecord, onValidateBatch, appResponse, fields, isReadOnly, validationBatchSize, highlightFirstRow, submittedData, setReviewedData, children, }: Props) => JSX.Element;
43
+ export declare const SpreadsheetContextProvider: ({ initialData, rowWidth, onValidateRecord, onValidateBatch, appResponse, fields, options, isReadOnly, highlightFirstRow, submittedData, setReviewedData, children, }: Props) => JSX.Element;
44
44
  export declare const useSpreadsheetContext: () => State;
45
45
  export {};
@@ -56,45 +56,38 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
56
56
  };
57
57
  import { jsx as _jsx } from "react/jsx-runtime";
58
58
  import { createContext, useContext, useEffect, useState } from "react";
59
+ import { formatBatchErrors } from "../../..";
59
60
  import { getRecordErrors, getRenderedRecordWithErrors, recordIsEmpty, } from "./common";
60
61
  var MINIMUM_ROW_COUNT = 20;
61
- // time in ms
62
- var batchValidationIdleTime = 500;
63
62
  var getRowId = function (id) { return "r".concat(id); };
64
63
  export var getBatchErrors = function (records, onValidateRecord) { return __awaiter(void 0, void 0, void 0, function () {
65
- var getRecordError, errors;
64
+ var batchErrors;
66
65
  return __generator(this, function (_a) {
67
66
  switch (_a.label) {
68
- case 0:
69
- getRecordError = function (record) { return __awaiter(void 0, void 0, void 0, function () {
67
+ case 0: return [4 /*yield*/, Promise.all(records.map(function (record) { return __awaiter(void 0, void 0, void 0, function () {
70
68
  var _a;
71
69
  return __generator(this, function (_b) {
72
70
  switch (_b.label) {
73
71
  case 0:
74
72
  _a = {
75
- id: record._meta.id
73
+ rowId: record._meta.id
76
74
  };
77
75
  return [4 /*yield*/, onValidateRecord(record)];
78
- case 1: return [2 /*return*/, (_a.error = _b.sent(),
76
+ case 1: return [2 /*return*/, (_a.errors = _b.sent(),
79
77
  _a)];
80
78
  }
81
79
  });
82
- }); };
83
- return [4 /*yield*/, Promise.all(records.map(function (r) { return getRecordError(r); }))];
80
+ }); }))];
84
81
  case 1:
85
- errors = _a.sent();
86
- return [2 /*return*/, errors.reduce(function (prevState, curr) {
87
- var newState = __assign({}, prevState);
88
- newState[curr.id] = curr.error;
89
- return newState;
90
- }, {})];
82
+ batchErrors = _a.sent();
83
+ return [2 /*return*/, formatBatchErrors(batchErrors)];
91
84
  }
92
85
  });
93
86
  }); };
94
87
  var SpreadsheetContext = createContext({});
95
88
  var sleep = function (n) { return new Promise(function (resolve) { return setTimeout(resolve, n); }); };
96
89
  export var SpreadsheetContextProvider = function (_a) {
97
- var initialData = _a.initialData, _b = _a.rowWidth, rowWidth = _b === void 0 ? 1 : _b, _c = _a.onValidateRecord, onValidateRecord = _c === void 0 ? null : _c, _d = _a.onValidateBatch, onValidateBatch = _d === void 0 ? null : _d, appResponse = _a.appResponse, fields = _a.fields, isReadOnly = _a.isReadOnly, validationBatchSize = _a.validationBatchSize, highlightFirstRow = _a.highlightFirstRow, submittedData = _a.submittedData, setReviewedData = _a.setReviewedData, children = _a.children;
90
+ var initialData = _a.initialData, _b = _a.rowWidth, rowWidth = _b === void 0 ? 1 : _b, _c = _a.onValidateRecord, onValidateRecord = _c === void 0 ? null : _c, _d = _a.onValidateBatch, onValidateBatch = _d === void 0 ? null : _d, appResponse = _a.appResponse, fields = _a.fields, options = _a.options, isReadOnly = _a.isReadOnly, highlightFirstRow = _a.highlightFirstRow, submittedData = _a.submittedData, setReviewedData = _a.setReviewedData, children = _a.children;
98
91
  var _e = useState(initialData.map(function (d, i) { return (__assign(__assign({}, d), { _meta: { id: getRowId(i), rowIndex: i } })); })), data = _e[0], setData = _e[1];
99
92
  var _f = useState(false), isLoading = _f[0], setIsLoading = _f[1];
100
93
  var _g = useState(null), sortByFieldErrors = _g[0], setSortByFieldErrors = _g[1];
@@ -109,8 +102,9 @@ export var SpreadsheetContextProvider = function (_a) {
109
102
  }), columnErrorCounts = _l.columnErrorCounts, totalErrors = _l.totalErrors, isValidationComplete = _l.isValidationComplete;
110
103
  useEffect(function () {
111
104
  var init = function () { return __awaiter(void 0, void 0, void 0, function () {
112
- var addEmtpyRows, validateInBatches;
105
+ var batchValidationDelayMs, batchValidationSize, addEmtpyRows, validateInBatches;
113
106
  return __generator(this, function (_a) {
107
+ batchValidationDelayMs = options.batchValidationDelayMs, batchValidationSize = options.batchValidationSize;
114
108
  addEmtpyRows = function () {
115
109
  var newData = __spreadArray([], data, true);
116
110
  var emptyRecord = fields.reduce(function (obj, f) {
@@ -128,16 +122,18 @@ export var SpreadsheetContextProvider = function (_a) {
128
122
  if (data.length < MINIMUM_ROW_COUNT)
129
123
  addEmtpyRows();
130
124
  validateInBatches = function () { return __awaiter(void 0, void 0, void 0, function () {
131
- var validationErrors, batchSize, idx, batch, errors;
125
+ var validationErrors, batchSize, batchCount, batchIdx, idx, batch, errors, validationPercentage;
132
126
  return __generator(this, function (_a) {
133
127
  switch (_a.label) {
134
128
  case 0:
135
129
  validationErrors = {};
136
- batchSize = Math.min(validationBatchSize, data.length) || data.length;
137
- idx = 0;
130
+ batchSize = Math.min(Math.floor(batchValidationSize), data.length) || data.length;
131
+ batchCount = Math.ceil(data.length / batchSize);
132
+ batchIdx = 0;
138
133
  _a.label = 1;
139
134
  case 1:
140
- if (!(idx < data.length)) return [3 /*break*/, 5];
135
+ if (!(batchIdx < batchCount)) return [3 /*break*/, 5];
136
+ idx = batchIdx * batchSize;
141
137
  batch = data.slice(idx, idx + batchSize);
142
138
  return [4 /*yield*/, (onValidateBatch
143
139
  ? onValidateBatch(batch)
@@ -146,15 +142,16 @@ export var SpreadsheetContextProvider = function (_a) {
146
142
  errors = _a.sent();
147
143
  validationErrors = __assign(__assign({}, validationErrors), errors);
148
144
  // unblocks main thread for rendering ui
149
- return [4 /*yield*/, sleep(batchValidationIdleTime)];
145
+ return [4 /*yield*/, sleep(batchValidationDelayMs)];
150
146
  case 3:
151
147
  // unblocks main thread for rendering ui
152
148
  _a.sent();
153
- setBatchValidationPercentage(Math.floor(((idx + batchSize) / data.length) * 100));
149
+ validationPercentage = (Math.min(idx + batchSize, data.length) / data.length) * 100;
150
+ setBatchValidationPercentage(Math.floor(validationPercentage));
154
151
  setBatchValidationErrors(validationErrors);
155
152
  _a.label = 4;
156
153
  case 4:
157
- idx += batchSize;
154
+ batchIdx++;
158
155
  return [3 /*break*/, 1];
159
156
  case 5: return [2 /*return*/];
160
157
  }
@@ -19,18 +19,19 @@ import { SpreadsheetField, useSpreadsheetField, useValidationError } from ".";
19
19
  import { spreadsheetRowHeightPx } from "..";
20
20
  import { Autocomplete as AutocompleteBase } from "../../../../../common/inputs/Autocomplete";
21
21
  import { SelectMenuDiv, SelectMenuScrollArea, } from "../../../../../common/inputs/SelectMenu";
22
- import { HTMLInput } from "../../../../../common/inputs/TextInput";
22
+ import { HTMLInput, TextInputIcon, } from "../../../../../common/inputs/TextInput";
23
23
  import { useSpreadsheetContext } from "../../SpreadsheetContextProvider";
24
- var Autocomplete = styled(AutocompleteBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", " {\n border: none;\n border-radius: 0;\n margin: 0;\n background: transparent;\n height: ", "px;\n padding: 0 12px;\n\n ", "\n\n ::placeholder {\n ", "\n }\n :focus {\n border: none;\n box-shadow: none;\n }\n }\n ", " {\n border-radius: 7px;\n }\n ", " {\n padding: 4px;\n }\n"], ["\n ", " {\n border: none;\n border-radius: 0;\n margin: 0;\n background: transparent;\n height: ", "px;\n padding: 0 12px;\n\n ", "\n\n ::placeholder {\n ", "\n }\n :focus {\n border: none;\n box-shadow: none;\n }\n }\n ", " {\n border-radius: 7px;\n }\n ", " {\n padding: 4px;\n }\n"])), HTMLInput, spreadsheetRowHeightPx - 5, function (p) {
24
+ var Autocomplete = styled(AutocompleteBase)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", " {\n border: none;\n border-radius: 0;\n margin: 0;\n background: transparent;\n height: ", "px;\n padding: 0 12px;\n\n ", "\n\n ::placeholder {\n ", "\n }\n :focus {\n border: none;\n box-shadow: none;\n }\n }\n ", " {\n right: 6px;\n }\n ", " {\n border-radius: 7px;\n }\n ", " {\n padding: 4px;\n }\n"], ["\n ", " {\n border: none;\n border-radius: 0;\n margin: 0;\n background: transparent;\n height: ", "px;\n padding: 0 12px;\n\n ", "\n\n ::placeholder {\n ", "\n }\n :focus {\n border: none;\n box-shadow: none;\n }\n }\n ", " {\n right: 6px;\n }\n ", " {\n border-radius: 7px;\n }\n ", " {\n padding: 4px;\n }\n"])), HTMLInput, spreadsheetRowHeightPx - 5, function (p) {
25
25
  return p.hasError && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (p) { return p.theme.colors.error; });
26
26
  }, function (p) {
27
27
  return p.hasError && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (p) { return p.theme.colors.error; });
28
- }, SelectMenuDiv, SelectMenuScrollArea);
28
+ }, TextInputIcon, SelectMenuDiv, SelectMenuScrollArea);
29
29
  export var SpreadsheetAutocomplete = function (_a) {
30
30
  var name = _a.name, record = _a.record, options = _a.options, _b = _a.isInputDisabled, isInputDisabled = _b === void 0 ? false : _b;
31
31
  var validationError = useValidationError(name, record).validationError;
32
32
  var _c = useSpreadsheetField(name, record), value = _c.value, setValue = _c.setValue;
33
33
  var setIsScrollingEnabled = useSpreadsheetContext().setIsScrollingEnabled;
34
- return (_jsx(SpreadsheetField, __assign({}, { name: name, record: record }, { children: _jsx(Autocomplete, { placement: "bottom", isInputDisabled: isInputDisabled, hasError: !!validationError, onToggle: function (isOpen) { return setIsScrollingEnabled(!isOpen); }, options: options, value: value, onChange: function (v) { return setValue(v); } }, void 0) }), void 0));
34
+ return (_jsx(SpreadsheetField, __assign({}, { name: name, record: record }, { children: _jsx(Autocomplete, { placement: "bottom", isInputDisabled: isInputDisabled, hasError: !!validationError, onToggle: function (isOpen) { return setIsScrollingEnabled(!isOpen); }, options: options, value: value, icon: chevronDownIcon, onChange: function (v) { return setValue(v); } }, void 0) }), void 0));
35
35
  };
36
+ var chevronDownIcon = (_jsx("svg", __assign({ width: "10", height: "6", viewBox: "0 0 10 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M8.46289 1L4.98131 4.48159L1.49972 1", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, void 0) }), void 0));
36
37
  var templateObject_1, templateObject_2, templateObject_3;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { HTMLInputCSSProps } from "../../../../../styled/utils";
3
+ import { Record } from "../../../../../types";
4
+ declare type SpreadsheetTextInputArgs = {
5
+ name: string;
6
+ record: Record;
7
+ } & HTMLInputCSSProps;
8
+ export declare const SpreadsheetInput: ({ name, record, ...props }: SpreadsheetTextInputArgs) => JSX.Element;
9
+ export declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
10
+ hasError: boolean;
11
+ } & import("../../../../../styled/utils").HTMLInputProps & import("../../../../../styled/utils").CSSProps, never>;
12
+ export {};
@@ -13,17 +13,28 @@ var __assign = (this && this.__assign) || function () {
13
13
  };
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
+ var __rest = (this && this.__rest) || function (s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ };
16
27
  import { jsx as _jsx } from "react/jsx-runtime";
17
28
  import styled, { css } from "styled-components";
18
29
  import { SpreadsheetField, useSpreadsheetField, useValidationError } from ".";
19
- export var SpreadsheetTextInput = function (_a) {
20
- var name = _a.name, record = _a.record, type = _a.type;
30
+ export var SpreadsheetInput = function (_a) {
31
+ var name = _a.name, record = _a.record, props = __rest(_a, ["name", "record"]);
21
32
  var validationError = useValidationError(name, record).validationError;
22
33
  var _b = useSpreadsheetField(name, record), value = _b.value, setValue = _b.setValue;
23
- return (_jsx(SpreadsheetField, __assign({}, { name: name, record: record }, { children: _jsx(Input, { type: type, hasError: !!validationError, value: value || "", onChange: function (_a) {
34
+ return (_jsx(SpreadsheetField, __assign({}, { name: name, record: record }, { children: _jsx(Input, __assign({ hasError: !!validationError, value: value || "", onChange: function (_a) {
24
35
  var value = _a.target.value;
25
36
  return setValue(value);
26
- } }, void 0) }), void 0));
37
+ } }, props), void 0) }), void 0));
27
38
  };
28
39
  export var Input = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n outline: none;\n border: none;\n width: 100%;\n height: calc(100% - 2px);\n background: transparent;\n box-sizing: border-box;\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n /* Firefox */\n -moz-appearance: textfield;\n\n padding: 0 12px;\n ", ";\n color: ", ";\n ::placeholder {\n color: ", ";\n }\n\n ", "\n"], ["\n outline: none;\n border: none;\n width: 100%;\n height: calc(100% - 2px);\n background: transparent;\n box-sizing: border-box;\n\n ::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n /* Firefox */\n -moz-appearance: textfield;\n\n padding: 0 12px;\n ", ";\n color: ", ";\n ::placeholder {\n color: ", ";\n }\n\n ", "\n"])), function (props) { return props.theme.css.body1; }, function (props) { return props.theme.colors.gray1000; }, function (props) { return props.theme.colors.placeholder; }, function (p) {
29
40
  return p.hasError && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), function (p) { return p.theme.colors.error; });
@@ -12,8 +12,14 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { FieldTypes, } from "../../../../types";
13
13
  export var spreadsheetRowHeightPx = 40;
14
14
  export var spreadsheetHeaderHeightPx = 40;
15
+ var isEmpty = function (value) {
16
+ return (value === undefined ||
17
+ value === null ||
18
+ (typeof value === "object" && Object.keys(value).length === 0) ||
19
+ (typeof value === "string" && value.trim().length === 0));
20
+ };
15
21
  export var recordIsEmpty = function (record, fields) {
16
- return fields.reduce(function (isEmptyRecord, f) { return isEmptyRecord && !record[f.name]; }, true);
22
+ return fields.reduce(function (isEmptyRecord, f) { return isEmptyRecord && isEmpty(record[f.name]); }, true);
17
23
  };
18
24
  export var getRenderedRecordWithErrors = function (_a) {
19
25
  var record = _a.record, validationErrors = _a.validationErrors;
@@ -23,23 +29,20 @@ export var getRecordErrors = function (_a) {
23
29
  var record = _a.record, fields = _a.fields, batchValidationErrors = _a.batchValidationErrors, submittedData = _a.submittedData;
24
30
  var submittedRecord = submittedData === null || submittedData === void 0 ? void 0 : submittedData.find(function (r) { return r._meta.id === record._meta.id; });
25
31
  var isEmail = function (value) {
26
- var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
27
- return Boolean(value.match(emailRegex));
28
- };
29
- var isEmptyString = function (string) {
30
- return string.replace(/\s/g, "") === "";
32
+ var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
33
+ return emailRegex.test(value);
31
34
  };
32
35
  var recordHasData = !recordIsEmpty(record, fields);
33
36
  if (recordHasData) {
34
- var recordIsRequiredErrors = fields.reduce(function (errors, field) {
37
+ var recordTemplateValidationErrors = fields.reduce(function (errors, field) {
35
38
  var newErrors = __assign({}, errors);
36
39
  var fieldValue = record[field.name];
37
- if (field.isRequired && !fieldValue)
38
- newErrors[field.name] = "".concat(field.label, " is required");
39
- if (FieldTypes.email === field.type &&
40
- !isEmptyString(fieldValue) &&
41
- !isEmail(fieldValue)) {
42
- newErrors[field.name] = "Must be an email";
40
+ if (isEmpty(fieldValue)) {
41
+ if (field.isRequired)
42
+ newErrors[field.name] = "".concat(field.label, " is required");
43
+ }
44
+ else if (field.type === FieldTypes.email && !isEmail(fieldValue)) {
45
+ newErrors[field.name] = "".concat(field.label, " is not a valid email");
43
46
  }
44
47
  return newErrors;
45
48
  }, {});
@@ -61,7 +64,7 @@ export var getRecordErrors = function (_a) {
61
64
  return newErrors;
62
65
  }, {});
63
66
  }
64
- var recordErrors = __assign(__assign(__assign({}, recordValidationErrors), recordIsRequiredErrors), appValidationErrors);
67
+ var recordErrors = __assign(__assign(__assign({}, recordValidationErrors), recordTemplateValidationErrors), appValidationErrors);
65
68
  return recordErrors;
66
69
  }
67
70
  return {};
@@ -1,18 +1,18 @@
1
1
  import React from "react";
2
2
  import { AppResponse } from "../../..";
3
- import { Field, OnValidateBatch, OnValidateRecord, Record } from "../../../types";
3
+ import { Field, OnValidateBatch, OnValidateRecord, Record, SpreadsheetOptions } from "../../../types";
4
4
  export declare type SpreadsheetProps = {
5
5
  initialData: any[];
6
6
  rowWidth?: number;
7
7
  appResponse?: AppResponse;
8
8
  isReadOnly?: boolean;
9
- validationBatchSize?: number;
10
9
  onValidateRecord?: OnValidateRecord;
11
10
  onValidateBatch?: OnValidateBatch;
12
11
  fields?: Field[];
13
12
  submittedData?: Record[];
14
13
  highlightFirstRow?: boolean;
14
+ options?: SpreadsheetOptions;
15
15
  setReviewedData?: React.Dispatch<React.SetStateAction<Record[]>>;
16
16
  };
17
- declare const Spreadsheet: ({ isReadOnly, initialData, rowWidth, fields, appResponse, validationBatchSize, onValidateRecord, submittedData, setReviewedData, onValidateBatch, highlightFirstRow, }: SpreadsheetProps) => JSX.Element;
17
+ declare const Spreadsheet: ({ isReadOnly, initialData, rowWidth, fields, appResponse, options, onValidateRecord, submittedData, setReviewedData, onValidateBatch, highlightFirstRow, }: SpreadsheetProps) => JSX.Element;
18
18
  export { Spreadsheet };
@@ -52,27 +52,28 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
52
52
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
53
53
  import { useEffect, useMemo, useRef, useState } from "react";
54
54
  import styled, { css } from "styled-components";
55
- import { TableView as TableViewBase, TableViewCellContainer, TableViewHeader, TableViewRow, } from "../../../common/Table/TableView";
55
+ import { getTableHeight } from "..";
56
+ import { TooltipProvider } from "../../../common";
57
+ import { TableView as TableViewBase, TableViewCellContainer, TableViewRow, } from "../../../common/Table/TableView";
56
58
  import { colors } from "../../../styled/theme/colorPalette";
57
59
  import { Div } from "../../../styled/utils";
58
60
  import { FieldTypes, } from "../../../types";
59
- import GlobalStyle from "./GlobalStyle";
60
61
  import { useSpreadsheetReviewContext } from "../../SpreadsheetReviewContextProvider";
61
62
  import { getUnsubmittedData } from "../utils";
62
63
  import { spreadsheetHeaderHeightPx, spreadsheetRowHeightPx } from "./common";
63
64
  import { SpreadsheetAutocomplete } from "./common/fields/SpeadsheetAutocomplete";
64
- import { SpreadsheetTextInput } from "./common/fields/SpreadsheetTextInput";
65
+ import { SpreadsheetInput } from "./common/fields/SpreadsheetInput";
66
+ import GlobalStyle from "./GlobalStyle";
65
67
  import { SpreadsheetContextProvider, useSpreadsheetContext, } from "./SpreadsheetContextProvider";
66
68
  import { SpreadsheetRowNumbers } from "./SpreadsheetRowNumbers";
67
- var SPREADSHEET_HEIGHT = 540;
68
69
  var SpreadSheetWrapper = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: solid 1px ", ";\n border-radius: 8px;\n background: ", ";\n overflow: hidden !important;\n"], ["\n border: solid 1px ", ";\n border-radius: 8px;\n background: ", ";\n overflow: hidden !important;\n"])), function (p) { return p.theme.colors.gray300; }, function (p) { return p.theme.colors.white; });
69
- var TableView = styled(TableViewBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n border: none;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n overflow: hidden;\n ", " {\n border-bottom: none;\n height: 40px;\n }\n ", " {\n padding: 0;\n border-right: 1px solid ", ";\n }\n ", " {\n background: ", ";\n height: ", "px;\n box-shadow: inset 0 -1px 0 ", ";\n border-bottom: none;\n }\n"], ["\n width: 100%;\n border: none;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n overflow: hidden;\n ", " {\n border-bottom: none;\n height: 40px;\n }\n ", " {\n padding: 0;\n border-right: 1px solid ", ";\n }\n ", " {\n background: ", ";\n height: ", "px;\n box-shadow: inset 0 -1px 0 ", ";\n border-bottom: none;\n }\n"])), TableViewRow, TableViewCellContainer, function (p) { return p.theme.colors.gray300; }, TableViewHeader, function (p) { return p.theme.colors.tableHeader; }, spreadsheetHeaderHeightPx, function (p) { return p.theme.colors.gray300; });
70
+ var TableView = styled(TableViewBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n border: none;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n overflow: hidden;\n background-color: ", ";\n ", " {\n border-bottom: none;\n height: 40px;\n }\n ", " {\n padding: 0;\n border-right: 1px solid ", ";\n }\n"], ["\n width: 100%;\n border: none;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n overflow: hidden;\n background-color: ", ";\n ", " {\n border-bottom: none;\n height: 40px;\n }\n ", " {\n padding: 0;\n border-right: 1px solid ", ";\n }\n"])), function (p) { return p.theme.colors.gray50; }, TableViewRow, TableViewCellContainer, function (p) { return p.theme.colors.gray300; });
70
71
  var ErrorCount = styled(Div)(function (_a) {
71
72
  var _b = _a.theme, colors = _b.colors, c = _b.css;
72
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n border: solid 1px ", ";\n padding: 4px 7px;\n border-radius: 56px;\n min-width: 22px;\n ", ";\n ", ";\n "], ["\n color: ", ";\n background: ", ";\n border: solid 1px ", ";\n padding: 4px 7px;\n border-radius: 56px;\n min-width: 22px;\n ", ";\n ", ";\n "])), colors.error, colors.red100, colors.error, c.label3, c.centered);
73
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n border: solid 1px ", ";\n padding: 4px 7px;\n border-radius: 56px;\n min-width: 24px;\n ", ";\n "], ["\n color: ", ";\n background: ", ";\n border: solid 1px ", ";\n padding: 4px 7px;\n border-radius: 56px;\n min-width: 24px;\n ", ";\n "])), colors.error, colors.red100, colors.error, c.centered);
73
74
  });
74
75
  var Spreadsheet = function (_a) {
75
- var isReadOnly = _a.isReadOnly, initialData = _a.initialData, rowWidth = _a.rowWidth, fields = _a.fields, appResponse = _a.appResponse, validationBatchSize = _a.validationBatchSize, _b = _a.onValidateRecord, onValidateRecord = _b === void 0 ? null : _b, submittedData = _a.submittedData, setReviewedData = _a.setReviewedData, _c = _a.onValidateBatch, onValidateBatch = _c === void 0 ? null : _c, _d = _a.highlightFirstRow, highlightFirstRow = _d === void 0 ? false : _d;
76
+ var isReadOnly = _a.isReadOnly, initialData = _a.initialData, rowWidth = _a.rowWidth, fields = _a.fields, appResponse = _a.appResponse, options = _a.options, _b = _a.onValidateRecord, onValidateRecord = _b === void 0 ? null : _b, submittedData = _a.submittedData, setReviewedData = _a.setReviewedData, _c = _a.onValidateBatch, onValidateBatch = _c === void 0 ? null : _c, _d = _a.highlightFirstRow, highlightFirstRow = _d === void 0 ? false : _d;
76
77
  return (_jsx(SpreadsheetContextProvider, __assign({}, {
77
78
  appResponse: appResponse,
78
79
  submittedData: submittedData,
@@ -84,16 +85,20 @@ var Spreadsheet = function (_a) {
84
85
  onValidateRecord: onValidateRecord,
85
86
  onValidateBatch: onValidateBatch,
86
87
  highlightFirstRow: highlightFirstRow,
87
- validationBatchSize: validationBatchSize || initialData.length,
88
+ options: options,
88
89
  }, { children: _jsx(SpreadSheetWithContext, {}, void 0) }), void 0));
89
90
  };
90
91
  var SpreadSheetWithContext = function () {
91
92
  var _a = useSpreadsheetContext(), isReadOnly = _a.isReadOnly, totalErrors = _a.totalErrors, batchValidationPercentage = _a.batchValidationPercentage;
92
93
  var batchValidationProgressUI = (_jsxs(Div, __assign({ body1: true, dflex: true, mb: 22 }, { children: ["Calculating Data...", _jsxs(Div, __assign({ bold: true, ml: 5 }, { children: [batchValidationPercentage, "%"] }), void 0), _jsxs(Div, __assign({ bold: true, c: colors.error, ml: 5 }, { children: ["(", totalErrors, " errors)"] }), void 0)] }), void 0));
93
- return (_jsxs(_Fragment, { children: [_jsx(Div, __assign({ h: 32 }, { children: !isReadOnly &&
94
+ return (_jsxs(Div, { children: [_jsx(Div, __assign({ h: 32 }, { children: !isReadOnly &&
94
95
  batchValidationPercentage < 100 &&
95
96
  batchValidationProgressUI }), void 0), _jsx(SpreadsheetData, {}, void 0)] }, void 0));
96
97
  };
98
+ var booleanOptions = [
99
+ { label: "True", value: true },
100
+ { label: "False", value: false },
101
+ ];
97
102
  var SpreadsheetData = function () {
98
103
  var _a = useSpreadsheetReviewContext(), appResponse = _a.appResponse, isSubmitting = _a.isSubmitting;
99
104
  var _b = useSpreadsheetContext(), fields = _b.fields, data = _b.data, isLoading = _b.isLoading, isReadOnly = _b.isReadOnly, rowWidth = _b.rowWidth, sortByFieldErrors = _b.sortByFieldErrors, setSortByFieldErrors = _b.setSortByFieldErrors, validateRenderedRecords = _b.validateRenderedRecords, setIsLoading = _b.setIsLoading;
@@ -129,27 +134,11 @@ var SpreadsheetData = function () {
129
134
  Header: function () {
130
135
  var columnErrorCounts = useSpreadsheetContext().columnErrorCounts;
131
136
  var fieldErrorCount = columnErrorCounts[f.name];
132
- return (_jsxs(Div, __assign({ p: "0px 16px", spaceBetween: true, w100: true, alignCenter: true }, { children: [_jsxs(Div, { children: [f.label, f.isRequired && "*"] }, void 0), fieldErrorCount && (_jsx(ErrorCount, __assign({ onClick: function () { return setSortByFieldErrors(f.name); } }, { children: fieldErrorCount }), void 0))] }), void 0));
137
+ return (_jsxs(Div, __assign({ p: "0 16px", spaceBetween: true, w100: true, alignCenter: true }, { children: [_jsxs(Div, __assign({ truncateText: true }, { children: [f.label, f.isRequired && "*"] }), void 0), fieldErrorCount && (_jsx(TooltipProvider, __assign({ mr: 3, w: 35, tooltip: "Sort by ".concat(f.label, " errors") }, { children: _jsx(ErrorCount, __assign({ onClick: function () { return setSortByFieldErrors(f.name); } }, { children: _jsx(Div, __assign({ centered: true }, { children: _jsx(Div, __assign({ w: 35, textAlignCenter: true, label3: true, truncateText: true }, { children: fieldErrorCount }), void 0) }), void 0) }), void 0) }), void 0))] }), void 0));
133
138
  },
134
139
  Content: function (record) {
135
- var getInputType = function () {
136
- switch (f.type) {
137
- case FieldTypes.integer:
138
- case FieldTypes.float:
139
- return "number";
140
- case FieldTypes.email:
141
- return "email";
142
- default:
143
- return "text";
144
- }
145
- };
146
- var booleanOptions = [
147
- { label: "True", value: "true" },
148
- { label: "False", value: "false" },
149
- ];
150
140
  var props = {
151
141
  name: f.name,
152
- type: getInputType(),
153
142
  record: (function () {
154
143
  var res = __assign({}, record);
155
144
  delete res.rowIndex;
@@ -161,17 +150,37 @@ var SpreadsheetData = function () {
161
150
  return (_jsx(SpreadsheetAutocomplete, __assign({ isInputDisabled: true }, props, { options: booleanOptions }), void 0));
162
151
  case FieldTypes.enum:
163
152
  return (_jsx(SpreadsheetAutocomplete, __assign({}, props, { options: f === null || f === void 0 ? void 0 : f.options.map(function (o) { return ({ label: o, value: o }); }) }), void 0));
164
- case FieldTypes.string:
165
- case FieldTypes.float:
166
153
  case FieldTypes.integer:
154
+ return (_jsx(SpreadsheetInput, __assign({}, props, { type: "number", step: "1", onKeyDown: function (event) {
155
+ if (event.key === "." ||
156
+ event.key === "," ||
157
+ event.key === "e") {
158
+ event.preventDefault();
159
+ }
160
+ } }), void 0));
161
+ case FieldTypes.float:
162
+ return (_jsx(SpreadsheetInput, __assign({}, props, { type: "number", onKeyDown: function (event) {
163
+ if (event.key === "e") {
164
+ event.preventDefault();
165
+ }
166
+ } }), void 0));
167
+ case FieldTypes.string:
168
+ return _jsx(SpreadsheetInput, __assign({}, props, { type: "email" }), void 0);
167
169
  case FieldTypes.email:
168
- return _jsx(SpreadsheetTextInput, __assign({}, props), void 0);
170
+ return _jsx(SpreadsheetInput, __assign({}, props, { type: "text" }), void 0);
169
171
  }
170
172
  },
171
173
  }); });
172
174
  }, [fields]);
173
175
  var unsubmittedData = getUnsubmittedData(data, appResponse);
174
- return (_jsxs(_Fragment, { children: [_jsx(GlobalStyle, {}, void 0), !isSortingTableData && !isSubmitting && (_jsxs(SpreadSheetWrapper, __assign({ h: SPREADSHEET_HEIGHT, dflex: true, w: 1400 }, { children: [_jsx(SpreadsheetRowNumbers, { spreadsheetHasXScroll: rowWidth > 1, scrollTop: scrollTop, height: SPREADSHEET_HEIGHT }, void 0), _jsx(TableView, { highlightFirstRow: isReadOnly, rowHeight: spreadsheetRowHeightPx, onSectionRendered: onSectionRendered, onTableScroll: function (_scrollTop) { return setScrollTop(_scrollTop); }, h: SPREADSHEET_HEIGHT, rowWidth: rowWidth, data: unsubmittedData, columns: columns, isLoading: isLoading }, void 0)] }), void 0))] }, void 0));
176
+ var spreadsheetHeight = getTableHeight({
177
+ headerHeight: spreadsheetHeaderHeightPx,
178
+ rowHeight: spreadsheetRowHeightPx,
179
+ dataCount: unsubmittedData.length,
180
+ mininmumTableHeight: 450,
181
+ maxVisibleRows: 12,
182
+ });
183
+ return (_jsxs(_Fragment, { children: [_jsx(GlobalStyle, {}, void 0), !isSortingTableData && !isSubmitting && (_jsxs(SpreadSheetWrapper, __assign({ h: spreadsheetHeight, dflex: true, w: 1400 }, { children: [_jsx(SpreadsheetRowNumbers, { spreadsheetHasXScroll: rowWidth > 1, scrollTop: scrollTop, height: spreadsheetHeight }, void 0), _jsx(TableView, { tableHeadersHeight: spreadsheetHeaderHeightPx, highlightFirstRow: isReadOnly, rowHeight: spreadsheetRowHeightPx, onSectionRendered: onSectionRendered, onTableScroll: function (_scrollTop) { return setScrollTop(_scrollTop); }, h: spreadsheetHeight, rowWidth: rowWidth, data: unsubmittedData, columns: columns, isLoading: isLoading }, void 0)] }), void 0))] }, void 0));
175
184
  };
176
185
  export { Spreadsheet };
177
186
  var templateObject_1, templateObject_2, templateObject_3;
@@ -4,4 +4,12 @@ declare type Environments = {
4
4
  [K in EnvironmentType]?: any;
5
5
  };
6
6
  export declare const baseUrls: Environments;
7
+ declare type GetTableHeightArgs = {
8
+ headerHeight: number;
9
+ rowHeight: number;
10
+ maxVisibleRows: number;
11
+ mininmumTableHeight?: number;
12
+ dataCount: number;
13
+ };
14
+ export declare const getTableHeight: ({ headerHeight, rowHeight, maxVisibleRows, mininmumTableHeight, dataCount, }: GetTableHeightArgs) => number;
7
15
  export {};
@@ -1,3 +1,4 @@
1
+ import { defaultTableHeaderHeightPx, defaultTableRowHeightPx, } from "../../common/Table/TableView/common";
1
2
  export var contentWidth = 1120;
2
3
  export var baseUrls = {
3
4
  local: "http://localhost:3000",
@@ -5,3 +6,8 @@ export var baseUrls = {
5
6
  production: "https://fuse.flatironsdevelopment.com",
6
7
  test: "https://fuse-test.flatironsdevelopment.com",
7
8
  };
9
+ var MINIMUM_TABLE_HEIGHT = 375;
10
+ export var getTableHeight = function (_a) {
11
+ var _b = _a.headerHeight, headerHeight = _b === void 0 ? defaultTableHeaderHeightPx : _b, _c = _a.rowHeight, rowHeight = _c === void 0 ? defaultTableRowHeightPx : _c, _d = _a.maxVisibleRows, maxVisibleRows = _d === void 0 ? 7 : _d, _e = _a.mininmumTableHeight, mininmumTableHeight = _e === void 0 ? MINIMUM_TABLE_HEIGHT : _e, dataCount = _a.dataCount;
12
+ return Math.max(headerHeight + rowHeight * Math.min(dataCount, maxVisibleRows + 0.5), mininmumTableHeight);
13
+ };
@@ -1,4 +1,4 @@
1
- import { AppResponse, Record } from "../../types";
1
+ import { AppResponse, BatchValidationErrors, Record, RowValidationError } from "../../types";
2
2
  import { TemplateHeader } from "../ImporterContextProvider";
3
3
  export declare const getSpreadsheetRowWidth: (fields: any, visibleRowsOnTableViewport: any) => number;
4
4
  export declare const getUnsubmittedData: (data: Record[], appResponse: AppResponse) => Record[];
@@ -6,5 +6,6 @@ declare type IsEnumFieldArgs = {
6
6
  templateLabel: string;
7
7
  templateHeaders: TemplateHeader[];
8
8
  };
9
- export declare const isEnumField: ({ templateLabel, templateHeaders, }: IsEnumFieldArgs) => boolean;
9
+ export declare const getColumnType: ({ templateLabel, templateHeaders, }: IsEnumFieldArgs) => string;
10
+ export declare const formatBatchErrors: (errors: RowValidationError[]) => BatchValidationErrors;
10
11
  export {};
@@ -1,4 +1,14 @@
1
- import { FieldTypes } from "../../types";
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
2
12
  export var getSpreadsheetRowWidth = function (fields, visibleRowsOnTableViewport) {
3
13
  var res = fields.length / visibleRowsOnTableViewport;
4
14
  return res > 1 ? res : 1;
@@ -9,9 +19,16 @@ export var getUnsubmittedData = function (data, appResponse) {
9
19
  unsubmittedData = data.filter(function (r) { return !!r._meta.appValidationErrors; });
10
20
  return unsubmittedData;
11
21
  };
12
- export var isEnumField = function (_a) {
22
+ export var getColumnType = function (_a) {
13
23
  var _b;
14
24
  var templateLabel = _a.templateLabel, templateHeaders = _a.templateHeaders;
15
- return ((_b = templateHeaders.find(function (th) { return th.label === templateLabel; })) === null || _b === void 0 ? void 0 : _b.column_type) ===
16
- FieldTypes.enum;
25
+ return (_b = templateHeaders.find(function (th) { return th.label === templateLabel; })) === null || _b === void 0 ? void 0 : _b.column_type;
26
+ };
27
+ export var formatBatchErrors = function (errors) {
28
+ var res = errors.reduce(function (prevState, curr) {
29
+ var newState = __assign({}, prevState);
30
+ newState[curr.rowId] = curr.errors;
31
+ return newState;
32
+ }, {});
33
+ return res;
17
34
  };
@@ -1,20 +1,19 @@
1
1
  /// <reference types="react" />
2
- import { EnvironmentType, OnSubmit, OnValidateBatch, OnValidateRecord } from "../types";
2
+ import { ImporterOptions, OnSubmit, OnValidateBatch, OnValidateRecord } from "../types";
3
3
  declare type LayoutProps = {
4
4
  zIndex: number;
5
5
  };
6
6
  export declare const Layout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../styled/utils").CSSProps & LayoutProps, never>;
7
7
  declare type Props = {
8
- templateId: string;
8
+ templateSlug: string;
9
9
  apiToken: string;
10
- environment?: EnvironmentType;
11
- zIndex: number;
10
+ options: ImporterOptions;
12
11
  onValidateRecord?: OnValidateRecord;
13
12
  onValidateBatch?: OnValidateBatch;
14
13
  onSubmit?: OnSubmit;
15
14
  onClose: any;
16
15
  };
17
- declare const Importer: ({ environment, templateId, apiToken, onSubmit, onValidateRecord, onValidateBatch, zIndex, onClose, }: Props) => JSX.Element;
16
+ declare const Importer: ({ templateSlug, apiToken, onSubmit, onValidateRecord, onValidateBatch, options, onClose, }: Props) => JSX.Element;
18
17
  export * from "./common/Spreadsheet";
19
18
  export * from "./common/utils";
20
19
  export * from "./SpreadsheetReviewContextProvider";
@@ -21,7 +21,7 @@ import { Div } from "../styled/utils";
21
21
  import { Footer } from "./Footer";
22
22
  import { GlobalStyle } from "./GlobalStyle";
23
23
  import { ImporterContextProvider, useImporterContext, } from "./ImporterContextProvider";
24
- import { ImporterFonts } from "./LoadFonts";
24
+ import { ImporterFonts } from "./ImporterFonts";
25
25
  import { Matcher } from "./Matcher";
26
26
  import Review from "./Review";
27
27
  import { SpreadsheetReviewContextProvider } from "./SpreadsheetReviewContextProvider";
@@ -50,21 +50,21 @@ var steps = [
50
50
  },
51
51
  ];
52
52
  var Importer = function (_a) {
53
- var _b = _a.environment, environment = _b === void 0 ? "local" : _b, templateId = _a.templateId, apiToken = _a.apiToken, onSubmit = _a.onSubmit, onValidateRecord = _a.onValidateRecord, onValidateBatch = _a.onValidateBatch, zIndex = _a.zIndex, onClose = _a.onClose;
53
+ var templateSlug = _a.templateSlug, apiToken = _a.apiToken, onSubmit = _a.onSubmit, onValidateRecord = _a.onValidateRecord, onValidateBatch = _a.onValidateBatch, options = _a.options, onClose = _a.onClose;
54
54
  useFullscreenOverlay();
55
55
  return (_jsx(ImporterContextProvider, __assign({}, {
56
- environment: environment,
57
- templateId: templateId,
56
+ options: options,
57
+ templateSlug: templateSlug,
58
58
  apiToken: apiToken,
59
59
  onValidateRecord: onValidateRecord,
60
60
  onValidateBatch: onValidateBatch,
61
61
  onClose: onClose,
62
- }, { children: _jsx(ImporterWithContext, __assign({}, { zIndex: zIndex, onSubmit: onSubmit }), void 0) }), void 0));
62
+ }, { children: _jsx(ImporterWithContext, __assign({}, { onSubmit: onSubmit }), void 0) }), void 0));
63
63
  };
64
64
  var ImporterWithContext = function (_a) {
65
- var zIndex = _a.zIndex, onSubmit = _a.onSubmit;
65
+ var onSubmit = _a.onSubmit;
66
66
  var _b = useCustomImporter(), theme = _b.theme, logoURL = _b.logoURL;
67
- var _c = useImporterContext(), currentStepIndex = _c.currentStepIndex, matcherSubstep = _c.matcherSubstep;
67
+ var _c = useImporterContext(), currentStepIndex = _c.currentStepIndex, matcherSubstep = _c.matcherSubstep, zIndex = _c.importerOptions.zIndex;
68
68
  var layoutRef = useRef(null);
69
69
  useEffect(function () {
70
70
  layoutRef.current.scrollTo(0, 0);
@@ -14,6 +14,7 @@ export declare const TableHeadersContainer: import("styled-components").StyledCo
14
14
  export declare const TableHeadersContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps, never>;
15
15
  declare type TableHeadersProps = Pick<TableViewProps, "columns" | "sortBy" | "setSortBy" | "rowHeight" | "rowWidth"> & {
16
16
  scrollLeft: number;
17
+ height: number;
17
18
  } & DivCSSProps;
18
- export declare const TableHeaders: ({ scrollLeft, columns, sortBy, setSortBy, rowHeight, rowWidth, ...props }: TableHeadersProps) => JSX.Element;
19
+ export declare const TableHeaders: ({ scrollLeft, columns, sortBy, setSortBy, rowHeight, rowWidth, height, ...props }: TableHeadersProps) => JSX.Element;
19
20
  export {};