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,8 +1,8 @@
1
1
  import Fuse from "fuse.js";
2
2
  import React from "react";
3
- import { EnvironmentType, OnValidateBatch, OnValidateRecord } from "../types";
3
+ import { ImporterOptions, OnValidateBatch, OnValidateRecord } from "../types";
4
4
  import { FuseApi } from "./FuseApi";
5
- export declare const options: Fuse.IFuseOptions<string>;
5
+ export declare const fusejsOptions: Fuse.IFuseOptions<string>;
6
6
  export declare type HeaderMatchings = {
7
7
  [templateHeaderLabel: string]: string;
8
8
  };
@@ -39,21 +39,22 @@ declare type State = {
39
39
  matcherSubstep: number;
40
40
  setMatcherSubstep: React.Dispatch<number>;
41
41
  uploadedDataEnumFieldValues: UploadedDataEnumFieldValues;
42
- templateId: string;
42
+ templateSlug: string;
43
43
  apiToken: string;
44
44
  inTrialMode: boolean;
45
45
  onClose: () => void;
46
46
  fuseApi: FuseApi;
47
+ importerOptions: ImporterOptions;
47
48
  };
48
49
  declare type Props = {
49
- templateId: string;
50
+ templateSlug: string;
50
51
  apiToken: string;
51
- environment?: EnvironmentType;
52
+ options: ImporterOptions;
52
53
  onClose: () => void;
53
54
  children: JSX.Element;
54
55
  onValidateRecord?: OnValidateRecord;
55
56
  onValidateBatch?: OnValidateBatch;
56
57
  };
57
- export declare const ImporterContextProvider: ({ templateId, environment, apiToken, children, onClose, onValidateBatch, onValidateRecord, }: Props) => JSX.Element;
58
+ export declare const ImporterContextProvider: ({ templateSlug, apiToken, children, options, onClose, onValidateBatch, onValidateRecord, }: Props) => JSX.Element;
58
59
  export declare const useImporterContext: () => State;
59
60
  export {};
@@ -48,25 +48,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import { jsx as _jsx } from "react/jsx-runtime";
49
49
  import Fuse from "fuse.js";
50
50
  import { createContext, useContext, useEffect, useState } from "react";
51
- import { isEnumField } from "./common/utils";
51
+ import { FieldTypes, } from "../types";
52
+ import { getColumnType } from "./common/utils";
52
53
  import { FuseApi } from "./FuseApi";
