fuse-importer 0.23.8 → 0.23.9
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 +19 -19
- package/lib/esm/Importer/ImporterWithContext.d.ts +7 -0
- package/lib/esm/Importer/ImporterWithContext.js +69 -0
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/index.js +4 -4
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/EnumFieldMatcher/tableColumns.js +1 -1
- package/lib/esm/Importer/Matcher/EnumFieldsMatchers/index.js +2 -2
- package/lib/esm/Importer/Matcher/HeaderMatcher/index.js +2 -3
- package/lib/esm/Importer/Matcher/HeaderMatcher/tableColumns.js +1 -1
- package/lib/esm/Importer/Matcher/index.d.ts +3 -3
- package/lib/esm/Importer/Matcher/index.js +4 -3
- package/lib/esm/Importer/PreviewFirstTime.d.ts +2 -0
- package/lib/esm/Importer/PreviewFirstTime.js +78 -0
- package/lib/esm/Importer/PreviewModeBanner.js +3 -6
- package/lib/esm/Importer/Review/AppResponseModal.js +3 -3
- package/lib/esm/Importer/Review/ReviewContextProvider.d.ts +27 -0
- package/lib/esm/Importer/Review/ReviewContextProvider.js +233 -0
- package/lib/esm/Importer/Review/ReviewWithContext.d.ts +3 -0
- package/lib/esm/Importer/Review/ReviewWithContext.js +23 -0
- package/lib/esm/Importer/Review/index.d.ts +3 -3
- package/lib/esm/Importer/Review/index.js +4 -92
- package/lib/esm/Importer/Stepper/Step.d.ts +7 -0
- package/lib/esm/Importer/Stepper/Step.js +19 -0
- package/lib/esm/Importer/Stepper/StepIndex.d.ts +6 -0
- package/lib/esm/Importer/Stepper/StepIndex.js +27 -0
- package/lib/esm/Importer/Stepper/StepperSubmitModal.d.ts +8 -0
- package/lib/esm/Importer/Stepper/StepperSubmitModal.js +22 -0
- package/lib/esm/Importer/Stepper/UnmatchedHeadersModal.d.ts +9 -0
- package/lib/esm/Importer/Stepper/UnmatchedHeadersModal.js +23 -0
- package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.d.ts +8 -0
- package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.js +33 -0
- package/lib/esm/Importer/Stepper/common/icons.d.ts +3 -0
- package/lib/esm/Importer/Stepper/common/icons.js +18 -0
- package/lib/esm/Importer/{Stepper.d.ts → Stepper/index.d.ts} +2 -2
- package/lib/esm/Importer/Stepper/index.js +97 -0
- package/lib/esm/Importer/TrialModeBanner.js +3 -4
- package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +1 -1
- package/lib/esm/Importer/Uploader/DragAndDropImporter/index.js +4 -4
- package/lib/esm/Importer/Uploader/HeaderButtons.d.ts +2 -0
- package/lib/esm/Importer/Uploader/HeaderButtons.js +29 -0
- package/lib/esm/Importer/Uploader/HeadersPreview.js +6 -64
- package/lib/esm/Importer/Uploader/UploaderContextProvider.d.ts +2 -2
- package/lib/esm/Importer/Uploader/index.d.ts +3 -3
- package/lib/esm/Importer/Uploader/index.js +6 -6
- package/lib/esm/Importer/common/AppLoading.js +2 -2
- package/lib/esm/Importer/{Footer.d.ts → common/Footer.d.ts} +0 -0
- package/lib/esm/Importer/common/Footer.js +17 -0
- package/lib/esm/Importer/{FuseApi.d.ts → common/FuseApi.d.ts} +1 -1
- package/lib/esm/Importer/{FuseApi.js → common/FuseApi.js} +2 -2
- package/lib/esm/Importer/{GlobalStyle.d.ts → common/GlobalStyle.d.ts} +0 -0
- package/lib/esm/Importer/common/GlobalStyle.js +7 -0
- package/lib/esm/Importer/{ImporterFonts.d.ts → common/ImporterFonts.d.ts} +0 -0
- package/lib/esm/Importer/{ImporterFonts.js → common/ImporterFonts.js} +0 -0
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.d.ts +13 -26
- package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider.js +51 -286
- package/lib/esm/Importer/common/Spreadsheet/common/index.d.ts +8 -15
- package/lib/esm/Importer/common/Spreadsheet/common/index.js +31 -101
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/FieldHeader.d.ts +0 -0
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/FieldHeader.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{GlobalStyle.d.ts → components/GlobalStyle.d.ts} +0 -0
- package/lib/esm/Importer/common/Spreadsheet/{GlobalStyle.js → components/GlobalStyle.js} +0 -0
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.d.ts +3 -0
- package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +74 -0
- package/lib/esm/Importer/common/Spreadsheet/{SpreadsheetRowNumbers.d.ts → components/SpreadsheetRowNumbers.d.ts} +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{SpreadsheetRowNumbers.js → components/SpreadsheetRowNumbers.js} +4 -4
- package/lib/esm/Importer/common/Spreadsheet/components/ValidationProgress.d.ts +6 -0
- package/lib/esm/Importer/common/Spreadsheet/components/ValidationProgress.js +19 -0
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/SpeadsheetAutocomplete.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/SpeadsheetAutocomplete.js +2 -4
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/SpreadsheetInput.d.ts +0 -0
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/SpreadsheetInput.js +0 -0
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/index.d.ts +0 -4
- package/lib/esm/Importer/common/Spreadsheet/{common → components}/fields/index.js +11 -64
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/Boolean.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/Boolean.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/EmailInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/EmailInput.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/EnumInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/EnumInput.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/FloatInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/FloatInput.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/IntegerInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/IntegerInput.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/StringInput.d.ts +1 -1
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/StringInput.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/components/inputs/index.d.ts +13 -0
- package/lib/esm/Importer/common/Spreadsheet/{inputs → components/inputs}/index.js +1 -1
- package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +29 -0
- package/lib/esm/Importer/common/Spreadsheet/hooks.js +201 -0
- package/lib/esm/Importer/common/Spreadsheet/index.d.ts +10 -9
- package/lib/esm/Importer/common/Spreadsheet/index.js +10 -105
- package/lib/esm/Importer/common/Spreadsheet/styles.d.ts +3 -0
- package/lib/esm/Importer/common/Spreadsheet/styles.js +10 -0
- package/lib/esm/Importer/common/Spreadsheet/validation/index.d.ts +20 -0
- package/lib/esm/Importer/common/Spreadsheet/validation/index.js +172 -0
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.d.ts +6 -0
- package/lib/esm/Importer/common/Spreadsheet/validation/validators.js +176 -0
- package/lib/esm/Importer/common/icons/index.d.ts +3 -0
- package/lib/esm/Importer/common/icons/index.js +3 -0
- package/lib/esm/Importer/common/index.js +3 -3
- package/lib/esm/Importer/{theme.d.ts → common/theme.d.ts} +14 -4
- package/lib/esm/Importer/{theme.js → common/theme.js} +1 -1
- package/lib/esm/Importer/common/utils.d.ts +2 -4
- package/lib/esm/Importer/common/utils.js +79 -24
- package/lib/esm/Importer/{ImporterContextProvider.d.ts → contexts/ImporterContextProvider.d.ts} +18 -53
- package/lib/esm/Importer/{ImporterContextProvider.js → contexts/ImporterContextProvider.js} +31 -27
- package/lib/esm/Importer/data/index.d.ts +28 -0
- package/lib/esm/Importer/data/index.js +134 -0
- package/lib/esm/Importer/index.d.ts +6 -11
- package/lib/esm/Importer/index.js +6 -60
- package/lib/esm/common/Modal.js +5 -2
- package/lib/esm/common/Table/TableView/TableRow.d.ts +2 -1
- package/lib/esm/common/Table/TableView/TableRow.js +10 -10
- package/lib/esm/common/Table/TableView/index.d.ts +2 -1
- package/lib/esm/common/Table/TableView/index.js +9 -8
- package/lib/esm/common/Table/icons.d.ts +1 -0
- package/lib/esm/common/Table/icons.js +2 -1
- package/lib/esm/common/TooltipProvider.d.ts +5 -1
- package/lib/esm/common/TooltipProvider.js +11 -13
- package/lib/esm/common/buttons.d.ts +6 -3
- package/lib/esm/common/buttons.js +11 -5
- package/lib/esm/common/inputs/Autocomplete.d.ts +2 -1
- package/lib/esm/common/inputs/Autocomplete.js +7 -6
- package/lib/esm/common/inputs/SelectMenu.d.ts +2 -1
- package/lib/esm/common/inputs/SelectMenu.js +8 -8
- package/lib/esm/common/inputs/TextInput.d.ts +10 -6
- package/lib/esm/common/inputs/TextInput.js +12 -3
- 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 +5 -0
- package/lib/esm/common/inputs/tooltip.js +38 -0
- package/lib/esm/index.d.ts +1 -2
- package/lib/esm/index.js +0 -1
- package/lib/esm/styled/theme/colorPalette.d.ts +18 -18
- package/lib/esm/styled/theme/debugCss.d.ts +1 -0
- package/lib/esm/styled/theme/debugCss.js +2 -1
- package/lib/esm/styled/theme/dimensionsCss.d.ts +6 -2
- package/lib/esm/styled/theme/dimensionsCss.js +3 -3
- package/lib/esm/styled/theme/globalCss.d.ts +3 -0
- package/lib/esm/styled/theme/globalCss.js +9 -8
- package/lib/esm/styled/theme/index.d.ts +24 -5
- package/lib/esm/styled/theme/textStyles.d.ts +1 -0
- package/lib/esm/styled/theme/textStyles.js +2 -1
- package/lib/esm/types.d.ts +64 -14
- package/lib/main.js +1 -1
- package/package.json +18 -8
- package/lib/esm/Importer/Footer.js +0 -19
- package/lib/esm/Importer/GlobalStyle.js +0 -7
- package/lib/esm/Importer/SpreadsheetReviewContextProvider.d.ts +0 -20
- package/lib/esm/Importer/SpreadsheetReviewContextProvider.js +0 -128
- package/lib/esm/Importer/Stepper.js +0 -153
- package/lib/esm/Importer/common/Spreadsheet/inputs/index.d.ts +0 -13
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div>
|
|
2
2
|
<center>
|
|
3
|
-
<a href="https://fuse.
|
|
4
|
-
<img alt="Flatirons Fuse" src="https://wp.
|
|
3
|
+
<a href="https://fuse.flatirons.com/users/sign-up?utm_source=npmjs&utm_medium=Fuse+importer+logo&utm_campaign=NPM">
|
|
4
|
+
<img alt="Flatirons Fuse" src="https://wp.flatirons.com/wp-content/uploads/2022/07/fuse-logo.png">
|
|
5
5
|
</a>
|
|
6
6
|
</center>
|
|
7
7
|
<br>
|
|
@@ -16,7 +16,7 @@ Flatirons Fuse is a customizable and powerful CSV Importer that works with all f
|
|
|
16
16
|
- [Installation](#installation)
|
|
17
17
|
- [Introduction](#introduction)
|
|
18
18
|
- [Registration](#registration)
|
|
19
|
-
- [Create Your First
|
|
19
|
+
- [Create Your First Importer](#create-your-first-template)
|
|
20
20
|
- [Getting started](#getting-started)
|
|
21
21
|
- [More Examples](#more-examples)
|
|
22
22
|
- [Usage](#usage)
|
|
@@ -57,30 +57,30 @@ Install with CDN:
|
|
|
57
57
|
|
|
58
58
|
Flatirons Fuse is our solution to the inevitable difficulties of getting customer data into your solution. We provide a white-labeled, customizable CSV and Spreadsheet import experience that is above all effective and flexible. Not only do we save you the time and effort of developing your own import solution, but we also ensure that setup and integration with your systems are a breeze.
|
|
59
59
|
|
|
60
|
-
To get started with our solution, you're going to need a free account and to create a template on our platform: [Flatirons Fuse](https://fuse.
|
|
60
|
+
To get started with our solution, you're going to need a free account and to create a template on our platform: [Flatirons Fuse](https://fuse.flatirons.com/users/sign-up?utm_source=npmjs&utm_medium=Flatirons+Fuse+Get+Started&utm_campaign=NPM)
|
|
61
61
|
|
|
62
62
|
To use the importer you will need two keys:
|
|
63
63
|
|
|
64
|
-
- Your **Organization's API key**: You can find this at the top of the [
|
|
65
|
-
- Your **
|
|
64
|
+
- Your **Organization's API key**: You can find this at the top of the [Importers page](#create-your-first-template).
|
|
65
|
+
- Your **Importer's ID**: You can find this in the table on the [Importers page](#create-your-first-template).
|
|
66
66
|
|
|
67
|
-
For more information see our [full documentation.](https://fuse-docs.
|
|
67
|
+
For more information see our [full documentation.](https://fuse-docs.flatirons.com?utm_source=npmjs&utm_medium=Fuse+importer+Full+Documentation&utm_campaign=NPM)
|
|
68
68
|
|
|
69
69
|
Check it out in action:
|
|
70
70
|
|
|
71
71
|
<div>
|
|
72
72
|
<center>
|
|
73
|
-
<img alt="Check it out in action" src="https://wp.
|
|
73
|
+
<img alt="Check it out in action" src="https://wp.flatirons.com/wp-content/uploads/2022/07/ezgif-1-242e10926e.gif">
|
|
74
74
|
</center>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
77
|
## Registration
|
|
78
78
|
|
|
79
|
-
If you don't have an account yet, you can go over the [Registration](https://fuse-docs.
|
|
79
|
+
If you don't have an account yet, you can go over the [Registration](https://fuse-docs.flatirons.com/getting-started/registration?utm_source=npmjs&utm_medium=Registration&utm_campaign=NPM).
|
|
80
80
|
|
|
81
|
-
## Create Your First
|
|
81
|
+
## Create Your First Importer
|
|
82
82
|
|
|
83
|
-
If you don’t have a
|
|
83
|
+
If you don’t have a Importer yet, you can go over [Create Your First Importer](https://fuse-docs.flatirons.com/getting-started/create-your-first-template?utm_source=npmjs&utm_medium=Create+Your+First+Template&utm_campaign=NPM). Importer represents the fields and validations that your own system accepts, also known as your data schema.
|
|
84
84
|
|
|
85
85
|
## Getting started
|
|
86
86
|
|
|
@@ -94,7 +94,7 @@ If you don’t have a Template yet, you can go over [Create Your First Template]
|
|
|
94
94
|
></script>
|
|
95
95
|
<script type="text/javascript">
|
|
96
96
|
const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
|
|
97
|
-
const templateId = "YOUR
|
|
97
|
+
const templateId = "YOUR IMPORTER ID";
|
|
98
98
|
const importer = new FuseImporter(organizationApiKey, templateId);
|
|
99
99
|
|
|
100
100
|
importer.onValidateRecord = async (record) => {
|
|
@@ -116,7 +116,7 @@ If you don’t have a Template yet, you can go over [Create Your First Template]
|
|
|
116
116
|
templateId.indexOf("YOUR") !== -1
|
|
117
117
|
) {
|
|
118
118
|
window.confirm(
|
|
119
|
-
"You need to configure your organization api key and
|
|
119
|
+
"You need to configure your organization api key and Importer id."
|
|
120
120
|
);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
@@ -133,10 +133,10 @@ If you don’t have a Template yet, you can go over [Create Your First Template]
|
|
|
133
133
|
|
|
134
134
|
## More Examples
|
|
135
135
|
|
|
136
|
-
- [Quickstart Examples](https://fuse-docs.
|
|
137
|
-
- [React.js](https://fuse-docs.
|
|
138
|
-
- [Angular](https://fuse-docs.
|
|
139
|
-
- [Vue.js](https://fuse-docs.
|
|
136
|
+
- [Quickstart Examples](https://fuse-docs.flatirons.com/installation/quickstart-examples?utm_source=npmjs&utm_medium=More+Examples+Quickstart+Examples&utm_campaign=NPM)
|
|
137
|
+
- [React.js](https://fuse-docs.flatirons.com/use-cases/react.js-csv-importer?utm_source=npmjs&utm_medium=More+Examples+React&utm_campaign=NPM)
|
|
138
|
+
- [Angular](https://fuse-docs.flatirons.com/use-cases/angular-csv-importer?utm_source=npmjs&utm_medium=More+Examples+Angular&utm_campaign=NPM)
|
|
139
|
+
- [Vue.js](https://fuse-docs.flatirons.com/use-cases/vue.js-csv-importer?utm_source=npmjs&utm_medium=More+Examples+Vue&utm_campaign=NPM)
|
|
140
140
|
|
|
141
141
|
## Usage
|
|
142
142
|
|
|
@@ -144,7 +144,7 @@ If you don’t have a Template yet, you can go over [Create Your First Template]
|
|
|
144
144
|
import FuseImporter from "fuse-importer";
|
|
145
145
|
|
|
146
146
|
const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
|
|
147
|
-
const templateId = "YOUR
|
|
147
|
+
const templateId = "YOUR IMPORTER ID";
|
|
148
148
|
const importer = new FuseImporter(organizationApiKey, templateId);
|
|
149
149
|
```
|
|
150
150
|
|
|
@@ -180,7 +180,7 @@ importer.onClose = () => {
|
|
|
180
180
|
|
|
181
181
|
#### `onValidateRecord`
|
|
182
182
|
|
|
183
|
-
The `onValidationRecord` hook is called for each row (record) that a customer uploads. It allows you to specify custom frontend validations and display error messages in the importer for the user to fix. When you create a
|
|
183
|
+
The `onValidationRecord` hook is called for each row (record) that a customer uploads. It allows you to specify custom frontend validations and display error messages in the importer for the user to fix. When you create a importer, each column contains an `internal key`. These internal keys represent the
|
|
184
184
|
|
|
185
185
|
Return values:
|
|
186
186
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type LayoutProps = {
|
|
3
|
+
zIndex: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const Layout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../styled").CSSProps & LayoutProps, never>;
|
|
6
|
+
export declare const ImporterWithContext: () => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
import { useEffect, useRef } from "react";
|
|
18
|
+
import styled, { css, ThemeProvider } from "styled-components";
|
|
19
|
+
import { Toast } from "../common";
|
|
20
|
+
import { Div } from "../styled";
|
|
21
|
+
import { Footer } from "./common/Footer";
|
|
22
|
+
import { GlobalStyle } from "./common/GlobalStyle";
|
|
23
|
+
import { ImporterFonts } from "./common/ImporterFonts";
|
|
24
|
+
import { useImporterContext } from "./contexts/ImporterContextProvider";
|
|
25
|
+
import Matcher from "./Matcher";
|
|
26
|
+
import { PreviewFirstTime } from "./PreviewFirstTime";
|
|
27
|
+
import { PreviewModeBanner } from "./PreviewModeBanner";
|
|
28
|
+
import Review from "./Review";
|
|
29
|
+
import { ReviewContextProvider } from "./Review/ReviewContextProvider";
|
|
30
|
+
import { Stepper } from "./Stepper/index";
|
|
31
|
+
import { TrialModeBanner } from "./TrialModeBanner";
|
|
32
|
+
import Uploader from "./Uploader";
|
|
33
|
+
var steps = [
|
|
34
|
+
{
|
|
35
|
+
label: "Upload",
|
|
36
|
+
component: _jsx(Uploader, {}),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Match",
|
|
40
|
+
component: _jsx(Matcher, {}),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Review",
|
|
44
|
+
component: _jsx(Review, {}),
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
export var Layout = styled(Div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n grid-template-rows: auto 1fr auto;\n height: 100vh;\n width: 100vw;\n overflow-y: scroll;\n position: fixed;\n top: 0;\n left: 0;\n z-index: ", ";\n ", ";\n"], ["\n display: grid;\n grid-template-rows: auto 1fr auto;\n height: 100vh;\n width: 100vw;\n overflow-y: scroll;\n position: fixed;\n top: 0;\n left: 0;\n z-index: ", ";\n ", ";\n"])), function (p) { return p.zIndex; }, function (p) { return p.theme.css.scrollbarDark; });
|
|
48
|
+
var Content = styled(Div)(function (_a) {
|
|
49
|
+
var _b = _a.theme, colors = _b.colors, c = _b.css;
|
|
50
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n padding-bottom: 70px;\n "], ["\n background-color: ", ";\n padding-bottom: 70px;\n "])), colors.backgroundInterface);
|
|
51
|
+
});
|
|
52
|
+
export var ImporterWithContext = function () {
|
|
53
|
+
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
|
+
var layoutRef = useRef(null);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
layoutRef.current.scrollTo(0, 0);
|
|
57
|
+
}, [currentStepIndex, matcherSubstep]);
|
|
58
|
+
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, {});
|
|
63
|
+
}
|
|
64
|
+
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() })) })] })));
|
|
68
|
+
};
|
|
69
|
+
var templateObject_1, templateObject_2;
|
|
@@ -14,13 +14,13 @@ import { useRef } from "react";
|
|
|
14
14
|
import { TableView } from "../../../../common/Table/TableView";
|
|
15
15
|
import { colors } from "../../../../styled/theme/colorPalette";
|
|
16
16
|
import { Div } from "../../../../styled/utils";
|
|
17
|
-
import { useImporterContext } from "../../../ImporterContextProvider";
|
|
18
|
-
import { MatcherStatus } from "../../common/types";
|
|
19
|
-
import { EnumFieldMatcherContextProvider } from "../EnumFieldMatcherContext";
|
|
20
|
-
import { tableColumns } from "./tableColumns";
|
|
21
17
|
import { defaultTableHeaderHeightPx } from "../../../../common/Table/TableView/common";
|
|
22
18
|
import { getTableHeight } from "../../../common";
|
|
19
|
+
import { useImporterContext } from "../../../contexts/ImporterContextProvider";
|
|
23
20
|
import { MAX_VISIBLE_ROWS } from "../../common";
|
|
21
|
+
import { MatcherStatus } from "../../common/types";
|
|
22
|
+
import { EnumFieldMatcherContextProvider } from "../EnumFieldMatcherContext";
|
|
23
|
+
import { tableColumns } from "./tableColumns";
|
|
24
24
|
export var EnumFieldMatcher = function (_a) {
|
|
25
25
|
var _b;
|
|
26
26
|
var templateHeaderLabel = _a.templateHeaderLabel;
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
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
|
-
import { useImporterContext } from "../../../ImporterContextProvider";
|
|
15
|
+
import { useImporterContext } from "../../../contexts/ImporterContextProvider";
|
|
16
16
|
import { matchedIndicatorUI, unmatchedIndicatorUI } from "../../common";
|
|
17
17
|
import { MatcherStatus } from "../../common/types";
|
|
18
18
|
import { useEnumFieldMatcherContext } from "../EnumFieldMatcherContext";
|
|
@@ -11,9 +11,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { Div } from "../../../styled/utils";
|
|
14
|
-
import { useImporterContext } from "../../ImporterContextProvider";
|
|
15
|
-
import { EnumFieldMatcher } from "./EnumFieldMatcher";
|
|
16
14
|
import { contentWidth } from "../../common/index";
|
|
15
|
+
import { useImporterContext } from "../../contexts/ImporterContextProvider";
|
|
16
|
+
import { EnumFieldMatcher } from "./EnumFieldMatcher";
|
|
17
17
|
export var EnumFieldsMatchers = function () {
|
|
18
18
|
var enumFieldValueMatchings = useImporterContext().enumFieldValueMatchings;
|
|
19
19
|
return (_jsxs(_Fragment, { children: [_jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Match Your Columns with Ours" })), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true, maxw: 928 }, { children: "Our system only accepts certain values for some columns. Below you can match the values from your spreadsheet to the values we accept." }))] })), _jsx(Div, __assign({ flexColumn: true, alignCenter: true, mb: 20, centered: true }, { children: Object.keys(enumFieldValueMatchings).map(function (templateHeaderLabel, index) {
|
|
@@ -20,7 +20,7 @@ import { defaultTableHeaderHeightPx, TableView, } from "../../../common/Table/Ta
|
|
|
20
20
|
import { colors } from "../../../styled/theme";
|
|
21
21
|
import { Div } from "../../../styled/utils";
|
|
22
22
|
import { contentWidth, getTableHeight } from "../../common/index";
|
|
23
|
-
import { useImporterContext } from "../../ImporterContextProvider";
|
|
23
|
+
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";
|
|
@@ -52,8 +52,7 @@ var HeaderMatcher = function () {
|
|
|
52
52
|
dataCount: data.length,
|
|
53
53
|
maxVisibleRows: MAX_VISIBLE_ROWS,
|
|
54
54
|
});
|
|
55
|
-
|
|
56
|
-
return _jsx(_Fragment, { children: headerMatcher });
|
|
55
|
+
return (_jsx(_Fragment, { children: _jsx(Div, { children: _jsxs(Div, __assign({ flexColumn: true, centered: true }, { children: [_jsx(Div, __assign({ h2: true, mb: 16 }, { children: "Match Your Columns with Ours" })), _jsx(Div, __assign({ body1: true, mb: 24, textAlignCenter: true }, { children: "We were able to match ".concat(numberOfMatchedHeaders, " of ").concat(templateHeaders.length, " columns correctly!") })), _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 }) })) }))] })) }) }));
|
|
57
56
|
};
|
|
58
57
|
export { HeaderMatcher };
|
|
59
58
|
var templateObject_1;
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { Autocomplete } from "../../../common/inputs/Autocomplete";
|
|
14
14
|
import { Div } from "../../../styled/utils";
|
|
15
|
-
import { useImporterContext } from "../../ImporterContextProvider";
|
|
15
|
+
import { useImporterContext } from "../../contexts/ImporterContextProvider";
|
|
16
16
|
import { matchedIndicatorUI, unmatchedIndicatorUI } from "../common/index";
|
|
17
17
|
import { MatcherStatus } from "../common/types";
|
|
18
18
|
export var tableColumns = [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
3
|
-
export
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: React.MemoExoticComponent<() => JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { useMemo } from "react";
|
|
17
|
+
import React, { useMemo } from "react";
|
|
18
18
|
import styled, { css } from "styled-components";
|
|
19
19
|
import { FieldTypes } from "../..";
|
|
20
20
|
import { Div } from "../../styled/utils";
|
|
21
|
-
import { useImporterContext } from "../ImporterContextProvider";
|
|
21
|
+
import { useImporterContext } from "../contexts/ImporterContextProvider";
|
|
22
22
|
import { HeaderMatcher } from "./HeaderMatcher";
|
|
23
23
|
import { EnumFieldsMatchers } from "./EnumFieldsMatchers";
|
|
24
|
+
import { areEqual } from "react-window";
|
|
24
25
|
var Dot = styled(Div)(function (_a) {
|
|
25
26
|
var colors = _a.theme.colors, isSelected = _a.isSelected;
|
|
26
27
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 8px;\n width: 8px;\n border-radius: 100%;\n background: ", ";\n ", "\n "], ["\n height: 8px;\n width: 8px;\n border-radius: 100%;\n background: ", ";\n ", "\n "])), colors.outlineInputs, isSelected && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 12px;\n width: 12px;\n background: ", ";\n "], ["\n height: 12px;\n width: 12px;\n background: ", ";\n "])), colors.highlight01));
|
|
@@ -33,5 +34,5 @@ var Matcher = function () {
|
|
|
33
34
|
var dotsUI = (_jsxs(_Fragment, { children: [_jsx(Dot, { isSelected: matcherSubstep === 0 }), _jsx(Dot, { isSelected: matcherSubstep === 1 })] }));
|
|
34
35
|
return (_jsxs(_Fragment, { children: [_jsx(Div, __assign({ centered: true }, { children: _jsx(Div, __assign({ w: 30, mt: 40, mb: 16, alignCenter: true, spaceBetween: true }, { children: enumFieldsCount > 0 && dotsUI })) })), matcherSubstep === 0 && _jsx(HeaderMatcher, {}), matcherSubstep === 1 && _jsx(EnumFieldsMatchers, {})] }));
|
|
35
36
|
};
|
|
36
|
-
export
|
|
37
|
+
export default React.memo(Matcher, areEqual);
|
|
37
38
|
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (_) try {
|
|
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
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
53
|
+
import { theme } from "./common/theme";
|
|
54
|
+
import { Div, Span } from "../styled";
|
|
55
|
+
import { spreedSheetIcon } from "../common/Table/icons";
|
|
56
|
+
import styled, { css } from "styled-components";
|
|
57
|
+
import { Button } from "../common";
|
|
58
|
+
import { useImporterContext } from "./contexts/ImporterContextProvider";
|
|
59
|
+
var Content = styled(Div)(function (_a) {
|
|
60
|
+
var _b = _a.theme, colors = _b.colors, c = _b.css;
|
|
61
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n padding-bottom: 70px;\n "], ["\n background-color: ", ";\n padding-bottom: 70px;\n "])), colors.backgroundInterface);
|
|
62
|
+
});
|
|
63
|
+
var Wrapper = styled(Div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 129px;\n grid-auto-rows: minmax(auto, auto);\n justify-items: center;\n\n @media all and ", " {\n display: flex !important;\n flex-direction: column !important;\n }\n"], ["\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 129px;\n grid-auto-rows: minmax(auto, auto);\n justify-items: center;\n\n @media all and ", " {\n display: flex !important;\n flex-direction: column !important;\n }\n"])), theme.media.mobile);
|
|
64
|
+
var LeftSection = styled(Div)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n grid-column: 1 / 2;\n grid-row: 1;\n padding: 24px 40px;\n display: flex;\n flex-direction: column;\n align-items: center;\n"], ["\n grid-column: 1 / 2;\n grid-row: 1;\n padding: 24px 40px;\n display: flex;\n flex-direction: column;\n align-items: center;\n"])));
|
|
65
|
+
var RightSection = styled(Div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n grid-column: 2 / 2;\n grid-row: 1;\n padding: 24px 40px;\n display: flex;\n flex-direction: column;\n align-items: center;\n"], ["\n grid-column: 2 / 2;\n grid-row: 1;\n padding: 24px 40px;\n display: flex;\n flex-direction: column;\n align-items: center;\n"])));
|
|
66
|
+
export var PreviewFirstTime = function () {
|
|
67
|
+
var _a = useImporterContext(), templateSlug = _a.templateSlug, fuseApi = _a.fuseApi, setPreviewFirstTime = _a.setPreviewFirstTime;
|
|
68
|
+
var downloadCsvExample = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
window.open("/api/v1/importer/templates/".concat(templateSlug, "/preview.csv?api_token=").concat(fuseApi.apiToken));
|
|
71
|
+
setPreviewFirstTime(false);
|
|
72
|
+
return [2 /*return*/];
|
|
73
|
+
});
|
|
74
|
+
}); };
|
|
75
|
+
return (_jsx(Content, __assign({ justifyCenter: true, alignCenter: true }, { children: _jsxs(Wrapper, { children: [_jsx(LeftSection, __assign({ mt: 66 }, { children: _jsx(Div, __assign({ maxw: 448, w100: true }, { children: spreedSheetIcon })) })), _jsx(RightSection, { children: _jsxs(Div, __assign({ maxw: 448, w100: true }, { children: [_jsx(Div, __assign({ h2: true }, { children: "You're about to preview your importer. " })), _jsx(Div, __assign({ mt: 16, body1: true }, { children: "Download our example CSV to try out your importer. We have randomly generated it so you can see how Fuse transforms the data.." })), _jsxs(Button, __assign({ mt: 40, w: 189, onClick: downloadCsvExample }, { children: [downloadIcon, " ", _jsx(Span, __assign({ ml: 6 }, { children: " Download CSV " }))] })), _jsxs(Div, __assign({ mt: 40, dInline: true }, { children: [_jsx(Span, __assign({ buttonTextSmall: true }, { children: "Note:" })), _jsx(Span, __assign({ helperText: true, ml: 6 }, { children: "This screen will not exist once you install the importer on your website." }))] }))] })) })] }) })));
|
|
76
|
+
};
|
|
77
|
+
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" })] })));
|
|
78
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -10,9 +10,6 @@ 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 { theme } from "../styled
|
|
14
|
-
import {
|
|
15
|
-
export var PreviewModeBanner = function () {
|
|
16
|
-
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: "You’re currently in Preview mode." }))] })));
|
|
17
|
-
};
|
|
18
|
-
var infoIcon = (_jsxs("svg", __assign({ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("circle", { cx: "14", cy: "2.5", r: "2.5", fill: "#0EBEBE" }), _jsx("path", { d: "M15.5075 8H6L5 10.5L10 11L6.57474 18.9354C6.57474 18.9354 6.40657 20.1663 6.57474 20.9247C6.76276 21.7725 6.97074 22.2838 7.56727 22.9139C8.6672 24.0757 9.95115 24.1037 11.5374 23.9085C14.2577 23.5737 17 19.5 17 19.5L15.5075 17.9408C15.5075 17.9408 13.5223 19.93 12.5298 19.93C11.5373 19.93 11.5374 18.9354 11.5374 18.9354L15.5075 8Z", fill: "#0EBEBE" })] })));
|
|
13
|
+
import { Div, Span, theme } from "../styled";
|
|
14
|
+
import { infoIcon } from "./common/icons";
|
|
15
|
+
export var PreviewModeBanner = function () { 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: "You’re currently in Preview mode." }))] }))); };
|
|
@@ -13,12 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
14
14
|
import { Modal, Button } from "../..";
|
|
15
15
|
import { Div } from "../../styled/utils";
|
|
16
|
-
import { useImporterContext } from "../ImporterContextProvider";
|
|
17
|
-
import {
|
|
16
|
+
import { useImporterContext } from "../contexts/ImporterContextProvider";
|
|
17
|
+
import { useReviewContext } from "./ReviewContextProvider";
|
|
18
18
|
export var AppResponseModal = function () {
|
|
19
19
|
var _a = useState(false), isAppResponseModalOpen = _a[0], setIsAppResponseModalOpen = _a[1];
|
|
20
20
|
var onCloseImporter = useImporterContext().onClose;
|
|
21
|
-
var _b =
|
|
21
|
+
var _b = useReviewContext(), appResponse = _b.appResponse, importWasSuccessful = _b.importWasSuccessful;
|
|
22
22
|
useEffect(function () {
|
|
23
23
|
if (appResponse)
|
|
24
24
|
setIsAppResponseModalOpen(true);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AppResponse, Field, OnValidateRecord, RecordDataSet } from "../../types";
|
|
3
|
+
import { OnDataSetChanged, OnValidationStateChanged } from "../common/Spreadsheet";
|
|
4
|
+
declare type State = {
|
|
5
|
+
previewInitialDataSet: RecordDataSet;
|
|
6
|
+
previewFields: Field[];
|
|
7
|
+
reviewInitialDataSet: RecordDataSet;
|
|
8
|
+
reviewFields: Field[];
|
|
9
|
+
appResponse: AppResponse;
|
|
10
|
+
isSubmitting: boolean;
|
|
11
|
+
isSubmitDisabled: boolean;
|
|
12
|
+
importWasSuccessful: boolean;
|
|
13
|
+
options: {
|
|
14
|
+
batchValidationDelayMs: number;
|
|
15
|
+
batchValidationSize: number;
|
|
16
|
+
};
|
|
17
|
+
onValidateRecord: OnValidateRecord;
|
|
18
|
+
onDataSetChanged: OnDataSetChanged;
|
|
19
|
+
onValidationStateChanged: OnValidationStateChanged;
|
|
20
|
+
onSubmit: () => void;
|
|
21
|
+
};
|
|
22
|
+
declare type Props = {
|
|
23
|
+
children: JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
export declare const ReviewContextProvider: ({ children }: Props) => JSX.Element;
|
|
26
|
+
export declare const useReviewContext: () => State;
|
|
27
|
+
export {};
|