fuse-importer 0.24.0 → 0.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/lib/esm/Importer/ImporterWithContext.d.ts +1 -2
- package/lib/esm/Importer/ImporterWithContext.js +7 -10
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.d.ts +0 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +5 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/tableColumns.d.ts +0 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/tableColumns.js +8 -8
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcherContext.d.ts +2 -3
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/index.d.ts +0 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/index.js +3 -1
- package/lib/esm/Importer/Matcher/HeaderMatcher/index.d.ts +0 -1
- package/lib/esm/Importer/Matcher/HeaderMatcher/index.js +6 -1
- package/lib/esm/Importer/Matcher/HeaderMatcher/tableColumns.d.ts +0 -1
- package/lib/esm/Importer/Matcher/HeaderMatcher/tableColumns.js +5 -7
- package/lib/esm/Importer/Matcher/common/icons/index.d.ts +0 -1
- package/lib/esm/Importer/Matcher/common/index.d.ts +2 -3
- package/lib/esm/Importer/Matcher/common/index.js +9 -2
- package/lib/esm/Importer/PreviewFirstTime.d.ts +0 -1
- package/lib/esm/Importer/PreviewFirstTime.js +9 -8
- package/lib/esm/Importer/PreviewModeBanner.d.ts +0 -1
- package/lib/esm/Importer/PreviewModeBanner.js +5 -1
- package/lib/esm/Importer/Review/AppResponseModal.d.ts +0 -1
- package/lib/esm/Importer/Review/AppResponseModal.js +1 -1
- package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +3 -3
- package/lib/esm/Importer/Review/ReviewContextProvider.js +37 -4
- package/lib/esm/Importer/Review/ReviewWithContext.d.ts +0 -1
- package/lib/esm/Importer/Review/ReviewWithContext.js +18 -3
- package/lib/esm/Importer/Stepper/ConfirmCloseModal.d.ts +7 -0
- package/lib/esm/Importer/Stepper/ConfirmCloseModal.js +24 -0
- package/lib/esm/Importer/Stepper/Step.d.ts +0 -1
- package/lib/esm/Importer/Stepper/StepIndex.d.ts +0 -1
- package/lib/esm/Importer/Stepper/StepperSubmitModal.d.ts +1 -2
- package/lib/esm/Importer/Stepper/StepperSubmitModal.js +4 -2
- package/lib/esm/Importer/Stepper/UnmatchedHeadersModal.d.ts +1 -2
- package/lib/esm/Importer/Stepper/UnmatchedHeadersModal.js +9 -1
- package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.d.ts +1 -1
- package/lib/esm/Importer/Stepper/common/icons.d.ts +0 -1
- package/lib/esm/Importer/Stepper/index.d.ts +1 -2
- package/lib/esm/Importer/Stepper/index.js +13 -6
- package/lib/esm/Importer/TrialModeBanner.d.ts +0 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.d.ts +0 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +10 -9
- package/lib/esm/Importer/Uploader/DragAndDropImporter/backgrounds.d.ts +0 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/index.d.ts +0 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/index.js +9 -4
- package/lib/esm/Importer/Uploader/HeaderButtons.d.ts +0 -1
- package/lib/esm/Importer/Uploader/HeaderButtons.js +3 -1
- package/lib/esm/Importer/Uploader/HeadersPreview.d.ts +0 -1
- package/lib/esm/Importer/Uploader/HeadersPreview.js +8 -1
- package/lib/esm/Importer/Uploader/UploaderContextProvider.d.ts +2 -2
- package/lib/esm/Importer/common/AppLoading.d.ts +0 -1
- package/lib/esm/Importer/common/Footer.d.ts +0 -1
- package/lib/esm/Importer/common/ImporterFonts.d.ts +0 -1
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +10 -5
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +2 -2
- package/lib/esm/Importer/common/Spreadsheet/common/index.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/components/FieldHeader.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +8 -2
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.d.ts +10 -0
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +106 -0
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowNumbers.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/components/ValidationProgress.d.ts +0 -1
- package/lib/esm/Importer/common/Spreadsheet/components/fields/SpeadsheetAutocomplete.d.ts +2 -2
- package/lib/esm/Importer/common/Spreadsheet/components/fields/SpreadsheetInput.d.ts +1 -2
- package/lib/esm/Importer/common/Spreadsheet/components/fields/index.d.ts +0 -1
- package/lib/esm/Importer/common/Spreadsheet/components/fields/index.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/components/inputs/EnumInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +3 -3
- package/lib/esm/Importer/common/Spreadsheet/hooks.js +2 -2
- package/lib/esm/Importer/common/Spreadsheet/index.d.ts +4 -2
- package/lib/esm/Importer/common/Spreadsheet/index.js +2 -2
- package/lib/esm/Importer/common/Spreadsheet/styles.d.ts +1 -0
- package/lib/esm/Importer/common/Spreadsheet/styles.js +4 -3
- package/lib/esm/Importer/common/Spreadsheet/validation/index.d.ts +3 -3
- package/lib/esm/Importer/common/Spreadsheet/validation/index.js +2 -2
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.d.ts +2 -2
- package/lib/esm/Importer/common/icons/index.d.ts +0 -1
- package/lib/esm/Importer/common/index.d.ts +2 -2
- package/lib/esm/Importer/common/theme.d.ts +2 -2
- package/lib/esm/Importer/common/theme.js +2 -1
- package/lib/esm/Importer/common/utils.d.ts +1 -1
- package/lib/esm/Importer/common/utils.js +1 -1
- package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +7 -5
- package/lib/esm/Importer/contexts/ImporterContextProvider.js +10 -2
- package/lib/esm/Importer/data/index.d.ts +1 -1
- package/lib/esm/Importer/index.d.ts +1 -2
- package/lib/esm/api/index.d.ts +1 -1
- package/lib/esm/api/responseHandlers.d.ts +1 -1
- package/lib/esm/common/Modal.d.ts +1 -1
- package/lib/esm/common/Spinner.d.ts +0 -1
- package/lib/esm/common/Table/Pagination/icons.d.ts +1 -2
- package/lib/esm/common/Table/Pagination/index.d.ts +0 -1
- package/lib/esm/common/Table/TableDataProvider.d.ts +2 -2
- package/lib/esm/common/Table/TableDataProvider.js +1 -1
- package/lib/esm/common/Table/TableView/TableHeaders.d.ts +3 -3
- package/lib/esm/common/Table/TableView/TableHeaders.js +3 -1
- package/lib/esm/common/Table/TableView/TableRow.d.ts +2 -2
- package/lib/esm/common/Table/TableView/index.d.ts +4 -4
- package/lib/esm/common/Table/icons.d.ts +0 -1
- package/lib/esm/common/Table/index.d.ts +1 -2
- package/lib/esm/common/Toast.d.ts +0 -1
- package/lib/esm/common/TooltipProvider.d.ts +3 -2
- package/lib/esm/common/TooltipProvider.js +9 -5
- package/lib/esm/common/buttons.d.ts +20 -3
- package/lib/esm/common/buttons.js +25 -8
- package/lib/esm/common/icons/index.d.ts +0 -1
- package/lib/esm/common/index.d.ts +2 -3
- package/lib/esm/common/inputs/Autocomplete.d.ts +4 -4
- package/lib/esm/common/inputs/Autocomplete.js +5 -3
- package/lib/esm/common/inputs/Checkbox.d.ts +9 -0
- package/lib/esm/common/inputs/Checkbox.js +50 -0
- package/lib/esm/common/inputs/SelectMenu.d.ts +1 -2
- package/lib/esm/common/inputs/TextInput.d.ts +2 -2
- package/lib/esm/common/inputs/index.d.ts +1 -0
- package/lib/esm/common/inputs/index.js +1 -0
- package/lib/esm/common/inputs/tooltip.d.ts +0 -1
- package/lib/esm/common/logo.d.ts +0 -1
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +86 -15
- package/lib/esm/locales/de.d.ts +94 -0
- package/lib/esm/locales/de.js +94 -0
- package/lib/esm/locales/en.d.ts +94 -0
- package/lib/esm/locales/en.js +94 -0
- package/lib/esm/locales/es.d.ts +94 -0
- package/lib/esm/locales/es.js +94 -0
- package/lib/esm/locales/fr.d.ts +94 -0
- package/lib/esm/locales/fr.js +94 -0
- package/lib/esm/locales/index.d.ts +4 -0
- package/lib/esm/locales/index.js +4 -0
- package/lib/esm/styled/theme/index.d.ts +1 -1
- package/lib/esm/styled/utils.d.ts +9 -9
- package/lib/esm/types.d.ts +24 -22
- package/lib/main.js +171 -1
- package/lib/main.js.LICENSE.txt +1 -3
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -94,8 +94,8 @@ If you don’t have a Importer yet, you can go over [Create Your First Importer]
|
|
|
94
94
|
></script>
|
|
95
95
|
<script type="text/javascript">
|
|
96
96
|
const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
|
|
97
|
-
const
|
|
98
|
-
const importer = new FuseImporter(organizationApiKey,
|
|
97
|
+
const importerId = "YOUR IMPORTER ID";
|
|
98
|
+
const importer = new FuseImporter(organizationApiKey, importerId);
|
|
99
99
|
|
|
100
100
|
importer.onValidateRecord = async (record) => {
|
|
101
101
|
// return no frontend validation errors
|
|
@@ -113,7 +113,7 @@ If you don’t have a Importer yet, you can go over [Create Your First Importer]
|
|
|
113
113
|
window.showFuseImporter = () => {
|
|
114
114
|
if (
|
|
115
115
|
organizationApiKey.indexOf("YOUR") !== -1 ||
|
|
116
|
-
|
|
116
|
+
importerId.indexOf("YOUR") !== -1
|
|
117
117
|
) {
|
|
118
118
|
window.confirm(
|
|
119
119
|
"You need to configure your organization api key and Importer id."
|
|
@@ -144,8 +144,8 @@ If you don’t have a Importer yet, you can go over [Create Your First Importer]
|
|
|
144
144
|
import FuseImporter from "fuse-importer";
|
|
145
145
|
|
|
146
146
|
const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
|
|
147
|
-
const
|
|
148
|
-
const importer = new FuseImporter(organizationApiKey,
|
|
147
|
+
const importerId = "YOUR IMPORTER ID";
|
|
148
|
+
const importer = new FuseImporter(organizationApiKey, importerId);
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
### FuseImporter Hooks
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare type LayoutProps = {
|
|
1
|
+
type LayoutProps = {
|
|
3
2
|
zIndex: number;
|
|
4
3
|
};
|
|
5
4
|
export declare const Layout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../styled").CSSProps & LayoutProps, never>;
|
|
@@ -30,17 +30,18 @@ import { ReviewContextProvider } from "./Review/ReviewContextProvider";
|
|
|
30
30
|
import { Stepper } from "./Stepper/index";
|
|
31
31
|
import { TrialModeBanner } from "./TrialModeBanner";
|
|
32
32
|
import Uploader from "./Uploader";
|
|
33
|
+
import { useTranslation } from "react-i18next";
|
|
33
34
|
var steps = [
|
|
34
35
|
{
|
|
35
|
-
label: "
|
|
36
|
+
label: "general:steps.upload",
|
|
36
37
|
component: _jsx(Uploader, {}),
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
|
-
label: "
|
|
40
|
+
label: "general:steps.match",
|
|
40
41
|
component: _jsx(Matcher, {}),
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
|
-
label: "
|
|
44
|
+
label: "general:steps.review",
|
|
44
45
|
component: _jsx(Review, {}),
|
|
45
46
|
},
|
|
46
47
|
];
|
|
@@ -52,18 +53,14 @@ var Content = styled(Div)(function (_a) {
|
|
|
52
53
|
export var ImporterWithContext = function () {
|
|
53
54
|
var _a = useImporterContext(), inTrialMode = _a.inTrialMode, currentStepIndex = _a.currentStepIndex, matcherSubstep = _a.matcherSubstep, theme = _a.theme, logoURL = _a.logoURL, previewFirstTime = _a.previewFirstTime, _b = _a.importerOptions, zIndex = _b.zIndex, loadingComponent = _b.loadingComponent, previewMode = _b.previewMode;
|
|
54
55
|
var layoutRef = useRef(null);
|
|
56
|
+
var t = useTranslation().t;
|
|
55
57
|
useEffect(function () {
|
|
56
58
|
layoutRef.current.scrollTo(0, 0);
|
|
57
59
|
}, [currentStepIndex, matcherSubstep]);
|
|
58
60
|
function renderContent() {
|
|
59
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Div, { children: [previewMode && _jsx(PreviewModeBanner, {}), !previewMode && _jsx(TrialModeBanner, {}), _jsx(Stepper, { stepLabels: steps.map(function (step) { return step.label; }), logoURL: logoURL })] }), _jsx(Content, { children: steps[currentStepIndex].component }), inTrialMode && (_jsx(Content, { children: _jsx(Footer, {}) }))] }));
|
|
60
|
-
}
|
|
61
|
-
function renderPreviewFirstTime() {
|
|
62
|
-
return _jsx(PreviewFirstTime, {});
|
|
61
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Div, { children: [previewMode && _jsx(PreviewModeBanner, {}), !previewMode && _jsx(TrialModeBanner, {}), _jsx(Stepper, { stepLabels: steps.map(function (step) { return t(step.label); }), logoURL: logoURL })] }), _jsx(Content, { children: steps[currentStepIndex].component }), inTrialMode && (_jsx(Content, { children: _jsx(Footer, {}) }))] }));
|
|
63
62
|
}
|
|
64
63
|
var shouldShowPreviewFirstTime = previewFirstTime && previewMode;
|
|
65
|
-
return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(Toast, {}), _jsx(GlobalStyle, {}), _jsx(ImporterFonts, {}), _jsx(ReviewContextProvider, { children: _jsx(Layout, __assign({ zIndex: zIndex, ref: layoutRef }, { children: shouldShowPreviewFirstTime
|
|
66
|
-
? renderPreviewFirstTime()
|
|
67
|
-
: renderContent() })) })] })));
|
|
64
|
+
return (_jsxs(ThemeProvider, __assign({ theme: theme }, { children: [_jsx(Toast, {}), _jsx(GlobalStyle, {}), _jsx(ImporterFonts, {}), _jsx(ReviewContextProvider, { children: _jsx(Layout, __assign({ zIndex: zIndex, ref: layoutRef }, { children: shouldShowPreviewFirstTime ? _jsx(PreviewFirstTime, {}) : renderContent() })) })] })));
|
|
68
65
|
};
|
|
69
66
|
var templateObject_1, templateObject_2;
|
|
@@ -21,9 +21,11 @@ import { MAX_VISIBLE_ROWS } from "../../common";
|
|
|
21
21
|
import { MatcherStatus } from "../../common/types";
|
|
22
22
|
import { EnumFieldMatcherContextProvider } from "../EnumFieldMatcherContext";
|
|
23
23
|
import { tableColumns } from "./tableColumns";
|
|
24
|
+
import { useTranslation } from "react-i18next";
|
|
24
25
|
export var EnumFieldMatcher = function (_a) {
|
|
25
26
|
var _b;
|
|
26
27
|
var templateHeaderLabel = _a.templateHeaderLabel;
|
|
28
|
+
var t = useTranslation("match").t;
|
|
27
29
|
var _c = useImporterContext(), enumFieldValueMatchings = _c.enumFieldValueMatchings, templateHeaders = _c.templateHeaders;
|
|
28
30
|
var isRequired = (_b = templateHeaders.find(function (th) { return th.label === templateHeaderLabel; })) === null || _b === void 0 ? void 0 : _b.required;
|
|
29
31
|
var enumFieldValueMatching = enumFieldValueMatchings[templateHeaderLabel];
|
|
@@ -50,5 +52,7 @@ export var EnumFieldMatcher = function (_a) {
|
|
|
50
52
|
dataCount: data.length,
|
|
51
53
|
maxVisibleRows: MAX_VISIBLE_ROWS,
|
|
52
54
|
});
|
|
53
|
-
return (_jsxs(Div, { children: [_jsx(Div, __assign({ h5: true, mb: 16 }, { children: "
|
|
55
|
+
return (_jsxs(Div, { children: [_jsx(Div, __assign({ h5: true, mb: 16 }, { children: t("columns.values_for_the_column", {
|
|
56
|
+
column: "".concat(templateHeaderLabel).concat(isRequired ? "*" : ""),
|
|
57
|
+
}) })), _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 }) })) }))] }));
|
|
54
58
|
};
|
|
@@ -13,12 +13,13 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
import { Autocomplete } from "../../../../common/inputs/Autocomplete";
|
|
14
14
|
import { Div } from "../../../../styled/utils";
|
|
15
15
|
import { useImporterContext } from "../../../contexts/ImporterContextProvider";
|
|
16
|
-
import {
|
|
16
|
+
import { MatchedIndicatorUI, UnmatchedIndicatorUI } from "../../common";
|
|
17
17
|
import { MatcherStatus } from "../../common/types";
|
|
18
18
|
import { useEnumFieldMatcherContext } from "../EnumFieldMatcherContext";
|
|
19
|
+
import { useTranslation } from "react-i18next";
|
|
19
20
|
export var tableColumns = [
|
|
20
21
|
{
|
|
21
|
-
header: "
|
|
22
|
+
header: "match:columns.your_columns",
|
|
22
23
|
width: 1,
|
|
23
24
|
Content: function (_a) {
|
|
24
25
|
var uploadedDataValue = _a.uploadedDataValue;
|
|
@@ -26,11 +27,12 @@ export var tableColumns = [
|
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
|
-
header: "
|
|
30
|
+
header: "match:columns.our_columns",
|
|
30
31
|
width: 1,
|
|
31
32
|
Content: function (_a) {
|
|
32
33
|
var _b;
|
|
33
34
|
var uploadedDataValue = _a.uploadedDataValue, uploadedDataValueMatching = _a.uploadedDataValueMatching;
|
|
35
|
+
var t = useTranslation("match").t;
|
|
34
36
|
var _c = useImporterContext(), templateHeaders = _c.templateHeaders, enumFieldValueMatchings = _c.enumFieldValueMatchings, setEnumFieldValueMatchings = _c.setEnumFieldValueMatchings;
|
|
35
37
|
var templateHeaderLabel = useEnumFieldMatcherContext().templateHeaderLabel;
|
|
36
38
|
var valueOptions = (_b = templateHeaders.find(function (th) { return th.label === templateHeaderLabel; })) === null || _b === void 0 ? void 0 : _b.values;
|
|
@@ -39,20 +41,18 @@ export var tableColumns = [
|
|
|
39
41
|
newEnumFieldValueMatchings[templateHeaderLabel][uploadedDataValue] = selected;
|
|
40
42
|
setEnumFieldValueMatchings(newEnumFieldValueMatchings);
|
|
41
43
|
};
|
|
42
|
-
return (_jsx(Div, __assign({ w100: true }, { children: _jsx(Autocomplete, { w: "90%", placeholder: "
|
|
44
|
+
return (_jsx(Div, __assign({ w100: true }, { children: _jsx(Autocomplete, { w: "90%", placeholder: t("columns.placeholder"), onChange: onChange, value: uploadedDataValueMatching, options: valueOptions.map(function (vo) { return ({
|
|
43
45
|
value: vo,
|
|
44
46
|
label: vo,
|
|
45
47
|
}); }) }) })));
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
|
-
header: "
|
|
51
|
+
header: "match:columns.status",
|
|
50
52
|
width: 1,
|
|
51
53
|
Content: function (_a) {
|
|
52
54
|
var status = _a.status;
|
|
53
|
-
return (_jsx(_Fragment, { children: status === MatcherStatus.matched
|
|
54
|
-
? matchedIndicatorUI
|
|
55
|
-
: unmatchedIndicatorUI }));
|
|
55
|
+
return (_jsx(_Fragment, { children: status === MatcherStatus.matched ? (_jsx(MatchedIndicatorUI, {})) : (_jsx(UnmatchedIndicatorUI, {})) }));
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
];
|
|
@@ -14,9 +14,11 @@ import { Div } from "../../../styled/utils";
|
|
|
14
14
|
import { contentWidth } from "../../common/index";
|
|
15
15
|
import { useImporterContext } from "../../contexts/ImporterContextProvider";
|
|
16
16
|
import { EnumFieldMatcher } from "./EnumFieldMatcher";
|
|
17
|
+
import { useTranslation } from "react-i18next";
|
|
17
18
|
export var EnumFieldsMatchers = function () {
|
|
19
|
+
var t = useTranslation("match").t;
|
|
18
20
|
var enumFieldValueMatchings = useImporterContext().enumFieldValueMatchings;
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: t("title") })), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true, maxw: 928 }, { children: t("enum_description") }))] })), _jsx(Div, __assign({ flexColumn: true, alignCenter: true, mb: 20, centered: true }, { children: Object.keys(enumFieldValueMatchings).map(function (templateHeaderLabel, index) {
|
|
20
22
|
return (_jsx(Div, __assign({ w: contentWidth }, { children: _jsx(EnumFieldMatcher, { templateHeaderLabel: templateHeaderLabel }) }), index));
|
|
21
23
|
}) }))] }));
|
|
22
24
|
};
|
|
@@ -24,8 +24,10 @@ import { useImporterContext } from "../../contexts/ImporterContextProvider";
|
|
|
24
24
|
import { MAX_VISIBLE_ROWS } from "../common";
|
|
25
25
|
import { MatcherStatus } from "../common/types";
|
|
26
26
|
import { tableColumns } from "./tableColumns";
|
|
27
|
+
import { useTranslation } from "react-i18next";
|
|
27
28
|
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"])));
|
|
28
29
|
var HeaderMatcher = function () {
|
|
30
|
+
var t = useTranslation("match").t;
|
|
29
31
|
var _a = useImporterContext(), templateHeaders = _a.templateHeaders, templateHeaderMatchings = _a.templateHeaderMatchings;
|
|
30
32
|
var templateHeaderLabels = Object.keys(templateHeaderMatchings);
|
|
31
33
|
var numberOfMatchedHeaders = templateHeaderLabels.filter(function (templateHeaderLabel) { return templateHeaderMatchings[templateHeaderLabel]; }).length;
|
|
@@ -52,7 +54,10 @@ var HeaderMatcher = function () {
|
|
|
52
54
|
dataCount: data.length,
|
|
53
55
|
maxVisibleRows: MAX_VISIBLE_ROWS,
|
|
54
56
|
});
|
|
55
|
-
return (_jsx(_Fragment, { children: _jsx(Div, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "
|
|
57
|
+
return (_jsx(_Fragment, { children: _jsx(Div, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: t("title") })), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: t("description", {
|
|
58
|
+
numberOfMatchedHeaders: numberOfMatchedHeaders,
|
|
59
|
+
totalNumberOfHeaders: templateHeaders.length,
|
|
60
|
+
}) })), _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 }) })) }))] })) }) }));
|
|
56
61
|
};
|
|
57
62
|
export { HeaderMatcher };
|
|
58
63
|
var templateObject_1;
|
|
@@ -13,11 +13,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
import { Autocomplete } from "../../../common/inputs/Autocomplete";
|
|
14
14
|
import { Div } from "../../../styled/utils";
|
|
15
15
|
import { useImporterContext } from "../../contexts/ImporterContextProvider";
|
|
16
|
-
import {
|
|
16
|
+
import { MatchedIndicatorUI, UnmatchedIndicatorUI } from "../common/index";
|
|
17
17
|
import { MatcherStatus } from "../common/types";
|
|
18
18
|
export var tableColumns = [
|
|
19
19
|
{
|
|
20
|
-
header: "
|
|
20
|
+
header: "match:columns.your_columns",
|
|
21
21
|
width: 1,
|
|
22
22
|
Content: function (_a) {
|
|
23
23
|
var yourColumns = _a.yourColumns, ourColumns = _a.ourColumns;
|
|
@@ -34,7 +34,7 @@ export var tableColumns = [
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
header: "
|
|
37
|
+
header: "match:columns.our_columns",
|
|
38
38
|
width: 1,
|
|
39
39
|
Content: function (_a) {
|
|
40
40
|
var _b;
|
|
@@ -45,13 +45,11 @@ export var tableColumns = [
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
header: "
|
|
48
|
+
header: "match:columns.status",
|
|
49
49
|
width: 1,
|
|
50
50
|
Content: function (_a) {
|
|
51
51
|
var status = _a.status;
|
|
52
|
-
return (_jsx(_Fragment, { children: status === MatcherStatus.matched
|
|
53
|
-
? matchedIndicatorUI
|
|
54
|
-
: unmatchedIndicatorUI }));
|
|
52
|
+
return (_jsx(_Fragment, { children: status === MatcherStatus.matched ? (_jsx(MatchedIndicatorUI, {})) : (_jsx(UnmatchedIndicatorUI, {})) }));
|
|
55
53
|
},
|
|
56
54
|
},
|
|
57
55
|
];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const MAX_VISIBLE_ROWS = 5;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const MatchedIndicatorUI: () => JSX.Element;
|
|
3
|
+
export declare const UnmatchedIndicatorUI: () => JSX.Element;
|
|
@@ -16,6 +16,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import styled, { css } from "styled-components";
|
|
18
18
|
import { colors, Div } from "../../../styled";
|
|
19
|
+
import { useTranslation } from "react-i18next";
|
|
19
20
|
export var MAX_VISIBLE_ROWS = 5;
|
|
20
21
|
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 }) })));
|
|
21
22
|
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 }) })));
|
|
@@ -27,6 +28,12 @@ var UnmatchedIndicator = styled(Wrapper)(function (_a) {
|
|
|
27
28
|
var _b = _a.theme, colors = _b.colors, c = _b.css;
|
|
28
29
|
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
|
});
|
|
30
|
-
export var
|
|
31
|
-
|
|
31
|
+
export var MatchedIndicatorUI = function () {
|
|
32
|
+
var t = useTranslation("match").t;
|
|
33
|
+
return (_jsxs(Wrapper, { children: [_jsx(Div, __assign({ centered: true }, { children: successIcon })), _jsx(Div, __assign({ ml: 8 }, { children: t("columns.matched") }))] }));
|
|
34
|
+
};
|
|
35
|
+
export var UnmatchedIndicatorUI = function () {
|
|
36
|
+
var t = useTranslation("match").t;
|
|
37
|
+
return (_jsxs(UnmatchedIndicator, { children: [_jsx(Div, __assign({ centered: true }, { children: warningIcon })), _jsx(Div, __assign({ ml: 8 }, { children: t("columns.unmatched") }))] }));
|
|
38
|
+
};
|
|
32
39
|
var templateObject_1, templateObject_2;
|
|
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
28
28
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
29
|
function step(op) {
|
|
30
30
|
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (_) try {
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
32
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
33
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
34
|
switch (op[0]) {
|
|
@@ -56,14 +56,14 @@ import { spreedSheetIcon } from "../common/Table/icons";
|
|
|
56
56
|
import styled, { css } from "styled-components";
|
|
57
57
|
import { Button } from "../common";
|
|
58
58
|
import { useImporterContext } from "./contexts/ImporterContextProvider";
|
|
59
|
+
import { useTranslation } from "react-i18next";
|
|
59
60
|
var Content = styled(Div)(function (_a) {
|
|
60
61
|
var _b = _a.theme, colors = _b.colors, c = _b.css;
|
|
61
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n
|
|
62
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n padding: 0 40px;\n align-items: stretch;\n height: 100vh;\n justify-content: space-around;\n "], ["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n padding: 0 40px;\n align-items: stretch;\n height: 100vh;\n justify-content: space-around;\n "])), colors.backgroundInterface);
|
|
62
63
|
});
|
|
63
|
-
var Wrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display:
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var BottomSection = styled(Div)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n"], ["\n display: flex;\n justify-content: center;\n"])));
|
|
64
|
+
var Wrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n justify-content: center;\n flex: 1;\n\n @media all and ", " {\n flex-direction: column !important;\n }\n"], ["\n display: flex;\n gap: 10px;\n justify-content: center;\n flex: 1;\n\n @media all and ", " {\n flex-direction: column !important;\n }\n"])), theme.media.mobile);
|
|
65
|
+
var Block = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 40px;\n"], ["\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0px 40px;\n"])));
|
|
66
|
+
var BottomSection = styled(Div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n padding: 40px;\n"], ["\n display: flex;\n justify-content: center;\n padding: 40px;\n"])));
|
|
67
67
|
export var PreviewFirstTime = function () {
|
|
68
68
|
var _a = useImporterContext(), templateSlug = _a.templateSlug, fuseApi = _a.fuseApi, setPreviewFirstTime = _a.setPreviewFirstTime;
|
|
69
69
|
var downloadCsvExample = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -73,8 +73,9 @@ export var PreviewFirstTime = function () {
|
|
|
73
73
|
return [2 /*return*/];
|
|
74
74
|
});
|
|
75
75
|
}); };
|
|
76
|
-
|
|
76
|
+
var t = useTranslation("preview").t;
|
|
77
|
+
return (_jsx(_Fragment, { children: _jsxs(Content, __assign({ justifyCenter: true, alignCenter: true }, { children: [_jsxs(Wrapper, { children: [_jsx(Block, __assign({ mt: 66 }, { children: _jsx(Div, __assign({ maxw: 448, w100: true, alignCenter: true }, { children: spreedSheetIcon })) })), _jsx(Block, { children: _jsxs(Div, __assign({ maxw: 448, w100: true }, { children: [_jsx(Div, __assign({ h2: true }, { children: t("title") })), _jsx(Div, __assign({ mt: 16, body1: true }, { children: t("description") })), _jsxs(Button, __assign({ mt: 40, w: 189, onClick: downloadCsvExample }, { children: [downloadIcon, " ", _jsx(Span, __assign({ ml: 6 }, { children: t("download") }))] })), _jsxs(Div, __assign({ mt: 40, dInline: true }, { children: [_jsx(Span, __assign({ buttonTextSmall: true }, { children: t("note.title") })), _jsx(Span, __assign({ helperText: true, ml: 6 }, { children: t("note.description") }))] }))] })) })] }), _jsx(BottomSection, { children: poweredByFlatirons })] })) }));
|
|
77
78
|
};
|
|
78
79
|
var downloadIcon = (_jsxs("svg", __assign({ width: "16", height: "17", viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M1.66665 9.00008C1.33331 8.00008 1.33331 7.00008 1.33331 6.30432C1.33331 3.98554 3.40963 1.66675 5.97089 1.66675C7.68745 1.66675 9.18618 2.59936 9.98804 3.98554H10.6085C12.5294 3.98554 14.3333 5.33341 14.3333 7.00008C14.3333 7.66675 14.3333 8.33341 14 9.00008", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M4.94446 13.2209L7.66668 15.8331L10.3889 13.2209", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7.66669 15.1462L7.66669 7.75005", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })] })));
|
|
79
80
|
var poweredByFlatirons = (_jsxs("svg", __assign({ width: "222", height: "22", viewBox: "0 0 222 22", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M3.47895 15V6.6H6.41895C7.07495 6.6 7.61895 6.712 8.05095 6.936C8.48295 7.152 8.80295 7.452 9.01095 7.836C9.22695 8.212 9.33495 8.64 9.33495 9.12C9.33495 9.576 9.23095 9.996 9.02295 10.38C8.82295 10.756 8.50695 11.056 8.07495 11.28C7.64295 11.504 7.09095 11.616 6.41895 11.616H4.75095V15H3.47895ZM4.75095 10.572H6.35895C6.95895 10.572 7.38695 10.444 7.64295 10.188C7.90695 9.924 8.03895 9.568 8.03895 9.12C8.03895 8.656 7.90695 8.296 7.64295 8.04C7.38695 7.776 6.95895 7.644 6.35895 7.644H4.75095V10.572ZM13.0001 15.144C12.4321 15.144 11.9201 15.016 11.4641 14.76C11.0161 14.496 10.6601 14.132 10.3961 13.668C10.1321 13.196 10.0001 12.648 10.0001 12.024C10.0001 11.4 10.1321 10.856 10.3961 10.392C10.6681 9.92 11.0321 9.556 11.4881 9.3C11.9441 9.036 12.4521 8.904 13.0121 8.904C13.5801 8.904 14.0881 9.036 14.5361 9.3C14.9921 9.556 15.3521 9.92 15.6161 10.392C15.8881 10.856 16.0241 11.4 16.0241 12.024C16.0241 12.648 15.8881 13.196 15.6161 13.668C15.3521 14.132 14.9921 14.496 14.5361 14.76C14.0801 15.016 13.5681 15.144 13.0001 15.144ZM13.0001 14.052C13.3041 14.052 13.5841 13.976 13.8401 13.824C14.1041 13.672 14.3161 13.448 14.4761 13.152C14.6361 12.848 14.7161 12.472 14.7161 12.024C14.7161 11.576 14.6361 11.204 14.4761 10.908C14.3241 10.604 14.1161 10.376 13.8521 10.224C13.5961 10.072 13.3161 9.996 13.0121 9.996C12.7081 9.996 12.4241 10.072 12.1601 10.224C11.9041 10.376 11.6961 10.604 11.5361 10.908C11.3761 11.204 11.2961 11.576 11.2961 12.024C11.2961 12.472 11.3761 12.848 11.5361 13.152C11.6961 13.448 11.9041 13.672 12.1601 13.824C12.4161 13.976 12.6961 14.052 13.0001 14.052ZM18.365 15L16.613 9.048H17.885L19.037 13.536L20.333 9.048H21.749L23.045 13.536L24.197 9.048H25.469L23.717 15H22.409L21.041 10.32L19.673 15H18.365ZM29.0782 15.144C28.4942 15.144 27.9742 15.016 27.5182 14.76C27.0702 14.496 26.7182 14.132 26.4622 13.668C26.2062 13.204 26.0782 12.664 26.0782 12.048C26.0782 11.424 26.2022 10.876 26.4502 10.404C26.7062 9.932 27.0582 9.564 27.5062 9.3C27.9622 9.036 28.4902 8.904 29.0902 8.904C29.6742 8.904 30.1822 9.036 30.6142 9.3C31.0462 9.556 31.3822 9.9 31.6222 10.332C31.8622 10.764 31.9822 11.24 31.9822 11.76C31.9822 11.84 31.9782 11.928 31.9702 12.024C31.9702 12.112 31.9662 12.212 31.9582 12.324H27.3262C27.3662 12.9 27.5542 13.34 27.8902 13.644C28.2342 13.94 28.6302 14.088 29.0782 14.088C29.4382 14.088 29.7382 14.008 29.9782 13.848C30.2262 13.68 30.4102 13.456 30.5302 13.176H31.8022C31.6422 13.736 31.3222 14.204 30.8422 14.58C30.3702 14.956 29.7822 15.144 29.0782 15.144ZM29.0782 9.948C28.6542 9.948 28.2782 10.076 27.9502 10.332C27.6222 10.58 27.4222 10.956 27.3502 11.46H30.7102C30.6862 10.996 30.5222 10.628 30.2182 10.356C29.9142 10.084 29.5342 9.948 29.0782 9.948ZM33.302 15V9.048H34.442L34.55 10.176C34.758 9.784 35.046 9.476 35.414 9.252C35.79 9.02 36.242 8.904 36.77 8.904V10.236H36.422C36.07 10.236 35.754 10.296 35.474 10.416C35.202 10.528 34.982 10.724 34.814 11.004C34.654 11.276 34.574 11.656 34.574 12.144V15H33.302ZM40.4806 15.144C39.8966 15.144 39.3766 15.016 38.9206 14.76C38.4726 14.496 38.1206 14.132 37.8646 13.668C37.6086 13.204 37.4806 12.664 37.4806 12.048C37.4806 11.424 37.6046 10.876 37.8526 10.404C38.1086 9.932 38.4606 9.564 38.9086 9.3C39.3646 9.036 39.8926 8.904 40.4926 8.904C41.0766 8.904 41.5846 9.036 42.0166 9.3C42.4486 9.556 42.7846 9.9 43.0246 10.332C43.2646 10.764 43.3846 11.24 43.3846 11.76C43.3846 11.84 43.3806 11.928 43.3726 12.024C43.3726 12.112 43.3686 12.212 43.3606 12.324H38.7286C38.7686 12.9 38.9566 13.34 39.2926 13.644C39.6366 13.94 40.0326 14.088 40.4806 14.088C40.8406 14.088 41.1406 14.008 41.3806 13.848C41.6286 13.68 41.8126 13.456 41.9326 13.176H43.2046C43.0446 13.736 42.7246 14.204 42.2446 14.58C41.7726 14.956 41.1846 15.144 40.4806 15.144ZM40.4806 9.948C40.0566 9.948 39.6806 10.076 39.3526 10.332C39.0246 10.58 38.8246 10.956 38.7526 11.46H42.1126C42.0886 10.996 41.9246 10.628 41.6206 10.356C41.3166 10.084 40.9366 9.948 40.4806 9.948ZM47.4164 15.144C46.8404 15.144 46.3324 15.008 45.8924 14.736C45.4524 14.464 45.1084 14.092 44.8604 13.62C44.6124 13.148 44.4884 12.612 44.4884 12.012C44.4884 11.412 44.6124 10.88 44.8604 10.416C45.1084 9.944 45.4524 9.576 45.8924 9.312C46.3404 9.04 46.8524 8.904 47.4284 8.904C47.9004 8.904 48.3124 8.996 48.6644 9.18C49.0244 9.364 49.3044 9.624 49.5044 9.96V6.36H50.7764V15H49.6364L49.5044 14.076C49.3124 14.356 49.0484 14.604 48.7124 14.82C48.3764 15.036 47.9444 15.144 47.4164 15.144ZM47.6444 14.04C48.1884 14.04 48.6324 13.852 48.9764 13.476C49.3284 13.1 49.5044 12.616 49.5044 12.024C49.5044 11.424 49.3284 10.94 48.9764 10.572C48.6324 10.196 48.1884 10.008 47.6444 10.008C47.1004 10.008 46.6524 10.196 46.3004 10.572C45.9484 10.94 45.7724 11.424 45.7724 12.024C45.7724 12.416 45.8524 12.764 46.0124 13.068C46.1724 13.372 46.3924 13.612 46.6724 13.788C46.9604 13.956 47.2844 14.04 47.6444 14.04ZM58.7516 15.144C58.2876 15.144 57.8756 15.052 57.5156 14.868C57.1636 14.684 56.8836 14.424 56.6756 14.088L56.5436 15H55.4036V6.36H56.6756V9.972C56.8676 9.692 57.1316 9.444 57.4676 9.228C57.8036 9.012 58.2356 8.904 58.7636 8.904C59.3396 8.904 59.8476 9.04 60.2876 9.312C60.7276 9.584 61.0716 9.956 61.3196 10.428C61.5756 10.9 61.7036 11.436 61.7036 12.036C61.7036 12.636 61.5756 13.172 61.3196 13.644C61.0716 14.108 60.7276 14.476 60.2876 14.748C59.8476 15.012 59.3356 15.144 58.7516 15.144ZM58.5356 14.04C59.0796 14.04 59.5276 13.856 59.8796 13.488C60.2316 13.112 60.4076 12.624 60.4076 12.024C60.4076 11.632 60.3276 11.284 60.1676 10.98C60.0076 10.676 59.7876 10.44 59.5076 10.272C59.2276 10.096 58.9036 10.008 58.5356 10.008C57.9916 10.008 57.5436 10.196 57.1916 10.572C56.8476 10.948 56.6756 11.432 56.6756 12.024C56.6756 12.624 56.8476 13.112 57.1916 13.488C57.5436 13.856 57.9916 14.04 58.5356 14.04ZM63.2715 17.64L64.6995 14.508H64.3515L61.9995 9.048H63.3795L65.2035 13.452L67.1115 9.048H68.4555L64.6155 17.64H63.2715Z", fill: "#7F7F7F" }), _jsx("path", { d: "M78.5716 19L87.8742 19C88.1922 19 88.4912 18.8488 88.6796 18.5927L93.8355 11.5863C94.0926 11.2368 94.0951 10.7614 93.8416 10.4093L88.507 3L78.1581 18.2188C77.9324 18.5508 78.1702 19 78.5716 19Z", fill: "#FD395E" }), _jsx("path", { d: "M78.1581 3.78122L83.067 11L88.507 3.00006L78.5716 3.00006C78.1702 3.00006 77.9324 3.44926 78.1581 3.78122Z", fill: "url(#paint0_linear_4260_84209)" }), _jsx("path", { d: "M85.3068 3.00006L83.0668 11L88.5068 3.00006L85.3068 3.00006Z", fill: "#8A0E25" }), _jsx("path", { d: "M101.421 14.6799H103.759V11.1474H107.141V9.48804H103.759V7.56465H107.292V5.90525H101.421V14.6799Z", fill: "#1C1C1C" }), _jsx("path", { d: "M109.978 14.6799H115.937V12.9451H112.316V5.90525H109.978V14.6799Z", fill: "#1C1C1C" }), _jsx("path", { d: "M117.755 14.6799H120.131L120.823 12.8068H124.116L124.77 14.6799H127.335L123.953 5.90525H121.087L117.755 14.6799ZM123.563 11.1474H121.363L122.495 7.7155H122.52L123.563 11.1474Z", fill: "#1C1C1C" }), _jsx("path", { d: "M130.414 14.6799H132.752V7.64007H134.914V5.90525H128.252V7.64007H130.414V14.6799Z", fill: "#1C1C1C" }), _jsx("path", { d: "M137.512 14.6799H139.851V5.90525H137.512V14.6799Z", fill: "#1C1C1C" }), _jsx("path", { d: "M143.044 14.6799H145.382V11.2103H145.872C146.74 11.2103 147.041 11.5874 147.519 13.096L148.022 14.6799H150.461L149.606 12.2914C149.166 11.2229 149.115 10.5566 148.361 10.3555V10.3303C149.493 10.0663 150.046 9.2869 150.046 8.11778C150.046 6.60924 148.776 5.90525 147.217 5.90525H143.044V14.6799ZM145.382 7.56465H145.998C146.89 7.56465 147.708 7.7155 147.708 8.53263C147.708 9.52575 146.752 9.5509 145.998 9.5509H145.382V7.56465Z", fill: "#1C1C1C" }), _jsx("path", { d: "M152.673 10.2926C152.673 13.0834 154.207 14.8308 157.073 14.8308C159.939 14.8308 161.473 13.0834 161.473 10.2926C161.473 7.47665 159.964 5.75439 157.073 5.75439C154.182 5.75439 152.673 7.47665 152.673 10.2926ZM155.087 10.2926C155.087 8.77148 155.652 7.48922 157.073 7.48922C158.493 7.48922 159.059 8.77148 159.059 10.2926C159.059 11.7383 158.493 13.096 157.073 13.096C155.652 13.096 155.087 11.7383 155.087 10.2926Z", fill: "#1C1C1C" }), _jsx("path", { d: "M164.331 14.6799H166.48L166.405 8.68348H166.43L169.497 14.6799H172.401V5.90525H170.264L170.302 11.864H170.277L167.31 5.90525H164.331V14.6799Z", fill: "#1C1C1C" }), _jsx("path", { d: "M175.41 14.4537C176.189 14.7051 177.207 14.8308 178.025 14.8308C179.973 14.8308 181.884 14.2148 181.884 11.9394C181.884 8.77148 177.735 9.72689 177.735 8.30635C177.735 7.53951 178.716 7.48922 179.307 7.48922C179.973 7.48922 180.652 7.61493 181.255 7.8915L181.406 6.08125C180.815 5.88011 179.986 5.75439 179.143 5.75439C177.383 5.75439 175.322 6.33267 175.322 8.44463C175.322 11.6377 179.47 10.6069 179.47 12.2411C179.47 12.9451 178.766 13.096 178.025 13.096C177.057 13.096 176.214 12.8446 175.611 12.5177L175.41 14.4537Z", fill: "#1C1C1C" }), _jsx("path", { d: "M184.781 14.6799H187.119V11.1474H190.501V9.48804H187.119V7.56465H190.652V5.90525H184.781V14.6799Z", fill: "#FD395E" }), _jsx("path", { d: "M200.906 5.90525H198.568V10.9589C198.568 12.1154 198.253 13.096 197.059 13.096C195.865 13.096 195.551 12.1154 195.551 10.9589V5.90525H193.212V11.3486C193.212 13.7497 194.771 14.8308 197.059 14.8308C199.347 14.8308 200.906 13.7497 200.906 11.3486V5.90525Z", fill: "#FD395E" }), _jsx("path", { d: "M203.743 14.4537C204.522 14.7051 205.541 14.8308 206.358 14.8308C208.306 14.8308 210.217 14.2148 210.217 11.9394C210.217 8.77148 206.069 9.72689 206.069 8.30635C206.069 7.53951 207.049 7.48922 207.64 7.48922C208.306 7.48922 208.985 7.61493 209.589 7.8915L209.739 6.08125C209.149 5.88011 208.319 5.75439 207.477 5.75439C205.717 5.75439 203.655 6.33267 203.655 8.44463C203.655 11.6377 207.803 10.6069 207.803 12.2411C207.803 12.9451 207.099 13.096 206.358 13.096C205.39 13.096 204.547 12.8446 203.944 12.5177L203.743 14.4537Z", fill: "#FD395E" }), _jsx("path", { d: "M213.05 14.6799H219.373V13.0205H215.388V11.0343H219.021V9.3749H215.388V7.56465H219.235V5.90525H213.05V14.6799Z", fill: "#FD395E" }), _jsx("defs", { children: _jsxs("linearGradient", __assign({ id: "paint0_linear_4260_84209", x1: "76.5", y1: "3.00006", x2: "88.7401", y2: "7.14128", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { offset: "0.03125", stopColor: "#CA405A", stopOpacity: "0.958429" }), _jsx("stop", { offset: "1", stopColor: "#A2243B" })] })) })] })));
|
|
80
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4
|
|
81
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -12,4 +12,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Div, Span, theme } from "../styled";
|
|
14
14
|
import { infoIcon } from "./common/icons";
|
|
15
|
-
|
|
15
|
+
import { useTranslation } from "react-i18next";
|
|
16
|
+
export var PreviewModeBanner = function () {
|
|
17
|
+
var t = useTranslation("general").t;
|
|
18
|
+
return (_jsxs(Div, __assign({ bg: theme.colors.blue100, h: 80, alignCenter: true }, { children: [_jsx(Div, __assign({ ml: 33, mr: 8 }, { children: infoIcon })), _jsx(Span, __assign({ mr: 16 }, { children: t("preview_mode_banner.title") }))] })));
|
|
19
|
+
};
|
|
@@ -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({ h6: true, w: 300, textAlignCenter: true, mt: 20 }, { children: (appResponse === null || appResponse === void 0 ? void 0 : appResponse.message) || defaultMessage })), _jsx(Div, __assign({ dflex: true, mt: 40, w100: true, centered: true }, { children: _jsx(Button, __assign({
|
|
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 })), _jsx(Div, __assign({ dflex: true, mt: 40, w100: true, centered: true }, { children: _jsx(Button, __assign({ ml: 10, onClick: onCloseModal }, { children: "OK" })) }))] })) })));
|
|
35
35
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AppResponse, Field, OnValidateRecord, RecordDataSet } from "../../types";
|
|
3
2
|
import { OnDataSetChanged, OnValidationStateChanged } from "../common/Spreadsheet";
|
|
4
|
-
|
|
3
|
+
type State = {
|
|
5
4
|
previewInitialDataSet: RecordDataSet;
|
|
6
5
|
previewFields: Field[];
|
|
7
6
|
reviewInitialDataSet: RecordDataSet;
|
|
@@ -18,8 +17,9 @@ declare type State = {
|
|
|
18
17
|
onDataSetChanged: OnDataSetChanged;
|
|
19
18
|
onValidationStateChanged: OnValidationStateChanged;
|
|
20
19
|
onSubmit: () => void;
|
|
20
|
+
onExport: () => void;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
type Props = {
|
|
23
23
|
children: JSX.Element;
|
|
24
24
|
};
|
|
25
25
|
export declare const ReviewContextProvider: ({ children }: Props) => JSX.Element;
|
|
@@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
24
24
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
25
|
function step(op) {
|
|
26
26
|
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
28
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
29
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
30
|
switch (op[0]) {
|
|
@@ -94,9 +94,22 @@ var filterAndMapWithBackendErrors = function (dataSet, errors) {
|
|
|
94
94
|
return __assign(__assign({}, record), { _meta: __assign(__assign({}, meta), { isInvalid: true, backendErrors: errors[rId] }) });
|
|
95
95
|
}, []);
|
|
96
96
|
};
|
|
97
|
+
function convertToCSV(data) {
|
|
98
|
+
var headers = Object.keys(data[0]).filter(function (header) { return header !== "_meta"; });
|
|
99
|
+
var csvRows = [];
|
|
100
|
+
csvRows.push(headers.join(","));
|
|
101
|
+
data.forEach(function (item) {
|
|
102
|
+
var row = [];
|
|
103
|
+
headers.forEach(function (header) {
|
|
104
|
+
row.push(item[header]);
|
|
105
|
+
});
|
|
106
|
+
csvRows.push(row.join(","));
|
|
107
|
+
});
|
|
108
|
+
return csvRows.join("\n");
|
|
109
|
+
}
|
|
97
110
|
export var ReviewContextProvider = function (_a) {
|
|
98
111
|
var children = _a.children;
|
|
99
|
-
var _b = useImporterContext(), templateHeaderMatchings = _b.templateHeaderMatchings, enumFieldValueMatchings = _b.enumFieldValueMatchings, templateHeaders = _b.templateHeaders, uploadedDataHeaders = _b.uploadedDataHeaders, uploadedData = _b.uploadedData, currentStepIndex = _b.currentStepIndex, integrations = _b.integrations, templateSlug = _b.templateSlug, fuseApi = _b.fuseApi, _c = _b.importerOptions, disableSubmitIfInvalid = _c.disableSubmitIfInvalid, batchValidationDelayMs = _c.batchValidationDelayMs, batchValidationSize = _c.batchValidationSize, previewMode = _c.previewMode, loadingComponent = _c.loadingComponent, onSubmit = _b.onSubmit, onValidateRecord = _b.onValidateRecord, formatRecord = _b.formatRecord;
|
|
112
|
+
var _b = useImporterContext(), templateHeaderMatchings = _b.templateHeaderMatchings, enumFieldValueMatchings = _b.enumFieldValueMatchings, templateHeaders = _b.templateHeaders, uploadedDataHeaders = _b.uploadedDataHeaders, uploadedData = _b.uploadedData, currentStepIndex = _b.currentStepIndex, integrations = _b.integrations, templateSlug = _b.templateSlug, fuseApi = _b.fuseApi, _c = _b.importerOptions, disableSubmitIfInvalid = _c.disableSubmitIfInvalid, batchValidationDelayMs = _c.batchValidationDelayMs, batchValidationSize = _c.batchValidationSize, previewMode = _c.previewMode, loadingComponent = _c.loadingComponent, onSubmit = _b.onSubmit, onValidateRecord = _b.onValidateRecord, formatRecord = _b.formatRecord, selectedRows = _b.selectedRows;
|
|
100
113
|
var _d = useState(false), isSubmitting = _d[0], setIsSubmitting = _d[1];
|
|
101
114
|
var _e = useState(false), isSubmitDisabled = _e[0], setIsSubmitDisabled = _e[1];
|
|
102
115
|
var _f = useState(false), importWasSuccessful = _f[0], setImportWasSuccessful = _f[1];
|
|
@@ -111,8 +124,24 @@ export var ReviewContextProvider = function (_a) {
|
|
|
111
124
|
batchValidationDelayMs: batchValidationDelayMs,
|
|
112
125
|
batchValidationSize: batchValidationSize,
|
|
113
126
|
}); }, [batchValidationDelayMs, batchValidationSize]);
|
|
127
|
+
var onExport = useCallback(function () {
|
|
128
|
+
if (!reviewDataSetRef.current)
|
|
129
|
+
return;
|
|
130
|
+
var dataSet = reviewDataSetRef.current;
|
|
131
|
+
var dataSetValues = Object.values(dataSet);
|
|
132
|
+
var selectedDataSetValues = dataSetValues.filter(function (_, index) {
|
|
133
|
+
return selectedRows.includes(index);
|
|
134
|
+
});
|
|
135
|
+
var csv = convertToCSV(selectedDataSetValues);
|
|
136
|
+
var blob = new Blob([csv], { type: "text/csv" });
|
|
137
|
+
var url = URL.createObjectURL(blob);
|
|
138
|
+
var link = document.createElement("a");
|
|
139
|
+
link.setAttribute("href", url);
|
|
140
|
+
link.setAttribute("download", "export.csv");
|
|
141
|
+
link.click();
|
|
142
|
+
}, [reviewFields, selectedRows]);
|
|
114
143
|
var onSubmitData = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
|
-
var dataSet, dataSetValues, validDataSetValues, validDataSetLength, invalidRecords, applicationResponse, isAppResponseSuccessful, _a, errors, isDataValid, invalidDataSet, error_2;
|
|
144
|
+
var dataSet, dataSetValues, selectedDataSetValues, validDataSetValues, validDataSetLength, invalidRecords, applicationResponse, isAppResponseSuccessful, _a, errors, isDataValid, invalidDataSet, error_2;
|
|
116
145
|
return __generator(this, function (_b) {
|
|
117
146
|
switch (_b.label) {
|
|
118
147
|
case 0:
|
|
@@ -122,7 +151,10 @@ export var ReviewContextProvider = function (_a) {
|
|
|
122
151
|
setIsSubmitting(true);
|
|
123
152
|
dataSet = reviewDataSetRef.current;
|
|
124
153
|
dataSetValues = Object.values(dataSet);
|
|
125
|
-
|
|
154
|
+
selectedDataSetValues = dataSetValues.filter(function (_, index) {
|
|
155
|
+
return selectedRows.includes(index);
|
|
156
|
+
});
|
|
157
|
+
validDataSetValues = selectedDataSetValues.filter(function (record) {
|
|
126
158
|
return !record._meta.isInvalid && !isRecordEmpty(record, reviewFields);
|
|
127
159
|
});
|
|
128
160
|
validDataSetLength = validDataSetValues.length;
|
|
@@ -222,6 +254,7 @@ export var ReviewContextProvider = function (_a) {
|
|
|
222
254
|
isSubmitting: isSubmitting,
|
|
223
255
|
options: options,
|
|
224
256
|
onSubmit: onSubmitData,
|
|
257
|
+
onExport: onExport,
|
|
225
258
|
onValidateRecord: onValidateRecord,
|
|
226
259
|
onDataSetChanged: onDataSetChanged,
|
|
227
260
|
onValidationStateChanged: onValidationStateChanged,
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
};
|
|
1
5
|
var __assign = (this && this.__assign) || function () {
|
|
2
6
|
__assign = Object.assign || function(t) {
|
|
3
7
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -10,14 +14,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
14
|
return __assign.apply(this, arguments);
|
|
11
15
|
};
|
|
12
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useImporterContext } from "../contexts/ImporterContextProvider";
|
|
13
18
|
import { Div } from "../../styled/utils";
|
|
19
|
+
import { Span } from "../../styled";
|
|
14
20
|
import Spreadsheet from "../common/Spreadsheet";
|
|
15
21
|
import { getSpreadsheetRowWidth } from "../common/utils";
|
|
16
22
|
import { AppResponseModal } from "./AppResponseModal";
|
|
17
23
|
import { useReviewContext } from "./ReviewContextProvider";
|
|
24
|
+
import { Button } from "../../common/buttons";
|
|
25
|
+
import styled from "styled-components";
|
|
26
|
+
import { useTranslation } from "react-i18next";
|
|
27
|
+
var downloadIcon = (_jsxs("svg", __assign({ width: "16", height: "17", viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M1.66659 8.99996C1.33325 7.99996 1.33325 6.99996 1.33325 6.3042C1.33325 3.98541 3.40957 1.66663 5.97083 1.66663C7.68739 1.66663 9.18612 2.59924 9.98798 3.98541H10.6084C12.5293 3.98541 14.3333 5.33329 14.3333 6.99996C14.3333 7.66663 14.3333 8.33329 13.9999 8.99996", stroke: "#333333", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M4.94434 13.2211L7.66656 15.8333L10.3888 13.2211", stroke: "#333333", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7.66675 15.1462L7.66675 7.75005", stroke: "#333333", strokeWidth: "2", strokeLinecap: "round" })] })));
|
|
28
|
+
var TitleContainer = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 99%;\n"], ["\n width: 99%;\n"])));
|
|
29
|
+
var ExportButtonContainer = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n right: 32px;\n"], ["\n position: absolute;\n right: 32px;\n"])));
|
|
18
30
|
var ReviewWithContext = function () {
|
|
19
|
-
var _a = useReviewContext(), fields = _a.reviewFields, initialDataSet = _a.reviewInitialDataSet, options = _a.options, onValidateRecord = _a.onValidateRecord, onDataSetChanged = _a.onDataSetChanged, onValidationStateChanged = _a.onValidationStateChanged;
|
|
20
|
-
var
|
|
21
|
-
|
|
31
|
+
var _a = useReviewContext(), fields = _a.reviewFields, initialDataSet = _a.reviewInitialDataSet, options = _a.options, onValidateRecord = _a.onValidateRecord, onDataSetChanged = _a.onDataSetChanged, onValidationStateChanged = _a.onValidationStateChanged, onExport = _a.onExport;
|
|
32
|
+
var _b = useImporterContext(), selectedRows = _b.selectedRows, setSelectedRows = _b.setSelectedRows;
|
|
33
|
+
var t = useTranslation("review").t;
|
|
34
|
+
var spreadsheetUI = initialDataSet && (_jsx(Spreadsheet, { options: __assign(__assign({}, options), { showCheckboxColumn: true }), selectedRows: selectedRows, setSelectedRows: setSelectedRows, initialDataSet: initialDataSet, fields: fields, rowWidth: getSpreadsheetRowWidth(fields, 6), onDataSetChanged: onDataSetChanged, onValidateRecord: onValidateRecord, onValidationStateChanged: onValidationStateChanged }));
|
|
35
|
+
return (_jsxs(Div, __assign({ centered: true, flexColumn: true }, { children: [_jsx(AppResponseModal, {}), _jsxs(Div, __assign({ w: 1400 }, { children: [_jsxs(TitleContainer, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: [_jsx(Div, __assign({ h2: true, mt: 40 }, { children: t("title") })), _jsx(ExportButtonContainer, __assign({ mb: 16, mt: 64 }, { children: _jsxs(Button, __assign({ w: 120, br: 8, variant: "secondary", svgNormalFillColorOverride: "transparent", svgActiveFillColorOverride: "transparent", svgActiveStrokeColorOverride: "white", onClick: onExport }, { children: [downloadIcon, " ", _jsxs(Span, __assign({ ml: 6 }, { children: [" ", t("export")] }))] })) }))] })), _jsx(Div, __assign({ centered: true, textAlignCenter: true, flexColumn: true }, { children: _jsx(Div, __assign({ body1: true, mt: 20, w: 540, mb: 15 }, { children: t("description") })) })), spreadsheetUI] }))] })));
|
|
22
36
|
};
|
|
23
37
|
export default ReviewWithContext;
|
|
38
|
+
var templateObject_1, templateObject_2;
|