53
- export var options = {
54
+ export var fusejsOptions = {
54
55
  includeScore: true,
55
56
  threshold: 0.35,
56
57
  };
57
58
  var ImporterContext = createContext({});
58
59
  export var ImporterContextProvider = function (_a) {
59
- var templateId = _a.templateId, _b = _a.environment, environment = _b === void 0 ? "local" : _b, apiToken = _a.apiToken, children = _a.children, onClose = _a.onClose, onValidateBatch = _a.onValidateBatch, onValidateRecord = _a.onValidateRecord;
60
- var _c = useState(0), currentStepIndex = _c[0], setCurrentStepIndex = _c[1];
61
- var _d = useState(0), matcherSubstep = _d[0], setMatcherSubstep = _d[1];
62
- var _e = useState(null), templateError = _e[0], setTemplateError = _e[1];
63
- var _f = useState(null), templateHeaders = _f[0], setTemplateHeaders = _f[1];
64
- var _g = useState(null), uploadedData = _g[0], setUploadedData = _g[1];
65
- var _h = useState(null), templateHeaderMatchings = _h[0], setTemplateHeaderMatchings = _h[1];
66
- var _j = useState(null), enumFieldValueMatchings = _j[0], setEnumFieldValueMatchings = _j[1];
67
- var _k = useState(null), uploadedDataEnumFieldValues = _k[0], setUploadedDataEnumFieldValues = _k[1];
68
- var _l = useState(false), inTrialMode = _l[0], setInTrialMode = _l[1];
69
- var fuseApi = new FuseApi(environment, apiToken);
60
+ var templateSlug = _a.templateSlug, apiToken = _a.apiToken, children = _a.children, options = _a.options, onClose = _a.onClose, onValidateBatch = _a.onValidateBatch, onValidateRecord = _a.onValidateRecord;
61
+ var _b = useState(0), currentStepIndex = _b[0], setCurrentStepIndex = _b[1];
62
+ var _c = useState(0), matcherSubstep = _c[0], setMatcherSubstep = _c[1];
63
+ var _d = useState(null), templateError = _d[0], setTemplateError = _d[1];
64
+ var _e = useState(null), templateHeaders = _e[0], setTemplateHeaders = _e[1];
65
+ var _f = useState(null), uploadedData = _f[0], setUploadedData = _f[1];
66
+ var _g = useState(null), templateHeaderMatchings = _g[0], setTemplateHeaderMatchings = _g[1];
67
+ var _h = useState(null), enumFieldValueMatchings = _h[0], setEnumFieldValueMatchings = _h[1];
68
+ var _j = useState(null), uploadedDataEnumFieldValues = _j[0], setUploadedDataEnumFieldValues = _j[1];
69
+ var _k = useState(false), inTrialMode = _k[0], setInTrialMode = _k[1];
70
+ var fuseApi = new FuseApi(options.env, apiToken);
70
71
  var uploadedDataHeaders = uploadedData &&
71
72
  uploadedData[0].map(function (ud) { return (typeof ud === "number" ? ud.toString() : ud); });
72
73
  useEffect(function () {
@@ -75,7 +76,7 @@ export var ImporterContextProvider = function (_a) {
75
76
  var _uploadedDataEnumFieldValues = {};
76
77
  var templateLabels = Object.keys(templateHeaderMatchings);
77
78
  var enumFieldsLabels = templateLabels.filter(function (templateLabel) {
78
- return isEnumField({ templateLabel: templateLabel, templateHeaders: templateHeaders });
79
+ return getColumnType({ templateLabel: templateLabel, templateHeaders: templateHeaders }) === FieldTypes.enum;
79
80
  });
80
81
  enumFieldsLabels.forEach(function (templateLabel) {
81
82
  var uploadedDataHeader = templateHeaderMatchings[templateLabel];
@@ -101,7 +102,7 @@ export var ImporterContextProvider = function (_a) {
101
102
  switch (_c.label) {
102
103
  case 0:
103
104
  _c.trys.push([0, 2, , 3]);
104
- return [4 /*yield*/, fuseApi.get("/api/v1/importer/templates/".concat(templateId))];
105
+ return [4 /*yield*/, fuseApi.get("/api/v1/importer/templates/".concat(templateSlug))];
105
106
  case 1:
106
107
  data = (_c.sent()).data;
107
108
  setTemplateHeaders(data.columns);
@@ -128,7 +129,7 @@ export var ImporterContextProvider = function (_a) {
128
129
  };
129
130
  var setHeadersFromDataset = function () {
130
131
  var _templateHeaderMatchings = {};
131
- var fuse = new Fuse(uploadedDataHeaders, options);
132
+ var fuse = new Fuse(uploadedDataHeaders, fusejsOptions);
132
133
  templateHeaders.forEach(function (templateHeader, _index) {
133
134
  var _a;
134
135
  var fuseResults = fuse.search(templateHeader.label);
@@ -145,6 +146,7 @@ export var ImporterContextProvider = function (_a) {
145
146
  setEnumFieldValueMatchings: setEnumFieldValueMatchings,
146
147
  templateHeaderMatchings: templateHeaderMatchings,
147
148
  uploadedDataEnumFieldValues: uploadedDataEnumFieldValues,
149
+ importerOptions: options,
148
150
  setTemplateHeaderMatchings: setTemplateHeaderMatchings,
149
151
  resetImport: resetImport,
150
152
  uploadedData: uploadedData,
@@ -155,7 +157,7 @@ export var ImporterContextProvider = function (_a) {
155
157
  matcherSubstep: matcherSubstep,
156
158
  setMatcherSubstep: setMatcherSubstep,
157
159
  apiToken: apiToken,
158
- templateId: templateId,
160
+ templateSlug: templateSlug,
159
161
  inTrialMode: inTrialMode,
160
162
  onClose: onClose,
161
163
  fuseApi: fuseApi,
@@ -10,19 +10,22 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useRef } from "react";
13
14
  import { TableView } from "../../../../common/Table/TableView";
15
+ import { colors } from "../../../../styled/theme/colorPalette";
14
16
  import { Div } from "../../../../styled/utils";
15
17
  import { useImporterContext } from "../../../ImporterContextProvider";
16
18
  import { MatcherStatus } from "../../common/types";
17
19
  import { EnumFieldMatcherContextProvider } from "../EnumFieldMatcherContext";
18
20
  import { tableColumns } from "./tableColumns";
19
21
  import { defaultTableHeaderHeightPx } from "../../../../common/Table/TableView/common";
20
- import { colors } from "../../../../styled/theme/colorPalette";
21
- import { matcherTableMinHeightPx, matcherTableMaxHeightPx, } from "../../common/index";
22
+ import { getTableHeight } from "../../../common";
23
+ import { MAX_VISIBLE_ROWS } from "../../common";
22
24
  export var EnumFieldMatcher = function (_a) {
23
25
  var _b;
24
26
  var templateHeaderLabel = _a.templateHeaderLabel;
25
27
  var _c = useImporterContext(), enumFieldValueMatchings = _c.enumFieldValueMatchings, templateHeaders = _c.templateHeaders;
28
+ var isRequired = (_b = templateHeaders.find(function (th) { return th.label === templateHeaderLabel; })) === null || _b === void 0 ? void 0 : _b.required;
26
29
  var enumFieldValueMatching = enumFieldValueMatchings[templateHeaderLabel];
27
30
  var uploadedDataValues = Object.keys(enumFieldValueMatching);
28
31
  var data = uploadedDataValues.map(function (uploadedDataValue) { return ({
@@ -32,7 +35,20 @@ export var EnumFieldMatcher = function (_a) {
32
35
  ? MatcherStatus.matched
33
36
  : MatcherStatus.unmatched,
34
37
  }); });
35
- var isRequired = (_b = templateHeaders.find(function (th) { return th.label === templateHeaderLabel; })) === null || _b === void 0 ? void 0 : _b.required;
38
+ var dataSortingOrderRef = useRef(uploadedDataValues
39
+ .map(function (uploadedDataValue, index) { return ({
40
+ index: index,
41
+ isMatched: !!enumFieldValueMatching[uploadedDataValue],
42
+ }); })
43
+ .sort(function (a, b) { return (b.isMatched ? 1 : -1); }));
44
+ //sort data based on automatched items
45
+ var sortedData = dataSortingOrderRef.current.map(function (sorting) { return data[sorting.index]; });
36
46
  var tableRowHeight = 100;
37
- return (_jsxs(Div, { children: [_jsx(Div, __assign({ h5: true, mb: 16 }, { children: "Values for the '".concat(templateHeaderLabel).concat(isRequired ? "*" : "", "' Column") }), void 0), _jsx(Div, __assign({ mb: 40 }, { children: _jsx(EnumFieldMatcherContextProvider, __assign({ templateHeaderLabel: templateHeaderLabel }, { children: _jsx(TableView, { minh: matcherTableMinHeightPx, maxh: matcherTableMaxHeightPx, rowHeight: tableRowHeight, h: data.length * tableRowHeight + defaultTableHeaderHeightPx, data: data, columns: tableColumns, bg: colors.white }, void 0) }), void 0) }), void 0)] }, void 0));
47
+ var tableHeight = getTableHeight({
48
+ headerHeight: defaultTableHeaderHeightPx,
49
+ rowHeight: tableRowHeight,
50
+ dataCount: data.length,
51
+ maxVisibleRows: MAX_VISIBLE_ROWS,
52
+ });
53
+ return (_jsxs(Div, { children: [_jsx(Div, __assign({ h5: true, mb: 16 }, { children: "Values for the '".concat(templateHeaderLabel).concat(isRequired ? "*" : "", "' Column") }), void 0), _jsx(Div, __assign({ mb: 40 }, { children: _jsx(EnumFieldMatcherContextProvider, __assign({ templateHeaderLabel: templateHeaderLabel }, { children: _jsx(TableView, { h: tableHeight, rowHeight: tableRowHeight, data: sortedData, columns: tableColumns, bg: colors.white }, void 0) }), void 0) }), void 0)] }, void 0));
38
54
  };
@@ -9,13 +9,12 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { Autocomplete } from "../../../../common/inputs/Autocomplete";
14
14
  import { Div } from "../../../../styled/utils";
15
15
  import { useImporterContext } from "../../../ImporterContextProvider";
16
- import { greenCheckIcon, warningIcon } from "../../common/icons";
16
+ import { matchedIndicatorUI, unmatchedIndicatorUI } from "../../common";
17
17
  import { MatcherStatus } from "../../common/types";
18
- import { StatusColumn } from "../../HeaderMatcher/tableColumns";
19
18
  import { useEnumFieldMatcherContext } from "../EnumFieldMatcherContext";
20
19
  export var tableColumns = [
21
20
  {
@@ -40,7 +39,7 @@ export var tableColumns = [
40
39
  newEnumFieldValueMatchings[templateHeaderLabel][uploadedDataValue] = selected;
41
40
  setEnumFieldValueMatchings(newEnumFieldValueMatchings);
42
41
  };
43
- return (_jsx(Div, __assign({ w100: true }, { children: _jsx(Autocomplete, { placeholder: "Select option...", onChange: onChange, value: uploadedDataValueMatching, options: valueOptions.map(function (vo) { return ({
42
+ return (_jsx(Div, __assign({ w100: true }, { children: _jsx(Autocomplete, { w: "90%", placeholder: "Select option...", onChange: onChange, value: uploadedDataValueMatching, options: valueOptions.map(function (vo) { return ({
44
43
  value: vo,
45
44
  label: vo,
46
45
  }); }) }, void 0) }), void 0));
@@ -51,7 +50,9 @@ export var tableColumns = [
51
50
  width: 1,
52
51
  Content: function (_a) {
53
52
  var status = _a.status;
54
- return (_jsxs(StatusColumn, __assign({ matched: status, justifyCenter: true, body2: true, dflex: true, alignCenter: true }, { children: [status === MatcherStatus.matched ? greenCheckIcon : warningIcon, _jsx(Div, __assign({ ml: 6 }, { children: status }), void 0)] }), void 0));
53
+ return (_jsx(_Fragment, { children: status === MatcherStatus.matched
54
+ ? matchedIndicatorUI
55
+ : unmatchedIndicatorUI }, void 0));
55
56
  },
56
57
  },
57
58
  ];
@@ -14,13 +14,14 @@ var __assign = (this && this.__assign) || function () {
14
14
  return __assign.apply(this, arguments);
15
15
  };
16
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
+ import { useRef } from "react";
17
18
  import styled from "styled-components";
18
- import { TableView } from "../../../common/Table/TableView";
19
+ import { defaultTableHeaderHeightPx, TableView, } from "../../../common/Table/TableView";
19
20
  import { colors } from "../../../styled/theme";
20
21
  import { Div } from "../../../styled/utils";
21
- import { contentWidth } from "../../common/index";
22
+ import { contentWidth, getTableHeight } from "../../common/index";
22
23
  import { useImporterContext } from "../../ImporterContextProvider";
23
- import { matcherTableMaxHeightPx, matcherTableMinHeightPx, } from "../common/index";
24
+ import { MAX_VISIBLE_ROWS } from "../common";
24
25
  import { MatcherStatus } from "../common/types";
25
26
  import { tableColumns } from "./tableColumns";
26
27
  var CardContainer = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n > div {\n margin: 16px;\n }\n"], ["\n flex-direction: row;\n > div {\n margin: 16px;\n }\n"])));
@@ -37,8 +38,22 @@ var HeaderMatcher = function () {
37
38
  : MatcherStatus.unmatched,
38
39
  };
39
40
  });
41
+ var dataSortingOrderRef = useRef(templateHeaderLabels
42
+ .map(function (templateHeaderLabel, index) { return ({
43
+ index: index,
44
+ isMatched: !!templateHeaderMatchings[templateHeaderLabel],
45
+ }); })
46
+ .sort(function (a, b) { return (b.isMatched ? 1 : -1); }));
47
+ //sort data based on automatched items
48
+ var sortedData = dataSortingOrderRef.current.map(function (sorting) { return data[sorting.index]; });
40
49
  var tableRowHeight = 100;
41
- var headerMatcher = (_jsx(Div, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Match Your Columns with Ours" }), void 0), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: "We were able to match ".concat(numberOfMatchedHeaders, " of ").concat(templateHeaders.length, " columns correctly!") }), void 0), _jsx(CardContainer, __assign({ dflex: true, centered: true, alignStart: true }, { children: _jsx(Div, __assign({ w: contentWidth }, { children: _jsx(TableView, { minh: matcherTableMinHeightPx, maxh: matcherTableMaxHeightPx, data: data, rowHeight: tableRowHeight, columns: tableColumns, bg: colors.white }, void 0) }), void 0) }), void 0)] }), void 0) }, void 0));
50
+ var tableHeight = getTableHeight({
51
+ headerHeight: defaultTableHeaderHeightPx,
52
+ rowHeight: tableRowHeight,
53
+ dataCount: data.length,
54
+ maxVisibleRows: MAX_VISIBLE_ROWS,
55
+ });
56
+ var headerMatcher = (_jsx(Div, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Match Your Columns with Ours" }), void 0), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: "We were able to match ".concat(numberOfMatchedHeaders, " of ").concat(templateHeaders.length, " columns correctly!") }), void 0), _jsx(CardContainer, __assign({ dflex: true, centered: true, alignStart: true }, { children: _jsx(Div, __assign({ w: contentWidth }, { children: _jsx(TableView, { h: tableHeight, data: sortedData, rowHeight: tableRowHeight, columns: tableColumns, bg: colors.white }, void 0) }), void 0) }), void 0)] }), void 0) }, void 0));
42
57
  return _jsx(_Fragment, { children: headerMatcher }, void 0);
43
58
  };
44
59
  export { HeaderMatcher };
@@ -1,8 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare type StatusColumnProps = {
3
- matched: boolean;
4
- };
5
- export declare const StatusColumn: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../styled/utils").CSSProps & StatusColumnProps, never>;
6
2
  export declare const tableColumns: ({
7
3
  header: string;
8
4
  width: number;
@@ -17,4 +13,3 @@ export declare const tableColumns: ({
17
13
  status: any;
18
14
  }) => JSX.Element;
19
15
  })[];
20
- export {};
@@ -1,7 +1,3 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
1
  var __assign = (this && this.__assign) || function () {
6
2
  __assign = Object.assign || function(t) {
7
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -13,16 +9,12 @@ var __assign = (this && this.__assign) || function () {
13
9
  };
14
10
  return __assign.apply(this, arguments);
15
11
  };
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import styled, { css } from "styled-components";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
13
  import { Autocomplete } from "../../../common/inputs/Autocomplete";
19
14
  import { Div } from "../../../styled/utils";
20
15
  import { useImporterContext } from "../../ImporterContextProvider";
21
- import { greenCheckIcon, warningIcon } from "../common/icons";
16
+ import { matchedIndicatorUI, unmatchedIndicatorUI } from "../common/index";
22
17
  import { MatcherStatus } from "../common/types";
23
- export var StatusColumn = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n padding: 8px 6px;\n border-radius: 5px;\n ", "\n"], ["\n background-color: ", ";\n padding: 8px 6px;\n border-radius: 5px;\n ", "\n"])), function (p) { return p.theme.colors.orange50; }, function (props) {
24
- return props.matched && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), function (props) { return props.theme.colors.green50; });
25
- });
26
18
  export var tableColumns = [
27
19
  {
28
20
  header: "Your Columns",
@@ -35,7 +27,7 @@ export var tableColumns = [
35
27
  newTemplateHeaderMatchings[ourColumns] = selected;
36
28
  setTemplateHeaderMatchings(newTemplateHeaderMatchings);
37
29
  };
38
- return (_jsx(Autocomplete, { mr: 10, onChange: onChange, value: yourColumns, options: uploadedDataHeaders.map(function (h) { return ({
30
+ return (_jsx(Autocomplete, { w: "92%", onChange: onChange, value: yourColumns, options: uploadedDataHeaders.map(function (h) { return ({
39
31
  value: h,
40
32
  label: h,
41
33
  }); }) }, void 0));
@@ -49,7 +41,7 @@ export var tableColumns = [
49
41
  var ourColumns = _a.ourColumns;
50
42
  var templateHeaders = useImporterContext().templateHeaders;
51
43
  var isRequired = (_b = templateHeaders.find(function (th) { return th.label === ourColumns; })) === null || _b === void 0 ? void 0 : _b.required;
52
- return (_jsxs(Div, __assign({ body1: true }, { children: [ourColumns, isRequired ? "*" : "", " "] }), void 0));
44
+ return (_jsxs(Div, __assign({ body1: true }, { children: [ourColumns, isRequired ? "*" : ""] }), void 0));
53
45
  },
54
46
  },
55
47
  {
@@ -57,8 +49,9 @@ export var tableColumns = [
57
49
  width: 1,
58
50
  Content: function (_a) {
59
51
  var status = _a.status;
60
- return (_jsxs(StatusColumn, __assign({ matched: status, alignCenter: true, body2: true, dflex: true }, { children: [status === MatcherStatus.matched ? greenCheckIcon : warningIcon, _jsx(Div, __assign({ ml: 6 }, { children: status }), void 0)] }), void 0));
52
+ return (_jsx(_Fragment, { children: status === MatcherStatus.matched
53
+ ? matchedIndicatorUI
54
+ : unmatchedIndicatorUI }, void 0));
61
55
  },
62
56
  },
63
57
  ];
64
- var templateObject_1, templateObject_2;
@@ -1,2 +1,4 @@
1
- export declare const matcherTableMinHeightPx = 420;
2
- export declare const matcherTableMaxHeightPx = 700;
1
+ /// <reference types="react" />
2
+ export declare const MAX_VISIBLE_ROWS = 5;
3
+ export declare const matchedIndicatorUI: JSX.Element;
4
+ export declare const unmatchedIndicatorUI: JSX.Element;
@@ -1,2 +1,32 @@
1
- export var matcherTableMinHeightPx = 420;
2
- export var matcherTableMaxHeightPx = 700;
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ import styled, { css } from "styled-components";
18
+ import { colors, Div } from "../../../styled";
19
+ export var MAX_VISIBLE_ROWS = 5;
20
+ var successIcon = (_jsx("svg", __assign({ width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6 11.5C9.03757 11.5 11.5 9.03757 11.5 6C11.5 2.96243 9.03757 0.5 6 0.5C2.96243 0.5 0.5 2.96243 0.5 6C0.5 9.03757 2.96243 11.5 6 11.5ZM4.94194 5.53291C4.69786 5.28883 4.30214 5.28883 4.05806 5.53291C3.81398 5.77699 3.81398 6.17272 4.05806 6.4168L5.11872 7.47746C5.3628 7.72153 5.75852 7.72153 6.0026 7.47746L8.12392 5.35614C8.368 5.11206 8.368 4.71633 8.12392 4.47225C7.87984 4.22817 7.48412 4.22817 7.24004 4.47225L5.56066 6.15163L4.94194 5.53291Z", fill: colors.green300 }, void 0) }), void 0));
21
+ var warningIcon = (_jsx("svg", __assign({ width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6 11.5C9.03757 11.5 11.5 9.03757 11.5 6C11.5 2.96243 9.03757 0.5 6 0.5C2.96243 0.5 0.5 2.96243 0.5 6C0.5 9.03757 2.96243 11.5 6 11.5ZM6 2.875C6.34518 2.875 6.625 3.15482 6.625 3.5V6C6.625 6.34518 6.34518 6.625 6 6.625C5.65482 6.625 5.375 6.34518 5.375 6V3.5C5.375 3.15482 5.65482 2.875 6 2.875ZM6 7.375C6.34518 7.375 6.625 7.65482 6.625 8V8.25C6.625 8.59518 6.34518 8.875 6 8.875C5.65482 8.875 5.375 8.59518 5.375 8.25V8C5.375 7.65482 5.65482 7.375 6 7.375Z", fill: colors.orange500 }, void 0) }), void 0));
22
+ var Wrapper = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 2px 7px;\n ", ";\n"], ["\n padding: 2px 7px;\n ", ";\n"])), function (p) {
23
+ var c = p.theme.css;
24
+ return [c.label3, c.alignCenter, c.selectNone];
25
+ });
26
+ var UnmatchedIndicator = styled(Wrapper)(function (_a) {
27
+ var _b = _a.theme, colors = _b.colors, c = _b.css;
28
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: 24px;\n "], ["\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: 24px;\n "])), function (p) { return p.theme.colors.warning01; });
29
+ });
30
+ export var matchedIndicatorUI = (_jsxs(Wrapper, { children: [_jsx(Div, __assign({ centered: true }, { children: successIcon }), void 0), _jsx(Div, __assign({ ml: 8 }, { children: "MATCHED" }), void 0)] }, void 0));
31
+ export var unmatchedIndicatorUI = (_jsxs(UnmatchedIndicator, { children: [_jsx(Div, __assign({ centered: true }, { children: warningIcon }), void 0), _jsx(Div, __assign({ ml: 8 }, { children: "UNMATCHED" }), void 0)] }, void 0));
32
+ var templateObject_1, templateObject_2;
@@ -31,5 +31,5 @@ export var AppResponseModal = function () {
31
31
  var defaultMessage = importWasSuccessful
32
32
  ? "Data imported successfully"
33
33
  : "Some records could not be imported. Please review the errors and resubmit.";
34
- return (_jsx(Modal, __assign({ isOpen: isAppResponseModalOpen, onClose: onCloseModal }, { children: _jsxs(Div, __assign({ centered: true, flexColumn: true, p: 40 }, { children: [_jsx(Div, __assign({ h5: true, w: 300, textAlignCenter: true, mt: 20 }, { children: (appResponse === null || appResponse === void 0 ? void 0 : appResponse.message) || defaultMessage }), void 0), _jsx(Div, __assign({ dflex: true, mt: 40, w100: true, centered: true }, { children: _jsx(Button, __assign({ w: 100, ml: 10, onClick: onCloseModal }, { children: "OK" }), void 0) }), void 0)] }), void 0) }), void 0));
34
+ return (_jsx(Modal, __assign({ isOpen: isAppResponseModalOpen, onClose: onCloseModal }, { children: _jsxs(Div, __assign({ centered: true, flexColumn: true, p: 40 }, { children: [_jsx(Div, __assign({ h6: true, w: 300, textAlignCenter: true, mt: 20 }, { children: (appResponse === null || appResponse === void 0 ? void 0 : appResponse.message) || defaultMessage }), void 0), _jsx(Div, __assign({ dflex: true, mt: 40, w100: true, centered: true }, { children: _jsx(Button, __assign({ w: 100, ml: 10, onClick: onCloseModal }, { children: "OK" }), void 0) }), void 0)] }), void 0) }), void 0));
35
35
  };
@@ -14,12 +14,20 @@ import { useMemo } from "react";
14
14
  import { Div } from "../../styled/utils";
15
15
  import { FieldTypes } from "../../types";
16
16
  import { Spreadsheet } from "../common/Spreadsheet";
17
- import { getSpreadsheetRowWidth, isEnumField } from "../common/utils";
18
- import { useImporterContext, } from "../ImporterContextProvider";
17
+ import { getColumnType, getSpreadsheetRowWidth } from "../common/utils";
18
+ import { useImporterContext } from "../ImporterContextProvider";
19
19
  import { useSpreadsheetReviewContext } from "../SpreadsheetReviewContextProvider";
20
20
  import { AppResponseModal } from "./AppResponseModal";
21
- var useInitialData = function (_a) {
22
- var uploadedData = _a.uploadedData, templateHeaderMatchings = _a.templateHeaderMatchings, enumFieldValueMatchings = _a.enumFieldValueMatchings, uploadedDataHeaders = _a.uploadedDataHeaders, templateHeaders = _a.templateHeaders;
21
+ var valueIsTrue = function (value) {
22
+ var _value = value.toLowerCase();
23
+ return ["true", "yes", "1", "y", "on", "t"].includes(_value);
24
+ };
25
+ var valueIsInteger = function (value) { return /^-?[0-9]+$/.test(value + ""); };
26
+ var valueIsNumber = function (value) {
27
+ return /^-?[0-9]+(?:\.[0-9]+)?$/.test(value + "");
28
+ };
29
+ var useInitialData = function () {
30
+ var _a = useImporterContext(), templateHeaderMatchings = _a.templateHeaderMatchings, enumFieldValueMatchings = _a.enumFieldValueMatchings, templateHeaders = _a.templateHeaders, uploadedDataHeaders = _a.uploadedDataHeaders, uploadedData = _a.uploadedData;
23
31
  return useMemo(function () {
24
32
  var templateHeaderLabelsWithMatchings = Object.keys(templateHeaderMatchings).filter(function (thl) { return !!templateHeaderMatchings[thl]; });
25
33
  var getUploadedDataRowIndex = function (templateHeaderLabel) {
@@ -35,13 +43,18 @@ var useInitialData = function (_a) {
35
43
  templateHeaderLabelsWithMatchings.forEach(function (templateLabel) {
36
44
  var key = getTemplateHeaderKey(templateLabel);
37
45
  var value = row[getUploadedDataRowIndex(templateLabel)];
38
- if (isEnumField({ templateLabel: templateLabel, templateHeaders: templateHeaders })) {
39
- var templateOption = enumFieldValueMatchings[templateLabel][value];
40
- record[key] = templateOption || value;
41
- }
42
- else {
43
- record[key] = value;
44
- }
46
+ record[key] = value;
47
+ if (value === undefined)
48
+ return;
49
+ var columnType = getColumnType({ templateLabel: templateLabel, templateHeaders: templateHeaders });
50
+ if (columnType === FieldTypes.enum)
51
+ record[key] = enumFieldValueMatchings[templateLabel][value];
52
+ if (columnType === FieldTypes.boolean)
53
+ record[key] = valueIsTrue(value);
54
+ if (columnType === FieldTypes.float)
55
+ record[key] = valueIsNumber(value) ? parseFloat(value) : undefined;
56
+ if (columnType === FieldTypes.integer)
57
+ record[key] = valueIsInteger(value) ? parseInt(value) : undefined;
45
58
  });
46
59
  return record;
47
60
  };
@@ -55,15 +68,9 @@ var useInitialData = function (_a) {
55
68
  ]);
56
69
  };
57
70
  var Review = function () {
58
- var _a = useImporterContext(), templateHeaderMatchings = _a.templateHeaderMatchings, enumFieldValueMatchings = _a.enumFieldValueMatchings, templateHeaders = _a.templateHeaders, uploadedDataHeaders = _a.uploadedDataHeaders, uploadedData = _a.uploadedData, onValidateRecord = _a.onValidateRecord, onValidateBatch = _a.onValidateBatch;
59
- var _b = useSpreadsheetReviewContext(), submittedData = _b.submittedData, appResponse = _b.appResponse, setReviewedData = _b.setReviewedData;
60
- var initialData = useInitialData({
61
- uploadedData: uploadedData,
62
- uploadedDataHeaders: uploadedDataHeaders,
63
- templateHeaderMatchings: templateHeaderMatchings,
64
- enumFieldValueMatchings: enumFieldValueMatchings,
65
- templateHeaders: templateHeaders,
66
- });
71
+ var _a = useImporterContext(), templateHeaders = _a.templateHeaders, onValidateRecord = _a.onValidateRecord, onValidateBatch = _a.onValidateBatch, _b = _a.importerOptions, batchValidationDelayMs = _b.batchValidationDelayMs, batchValidationSize = _b.batchValidationSize;
72
+ var initialData = useInitialData();
73
+ var _c = useSpreadsheetReviewContext(), submittedData = _c.submittedData, appResponse = _c.appResponse, setReviewedData = _c.setReviewedData;
67
74
  var fields = templateHeaders.map(function (templateHeader) { return ({
68
75
  label: templateHeader.label,
69
76
  name: templateHeader.internal_key,
@@ -71,7 +78,10 @@ var Review = function () {
71
78
  isRequired: templateHeader.required,
72
79
  options: templateHeader.values,
73
80
  }); });
74
- var spreadsheetUI = useMemo(function () { return (_jsx(Div, { children: _jsx(Spreadsheet, __assign({ rowWidth: getSpreadsheetRowWidth(fields, 6) }, {
81
+ var spreadsheetUI = useMemo(function () { return (_jsx(Div, { children: _jsx(Spreadsheet, __assign({ rowWidth: getSpreadsheetRowWidth(fields, 6), options: {
82
+ batchValidationDelayMs: batchValidationDelayMs,
83
+ batchValidationSize: batchValidationSize || initialData.length,
84
+ } }, {
75
85
  submittedData: submittedData,
76
86
  appResponse: appResponse,
77
87
  setReviewedData: setReviewedData,
@@ -80,6 +90,6 @@ var Review = function () {
80
90
  onValidateBatch: onValidateBatch,
81
91
  onValidateRecord: onValidateRecord,
82
92
  }), void 0) }, void 0)); }, [appResponse, submittedData]);
83
- return (_jsxs(Div, __assign({ centered: true, flexColumn: true }, { children: [_jsx(AppResponseModal, {}, void 0), _jsx(Div, __assign({ h2: true, mt: 40 }, { children: "Review Your Spreadsheet before Submitting" }), void 0), _jsx(Div, __assign({ body1: true, mt: 20, w: 540, mb: 15, textAlignCenter: true }, { children: "Some cells in the document might have errors in format or missing information. Please review these to continue." }), void 0), initialData && spreadsheetUI] }), void 0));
93
+ return (_jsxs(Div, __assign({ centered: true, flexColumn: true }, { children: [_jsx(AppResponseModal, {}, void 0), _jsxs(Div, __assign({ w: 1400 }, { children: [_jsxs(Div, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: [_jsx(Div, __assign({ h2: true, mt: 40 }, { children: "Review Your Spreadsheet before Submitting" }), void 0), _jsx(Div, __assign({ body1: true, mt: 20, w: 540, mb: 15 }, { children: "Some cells in the document might have errors in format or missing information. Please review these to continue." }), void 0)] }), void 0), initialData && spreadsheetUI] }), void 0)] }), void 0));
84
94
  };
85
95
  export default Review;
@@ -57,7 +57,7 @@ export var SpreadsheetReviewContextProvider = function (_a) {
57
57
  var _c = useState(null), reviewedData = _c[0], setReviewedData = _c[1];
58
58
  var _d = useState(null), submittedData = _d[0], setSubmittedData = _d[1];
59
59
  var _e = useState(null), appResponse = _e[0], setAppResponse = _e[1];
60
- var _f = useImporterContext(), templateId = _f.templateId, fuseApi = _f.fuseApi;
60
+ var _f = useImporterContext(), templateSlug = _f.templateSlug, fuseApi = _f.fuseApi;
61
61
  var getImportWasSuccessful = function (response) {
62
62
  return !response.errors || !Object.keys(response.errors).length;
63
63
  };
@@ -69,7 +69,7 @@ export var SpreadsheetReviewContextProvider = function (_a) {
69
69
  trackImportedRowsCount = function (rowCount) { return __awaiter(void 0, void 0, void 0, function () {
70
70
  return __generator(this, function (_a) {
71
71
  switch (_a.label) {
72
- case 0: return [4 /*yield*/, fuseApi.post("/api/v1/importer/templates/".concat(templateId, "/imports"), {
72
+ case 0: return [4 /*yield*/, fuseApi.post("/api/v1/importer/templates/".concat(templateSlug, "/imports"), {
73
73
  row_count: rowCount,
74
74
  })];
75
75
  case 1:
@@ -18,7 +18,7 @@ import { Button } from "../common/buttons";
18
18
  import { whiteCheckIcon, closeIconCondensed, ChevronRightIcon, } from "../common/icons";
19
19
  import { useState } from "react";
20
20
  import styled, { css } from "styled-components";
21
- import { options, useImporterContext, } from "./ImporterContextProvider";
21
+ import { useImporterContext, } from "./ImporterContextProvider";
22
22
  import { colors } from "../styled/theme/colorPalette";
23
23
  import { Div } from "../styled/utils";
24
24
  import { Modal } from "../common/Modal";
@@ -26,6 +26,7 @@ import { useSpreadsheetReviewContext } from "./SpreadsheetReviewContextProvider"
26
26
  import { ColumnType } from "./Matcher/common/types";
27
27
  import Fuse from "fuse.js";
28
28
  import { contentWidth } from "./common";
29
+ import { fusejsOptions } from "./ImporterContextProvider";
29
30
  var StepIndexWrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 22px;\n width: 22px;\n color: ", ";\n border-radius: 50%;\n background-color: none;\n border: 1px solid ", ";\n\n ", ";\n"], ["\n height: 22px;\n width: 22px;\n color: ", ";\n border-radius: 50%;\n background-color: none;\n border: 1px solid ", ";\n\n ", ";\n"])), function (p) { return p.theme.colors.gray400; }, function (p) { return p.theme.colors.gray400; }, function (p) {
30
31
  return p.isSelected && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 32px;\n width: 32px;\n border: solid 1px ", ";\n color: ", ";\n background-color: ", ";\n "], ["\n height: 32px;\n width: 32px;\n border: solid 1px ", ";\n color: ", ";\n background-color: ", ";\n "])), function (p) { return p.theme.colors.blue500; }, function (p) { return p.theme.colors.white; }, function (p) { return p.theme.colors.blue500; });
31
32
  });
@@ -47,7 +48,7 @@ var getEnumFieldValueMatchingsInitialValue = function (_a) {
47
48
  uploadedDataEnumFieldValues[templateLabel].forEach(function (uploadedValue, _index) {
48
49
  var _a, _b;
49
50
  var templateOptions = (_a = templateHeaders.find(function (th) { return th.label === templateLabel; })) === null || _a === void 0 ? void 0 : _a.values;
50
- var fuse = new Fuse(templateOptions, options);
51
+ var fuse = new Fuse(templateOptions, fusejsOptions);
51
52
  var fuseResults = fuse.search(uploadedValue);
52
53
  var previousRes = __assign({}, (res[templateLabel] || {}));
53
54
  res[templateLabel] = previousRes;
@@ -63,7 +64,7 @@ var getEnumFieldValueMatchingsInitialValue = function (_a) {
63
64
  var Stepper = function (_a) {
64
65
  var stepLabels = _a.stepLabels, logoURL = _a.logoURL;
65
66
  var _b = useState(false), isUnmatchedHeadersModalOpen = _b[0], setIsUnmatchedHeadersModalOpen = _b[1];
66
- var _c = useSpreadsheetReviewContext(), isSpreadsheetReviewComplete = _c.isSpreadsheetReviewComplete, onSubmit = _c.onSubmit;
67
+ var _c = useSpreadsheetReviewContext(), appResponse = _c.appResponse, isSpreadsheetReviewComplete = _c.isSpreadsheetReviewComplete, onSubmit = _c.onSubmit;
67
68
  var _d = useState(false), isSubmitModalOpen = _d[0], setIsSubmitModalOpen = _d[1];
68
69
  var _e = useImporterContext(), currentStepIndex = _e.currentStepIndex, setEnumFieldValueMatchings = _e.setEnumFieldValueMatchings, setCurrentStepIndex = _e.setCurrentStepIndex, templateHeaderMatchings = _e.templateHeaderMatchings, matcherSubstep = _e.matcherSubstep, setMatcherSubstep = _e.setMatcherSubstep, templateHeaders = _e.templateHeaders, uploadedDataEnumFieldValues = _e.uploadedDataEnumFieldValues, onClose = _e.onClose;
69
70
  var submitModalUI = (_jsx(Modal, __assign({ isOpen: isSubmitModalOpen, onClose: function () { return setIsSubmitModalOpen(false); } }, { children: _jsxs(Div, __assign({ centered: true, flexColumn: true, p: 60 }, { children: [_jsx(Div, { children: submitSvg }, void 0), _jsx(Div, __assign({ h5: true, mt: 20 }, { children: "Ready to submit?" }), void 0), _jsx(Div, __assign({ body1: true, mt: 12, w: 448, textAlignCenter: true }, { children: "We didn't find anything wrong with your file. You're good to go!" }), void 0), _jsxs(Div, __assign({ dflex: true, mt: 40, w100: true, centered: true }, { children: [_jsx(Button, __assign({ w: 115, variant: "secondary", mr: 10, onClick: function () { return setIsSubmitModalOpen(false); } }, { children: "Go back" }), void 0), _jsx(Button, __assign({ w: 140, ml: 10, onClick: function () {
@@ -118,10 +119,10 @@ var Stepper = function (_a) {
118
119
  setStep();
119
120
  setIsUnmatchedHeadersModalOpen(false);
120
121
  };
121
- var unmatchedHeadersModalUI = (_jsx(Modal, __assign({ isOpen: isUnmatchedHeadersModalOpen, onClose: function () { return setIsUnmatchedHeadersModalOpen(false); } }, { children: _jsxs(Div, __assign({ p: "17px 20px" }, { children: [_jsx(Div, __assign({ textAlignCenter: true, mb: 24, mt: 5 }, { children: errorIcon }), void 0), _jsx(Div, __assign({ textAlignCenter: true, h3: true, mb: 8 }, { children: "Unmatched Headers" }), void 0), _jsxs(Div, __assign({ maxw: 395, textAlignCenter: true, body1: true, mb: 40 }, { children: ["There are ", unmatchedHeadersCount, " unmatched column headers. You will have to fill these out manually if you proceed."] }), void 0), _jsxs(Div, __assign({ dflex: true, centered: true }, { children: [_jsx(Button, __assign({ variant: "secondary", onClick: function () { return setIsUnmatchedHeadersModalOpen(false); }, w: 160, mr: 16 }, { children: "Assign Headers" }), void 0), _jsx(Button, __assign({ variant: "primary", w: 68, onClick: skipStep }, { children: "Skip" }), void 0)] }), void 0)] }), void 0) }), void 0));
122
+ var unmatchedHeadersModalUI = (_jsx(Modal, __assign({ isOpen: isUnmatchedHeadersModalOpen, onClose: function () { return setIsUnmatchedHeadersModalOpen(false); } }, { children: _jsxs(Div, __assign({ p: "17px 20px" }, { children: [_jsx(Div, __assign({ textAlignCenter: true, mb: 24, mt: 5 }, { children: errorIcon }), void 0), _jsx(Div, __assign({ textAlignCenter: true, h5: true }, { children: "Unmatched Column Headers" }), void 0), _jsxs(Div, __assign({ w: 448, mt: 12, textAlignCenter: true, body1: true }, { children: [unmatchedHeadersCount === 1 ? "There is " : "There are ", unmatchedHeadersCount, " unmatched column headers. You will have to fill these out manually if you proceed."] }), void 0), _jsxs(Div, __assign({ dflex: true, centered: true, mt: 40 }, { children: [_jsx(Button, __assign({ variant: "secondary", onClick: function () { return setIsUnmatchedHeadersModalOpen(false); }, w: 160, mr: 16 }, { children: "Assign Headers" }), void 0), _jsx(Button, __assign({ w: 83, variant: "primary", onClick: skipStep }, { children: "Skip" }), void 0)] }), void 0)] }), void 0) }), void 0));
122
123
  var isMatchStep = currentStepIndex === 1;
123
124
  var isReviewStep = currentStepIndex === 2;
124
- var leftButtonUI = (_jsx(Div, __assign({ w: 100 }, { children: currentStepIndex > 0 && (_jsx(Button, __assign({ variant: "secondary", onClick: goBack }, { children: "Go back" }), void 0)) }), void 0));
125
+ var leftButtonUI = (_jsx(Div, __assign({ w: 100 }, { children: currentStepIndex > 0 && !appResponse && (_jsx(Button, __assign({ variant: "secondary", onClick: goBack }, { children: "Go back" }), void 0)) }), void 0));
125
126
  var rightButtonUI = (_jsxs(Div, __assign({ w: 100 }, { children: [isMatchStep && (_jsx(Button, __assign({ variant: "primary", onClick: continueToNextStep }, { children: "Continue" }), void 0)), isReviewStep && (_jsx(Button, __assign({ variant: "primary", isDisabled: !isSpreadsheetReviewComplete, onClick: function () { return setIsSubmitModalOpen(true); } }, { children: "Submit" }), void 0))] }), void 0));
126
127
  return (_jsxs(_Fragment, { children: [unmatchedHeadersModalUI, submitModalUI, _jsxs(StepperWrapper, __assign({ pRelative: true, alignCenter: true, w100: true, h: 96, centered: true }, { children: [logoURL && _jsx(Logo, { src: logoURL, alt: "" }, void 0), _jsxs(Content, __assign({ spaceBetween: true, w: contentWidth }, { children: [leftButtonUI, _jsx(Div, __assign({ alignCenter: true }, { children: stepsUI }), void 0), rightButtonUI] }), void 0), _jsx(CloseIcon, __assign({ centered: true, clickable: true, onClick: onClose }, { children: closeIconCondensed }), void 0)] }), void 0)] }, void 0));
127
128
  };
@@ -139,5 +140,5 @@ var submitSvg = (_jsxs("svg", __assign({ width: 64, height: 64, fill: "none", xm
139
140
  } }, void 0), _jsx("rect", { x: 38.727, y: 44.871, width: 17.915, height: 35.878, rx: 2, transform: "rotate(131.582 38.727 44.87)", fill: "url(#b)", style: {
140
141
  mixBlendMode: "darken",
141
142
  } }, void 0), _jsxs("defs", { children: [_jsxs("linearGradient", __assign({ id: "a", x1: 18.672, y1: 47.198, x2: 37.603, y2: 58.473, gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#D0A617" }, void 0), _jsx("stop", { offset: 1, stopColor: "#FEE18F" }, void 0)] }), void 0), _jsxs("linearGradient", __assign({ id: "b", x1: 47.684, y1: 44.871, x2: 36.123, y2: 89.527, gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#6BEEFF" }, void 0), _jsx("stop", { offset: 1, stopColor: "#08CABE" }, void 0)] }), void 0)] }, void 0)] }), void 0));
142
- var errorIcon = (_jsxs("svg", __assign({ width: "64", height: "64", viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("circle", { cx: "32.0003", cy: "32", r: "29.3333", stroke: "#CF4520", strokeWidth: "5" }, void 0), _jsx("path", { d: "M32 18.6667V32", stroke: "#CF4520", strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round" }, void 0), _jsx("path", { d: "M32 42.6667V44", stroke: "#CF4520", strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round" }, void 0)] }), void 0));
143
+ var errorIcon = (_jsxs("svg", __assign({ width: "68", height: "68", viewBox: "0 0 68 68", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsxs("g", __assign({ clipPath: "url(#clip0_1052_34495)" }, { children: [_jsx("rect", { width: "68", height: "68", fill: "white" }, void 0), _jsx("g", __assign({ style: { mixBlendMode: "multiply" } }, { children: _jsx("path", { d: "M28.5668 8.05854C29.6943 6.10577 32.5129 6.10576 33.6403 8.05854L59.1466 52.2368C60.274 54.1895 58.8648 56.6305 56.6099 56.6305H5.59726C3.34239 56.6305 1.93309 54.1895 3.06053 52.2368L28.5668 8.05854Z", fill: "url(#paint0_linear_1052_34495)" }, void 0) }), void 0), _jsx("g", __assign({ style: { mixBlendMode: "multiply" } }, { children: _jsx("path", { d: "M34.4375 9.68867C35.5649 7.73589 38.3835 7.73589 39.511 9.68867L65.816 55.2503C66.9434 57.2031 65.5341 59.6441 63.2793 59.6441H10.6692C8.41432 59.6441 7.00502 57.2031 8.13246 55.2503L34.4375 9.68867Z", fill: "url(#paint1_linear_1052_34495)" }, void 0) }), void 0), _jsx("rect", { x: "29.0371", y: "21.2632", width: "6.43183", height: "21.3972", rx: "2.92916", fill: "#FFFDF8" }, void 0), _jsx("rect", { x: "29.0371", y: "44.7898", width: "6.43183", height: "5.61436", rx: "2.80718", fill: "#FFFDF8" }, void 0)] }), void 0), _jsxs("defs", { children: [_jsxs("linearGradient", __assign({ id: "paint0_linear_1052_34495", x1: "10.0099", y1: "28.8136", x2: "30.2646", y2: "54.4823", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#FD5C39" }, void 0), _jsx("stop", { offset: "1", stopColor: "#FFB869" }, void 0)] }), void 0), _jsxs("linearGradient", __assign({ id: "paint1_linear_1052_34495", x1: "18.8007", y1: "74.0811", x2: "85.2567", y2: "33.8684", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#E7C551" }, void 0), _jsx("stop", { offset: "1", stopColor: "#FEE18F" }, void 0)] }), void 0), _jsx("clipPath", __assign({ id: "clip0_1052_34495" }, { children: _jsx("rect", { width: "68", height: "68", fill: "white" }, void 0) }), void 0)] }, void 0)] }), void 0));
143
144
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -16,7 +16,7 @@ import { Div, Span } from "../styled/utils";
16
16
  import { useImporterContext } from "./ImporterContextProvider";
17
17
  export var TrialModeBanner = function () {
18
18
  var inTrialMode = useImporterContext().inTrialMode;
19
- return (_jsx(_Fragment, { children: inTrialMode && (_jsxs(Div, __assign({ bg: theme.colors.orange100, h: 80, dflex: true, alignCenter: true, justifyCenter: true }, { children: [_jsx(Div, __assign({ ml: 33, mr: 8 }, { children: exclamationPointIcon }), void 0), _jsx(Span, __assign({ mr: 16 }, { children: "You're currently in Test mode. Subscribe to a plan to deploy to your website." }), void 0), _jsx(Button, __assign({ w: 120, br: 8, variant: "secondary", onClick: function () {
19
+ return (_jsx(_Fragment, { children: inTrialMode && (_jsxs(Div, __assign({ bg: theme.colors.orange100, h: 80, dflex: true, alignCenter: true, justifyCenter: true }, { children: [_jsx(Div, __assign({ ml: 33, mr: 8 }, { children: exclamationPointIcon }), void 0), _jsx(Span, __assign({ mr: 16 }, { children: "You're currently in Trial mode. Subscribe to a plan to deploy to your website." }), void 0), _jsx(Button, __assign({ w: 120, br: 8, variant: "secondary", onClick: function () {
20
20
  window.location.href = "".concat(process.env.REACT_APP_API_BASE_URL, "/account/billing");
21
21
  } }, { children: "Select plan" }), void 0)] }), void 0)) }, void 0));
22
22
  };
@@ -36,7 +36,7 @@ var HeaderButtons = function () {
36
36
  var onClick = function () {
37
37
  setCurrentStepIndex(1);
38
38
  };
39
- return (_jsxs(HeaderButtonsWrapper, __assign({ dflex: true, spaceBetween: true, mb: 24 }, { children: [_jsx(Button, __assign({ w: 180, isSmall: true, variant: "secondary", onClick: resetImport }, { children: "No, Re-upload file" }), void 0), _jsx(Button, __assign({ w: 142, isSmall: true, onClick: onClick }, { children: "Yes, continue" }), void 0)] }), void 0));
39
+ return (_jsxs(HeaderButtonsWrapper, __assign({ dflex: true, spaceBetween: true, mb: 12 }, { children: [_jsx(Button, __assign({ w: 180, isSmall: true, variant: "secondary", onClick: resetImport }, { children: "No, Re-upload file" }), void 0), _jsx(Button, __assign({ w: 142, isSmall: true, onClick: onClick }, { children: "Yes, continue" }), void 0)] }), void 0));
40
40
  };
41
41
  var HeadersPreview = function () {
42
42
  var uploadedData = useImporterContext().uploadedData;
@@ -72,7 +72,7 @@ var HeadersPreview = function () {
72
72
  isRequired: false,
73
73
  };
74
74
  });
75
- return (_jsx(_Fragment, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true, pt: 40 }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Verify Your Column Headers" }), void 0), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: "File must contain column headers to proceed." }), void 0), _jsx(HeaderButtons, {}, void 0), _jsx(Div, __assign({ w100: true, centered: true, mt: 30, mb: 36 }, { children: _jsx(Spreadsheet, __assign({ rowWidth: getSpreadsheetRowWidth(readonlyFields, 6), isReadOnly: true, initialData: formattedData }, { fields: readonlyFields }, { highlightFirstRow: true }), void 0) }), void 0)] }), void 0) }, void 0));
75
+ return (_jsx(_Fragment, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true, pt: 40 }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Verify Your Column Headers" }), void 0), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: "File must contain column headers to proceed." }), void 0), _jsx(HeaderButtons, {}, void 0), _jsx(Div, __assign({ w100: true, centered: true, mb: 36 }, { children: _jsx(Spreadsheet, __assign({ rowWidth: getSpreadsheetRowWidth(readonlyFields, 6), isReadOnly: true, initialData: formattedData }, { fields: readonlyFields }, { highlightFirstRow: true }), void 0) }), void 0)] }), void 0) }, void 0));
76
76
  };
77
77
  export default HeadersPreview;
78
78
  var templateObject_1;