fuse-importer 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/Importer/ImporterContextProvider.d.ts +3 -3
- package/lib/esm/Importer/ImporterContextProvider.js +3 -3
- package/lib/esm/Importer/SpreadsheetReviewContextProvider.js +2 -2
- package/lib/esm/Importer/Stepper.js +2 -2
- package/lib/esm/Importer/TrialModeBanner.js +1 -1
- package/lib/esm/Importer/index.d.ts +3 -4
- package/lib/esm/Importer/index.js +2 -2
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +3 -3
- package/lib/main.js +1 -1
- package/package.json +2 -3
|
@@ -39,7 +39,7 @@ declare type State = {
|
|
|
39
39
|
matcherSubstep: number;
|
|
40
40
|
setMatcherSubstep: React.Dispatch<number>;
|
|
41
41
|
uploadedDataEnumFieldValues: UploadedDataEnumFieldValues;
|
|
42
|
-
|
|
42
|
+
templateSlug: string;
|
|
43
43
|
apiToken: string;
|
|
44
44
|
inTrialMode: boolean;
|
|
45
45
|
onClose: () => void;
|
|
@@ -47,7 +47,7 @@ declare type State = {
|
|
|
47
47
|
importerOptions: ImporterOptions;
|
|
48
48
|
};
|
|
49
49
|
declare type Props = {
|
|
50
|
-
|
|
50
|
+
templateSlug: string;
|
|
51
51
|
apiToken: string;
|
|
52
52
|
options: ImporterOptions;
|
|
53
53
|
onClose: () => void;
|
|
@@ -55,6 +55,6 @@ declare type Props = {
|
|
|
55
55
|
onValidateRecord?: OnValidateRecord;
|
|
56
56
|
onValidateBatch?: OnValidateBatch;
|
|
57
57
|
};
|
|
58
|
-
export declare const ImporterContextProvider: ({
|
|
58
|
+
export declare const ImporterContextProvider: ({ templateSlug, apiToken, children, options, onClose, onValidateBatch, onValidateRecord, }: Props) => JSX.Element;
|
|
59
59
|
export declare const useImporterContext: () => State;
|
|
60
60
|
export {};
|
|
@@ -57,7 +57,7 @@ export var fusejsOptions = {
|
|
|
57
57
|
};
|
|
58
58
|
var ImporterContext = createContext({});
|
|
59
59
|
export var ImporterContextProvider = function (_a) {
|
|
60
|
-
var
|
|
60
|
+
var templateSlug = _a.templateSlug, apiToken = _a.apiToken, children = _a.children, options = _a.options, onClose = _a.onClose, onValidateBatch = _a.onValidateBatch, onValidateRecord = _a.onValidateRecord;
|
|
61
61
|
var _b = useState(0), currentStepIndex = _b[0], setCurrentStepIndex = _b[1];
|
|
62
62
|
var _c = useState(0), matcherSubstep = _c[0], setMatcherSubstep = _c[1];
|
|
63
63
|
var _d = useState(null), templateError = _d[0], setTemplateError = _d[1];
|
|
@@ -102,7 +102,7 @@ export var ImporterContextProvider = function (_a) {
|
|
|
102
102
|
switch (_c.label) {
|
|
103
103
|
case 0:
|
|
104
104
|
_c.trys.push([0, 2, , 3]);
|
|
105
|
-
return [4 /*yield*/, fuseApi.get("/api/v1/importer/templates/".concat(
|
|
105
|
+
return [4 /*yield*/, fuseApi.get("/api/v1/importer/templates/".concat(templateSlug))];
|
|
106
106
|
case 1:
|
|
107
107
|
data = (_c.sent()).data;
|
|
108
108
|
setTemplateHeaders(data.columns);
|
|
@@ -157,7 +157,7 @@ export var ImporterContextProvider = function (_a) {
|
|
|
157
157
|
matcherSubstep: matcherSubstep,
|
|
158
158
|
setMatcherSubstep: setMatcherSubstep,
|
|
159
159
|
apiToken: apiToken,
|
|
160
|
-
|
|
160
|
+
templateSlug: templateSlug,
|
|
161
161
|
inTrialMode: inTrialMode,
|
|
162
162
|
onClose: onClose,
|
|
163
163
|
fuseApi: fuseApi,
|
|
@@ -57,7 +57,7 @@ export var SpreadsheetReviewContextProvider = function (_a) {
|
|
|
57
57
|
var _c = useState(null), reviewedData = _c[0], setReviewedData = _c[1];
|
|
58
58
|
var _d = useState(null), submittedData = _d[0], setSubmittedData = _d[1];
|
|
59
59
|
var _e = useState(null), appResponse = _e[0], setAppResponse = _e[1];
|
|
60
|
-
var _f = useImporterContext(),
|
|
60
|
+
var _f = useImporterContext(), templateSlug = _f.templateSlug, fuseApi = _f.fuseApi;
|
|
61
61
|
var getImportWasSuccessful = function (response) {
|
|
62
62
|
return !response.errors || !Object.keys(response.errors).length;
|
|
63
63
|
};
|
|
@@ -69,7 +69,7 @@ export var SpreadsheetReviewContextProvider = function (_a) {
|
|
|
69
69
|
trackImportedRowsCount = function (rowCount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
70
|
return __generator(this, function (_a) {
|
|
71
71
|
switch (_a.label) {
|
|
72
|
-
case 0: return [4 /*yield*/, fuseApi.post("/api/v1/importer/templates/".concat(
|
|
72
|
+
case 0: return [4 /*yield*/, fuseApi.post("/api/v1/importer/templates/".concat(templateSlug, "/imports"), {
|
|
73
73
|
row_count: rowCount,
|
|
74
74
|
})];
|
|
75
75
|
case 1:
|
|
@@ -119,7 +119,7 @@ var Stepper = function (_a) {
|
|
|
119
119
|
setStep();
|
|
120
120
|
setIsUnmatchedHeadersModalOpen(false);
|
|
121
121
|
};
|
|
122
|
-
var unmatchedHeadersModalUI = (_jsx(Modal, __assign({ isOpen: isUnmatchedHeadersModalOpen, onClose: function () { return setIsUnmatchedHeadersModalOpen(false); } }, { children: _jsxs(Div, __assign({ p: "17px 20px" }, { children: [_jsx(Div, __assign({ textAlignCenter: true, mb: 24, mt: 5 }, { children: errorIcon }), void 0), _jsx(Div, __assign({ textAlignCenter: true,
|
|
122
|
+
var unmatchedHeadersModalUI = (_jsx(Modal, __assign({ isOpen: isUnmatchedHeadersModalOpen, onClose: function () { return setIsUnmatchedHeadersModalOpen(false); } }, { children: _jsxs(Div, __assign({ p: "17px 20px" }, { children: [_jsx(Div, __assign({ textAlignCenter: true, mb: 24, mt: 5 }, { children: errorIcon }), void 0), _jsx(Div, __assign({ textAlignCenter: true, h5: true }, { children: "Unmatched Column Headers" }), void 0), _jsxs(Div, __assign({ w: 448, mt: 12, textAlignCenter: true, body1: true }, { children: [unmatchedHeadersCount === 1 ? "There is " : "There are ", unmatchedHeadersCount, " unmatched column headers. You will have to fill these out manually if you proceed."] }), void 0), _jsxs(Div, __assign({ dflex: true, centered: true, mt: 40 }, { children: [_jsx(Button, __assign({ variant: "secondary", onClick: function () { return setIsUnmatchedHeadersModalOpen(false); }, w: 160, mr: 16 }, { children: "Assign Headers" }), void 0), _jsx(Button, __assign({ w: 83, variant: "primary", onClick: skipStep }, { children: "Skip" }), void 0)] }), void 0)] }), void 0) }), void 0));
|
|
123
123
|
var isMatchStep = currentStepIndex === 1;
|
|
124
124
|
var isReviewStep = currentStepIndex === 2;
|
|
125
125
|
var leftButtonUI = (_jsx(Div, __assign({ w: 100 }, { children: currentStepIndex > 0 && !appResponse && (_jsx(Button, __assign({ variant: "secondary", onClick: goBack }, { children: "Go back" }), void 0)) }), void 0));
|
|
@@ -140,5 +140,5 @@ var submitSvg = (_jsxs("svg", __assign({ width: 64, height: 64, fill: "none", xm
|
|
|
140
140
|
} }, void 0), _jsx("rect", { x: 38.727, y: 44.871, width: 17.915, height: 35.878, rx: 2, transform: "rotate(131.582 38.727 44.87)", fill: "url(#b)", style: {
|
|
141
141
|
mixBlendMode: "darken",
|
|
142
142
|
} }, void 0), _jsxs("defs", { children: [_jsxs("linearGradient", __assign({ id: "a", x1: 18.672, y1: 47.198, x2: 37.603, y2: 58.473, gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#D0A617" }, void 0), _jsx("stop", { offset: 1, stopColor: "#FEE18F" }, void 0)] }), void 0), _jsxs("linearGradient", __assign({ id: "b", x1: 47.684, y1: 44.871, x2: 36.123, y2: 89.527, gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#6BEEFF" }, void 0), _jsx("stop", { offset: 1, stopColor: "#08CABE" }, void 0)] }), void 0)] }, void 0)] }), void 0));
|
|
143
|
-
var errorIcon = (_jsxs("svg", __assign({ width: "
|
|
143
|
+
var errorIcon = (_jsxs("svg", __assign({ width: "68", height: "68", viewBox: "0 0 68 68", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsxs("g", __assign({ clipPath: "url(#clip0_1052_34495)" }, { children: [_jsx("rect", { width: "68", height: "68", fill: "white" }, void 0), _jsx("g", __assign({ style: { mixBlendMode: "multiply" } }, { children: _jsx("path", { d: "M28.5668 8.05854C29.6943 6.10577 32.5129 6.10576 33.6403 8.05854L59.1466 52.2368C60.274 54.1895 58.8648 56.6305 56.6099 56.6305H5.59726C3.34239 56.6305 1.93309 54.1895 3.06053 52.2368L28.5668 8.05854Z", fill: "url(#paint0_linear_1052_34495)" }, void 0) }), void 0), _jsx("g", __assign({ style: { mixBlendMode: "multiply" } }, { children: _jsx("path", { d: "M34.4375 9.68867C35.5649 7.73589 38.3835 7.73589 39.511 9.68867L65.816 55.2503C66.9434 57.2031 65.5341 59.6441 63.2793 59.6441H10.6692C8.41432 59.6441 7.00502 57.2031 8.13246 55.2503L34.4375 9.68867Z", fill: "url(#paint1_linear_1052_34495)" }, void 0) }), void 0), _jsx("rect", { x: "29.0371", y: "21.2632", width: "6.43183", height: "21.3972", rx: "2.92916", fill: "#FFFDF8" }, void 0), _jsx("rect", { x: "29.0371", y: "44.7898", width: "6.43183", height: "5.61436", rx: "2.80718", fill: "#FFFDF8" }, void 0)] }), void 0), _jsxs("defs", { children: [_jsxs("linearGradient", __assign({ id: "paint0_linear_1052_34495", x1: "10.0099", y1: "28.8136", x2: "30.2646", y2: "54.4823", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#FD5C39" }, void 0), _jsx("stop", { offset: "1", stopColor: "#FFB869" }, void 0)] }), void 0), _jsxs("linearGradient", __assign({ id: "paint1_linear_1052_34495", x1: "18.8007", y1: "74.0811", x2: "85.2567", y2: "33.8684", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#E7C551" }, void 0), _jsx("stop", { offset: "1", stopColor: "#FEE18F" }, void 0)] }), void 0), _jsx("clipPath", __assign({ id: "clip0_1052_34495" }, { children: _jsx("rect", { width: "68", height: "68", fill: "white" }, void 0) }), void 0)] }, void 0)] }), void 0));
|
|
144
144
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -16,7 +16,7 @@ import { Div, Span } from "../styled/utils";
|
|
|
16
16
|
import { useImporterContext } from "./ImporterContextProvider";
|
|
17
17
|
export var TrialModeBanner = function () {
|
|
18
18
|
var inTrialMode = useImporterContext().inTrialMode;
|
|
19
|
-
return (_jsx(_Fragment, { children: inTrialMode && (_jsxs(Div, __assign({ bg: theme.colors.orange100, h: 80, dflex: true, alignCenter: true, justifyCenter: true }, { children: [_jsx(Div, __assign({ ml: 33, mr: 8 }, { children: exclamationPointIcon }), void 0), _jsx(Span, __assign({ mr: 16 }, { children: "You're currently in
|
|
19
|
+
return (_jsx(_Fragment, { children: inTrialMode && (_jsxs(Div, __assign({ bg: theme.colors.orange100, h: 80, dflex: true, alignCenter: true, justifyCenter: true }, { children: [_jsx(Div, __assign({ ml: 33, mr: 8 }, { children: exclamationPointIcon }), void 0), _jsx(Span, __assign({ mr: 16 }, { children: "You're currently in Trial mode. Subscribe to a plan to deploy to your website." }), void 0), _jsx(Button, __assign({ w: 120, br: 8, variant: "secondary", onClick: function () {
|
|
20
20
|
window.location.href = "".concat(process.env.REACT_APP_API_BASE_URL, "/account/billing");
|
|
21
21
|
} }, { children: "Select plan" }), void 0)] }), void 0)) }, void 0));
|
|
22
22
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { OnSubmit, OnValidateBatch, OnValidateRecord } from "../types";
|
|
3
|
-
import { ImporterOptions } from "../types";
|
|
2
|
+
import { ImporterOptions, OnSubmit, OnValidateBatch, OnValidateRecord } from "../types";
|
|
4
3
|
declare type LayoutProps = {
|
|
5
4
|
zIndex: number;
|
|
6
5
|
};
|
|
7
6
|
export declare const Layout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../styled/utils").CSSProps & LayoutProps, never>;
|
|
8
7
|
declare type Props = {
|
|
9
|
-
|
|
8
|
+
templateSlug: string;
|
|
10
9
|
apiToken: string;
|
|
11
10
|
options: ImporterOptions;
|
|
12
11
|
onValidateRecord?: OnValidateRecord;
|
|
@@ -14,7 +13,7 @@ declare type Props = {
|
|
|
14
13
|
onSubmit?: OnSubmit;
|
|
15
14
|
onClose: any;
|
|
16
15
|
};
|
|
17
|
-
declare const Importer: ({
|
|
16
|
+
declare const Importer: ({ templateSlug, apiToken, onSubmit, onValidateRecord, onValidateBatch, options, onClose, }: Props) => JSX.Element;
|
|
18
17
|
export * from "./common/Spreadsheet";
|
|
19
18
|
export * from "./common/utils";
|
|
20
19
|
export * from "./SpreadsheetReviewContextProvider";
|
|
@@ -50,11 +50,11 @@ var steps = [
|
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
52
|
var Importer = function (_a) {
|
|
53
|
-
var
|
|
53
|
+
var templateSlug = _a.templateSlug, apiToken = _a.apiToken, onSubmit = _a.onSubmit, onValidateRecord = _a.onValidateRecord, onValidateBatch = _a.onValidateBatch, options = _a.options, onClose = _a.onClose;
|
|
54
54
|
useFullscreenOverlay();
|
|
55
55
|
return (_jsx(ImporterContextProvider, __assign({}, {
|
|
56
56
|
options: options,
|
|
57
|
-
|
|
57
|
+
templateSlug: templateSlug,
|
|
58
58
|
apiToken: apiToken,
|
|
59
59
|
onValidateRecord: onValidateRecord,
|
|
60
60
|
onValidateBatch: onValidateBatch,
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EnvironmentType, ImporterOptions, OnSubmit, OnValidateBatch, OnValidateRecord } from "./types";
|
|
2
2
|
declare class FuseImporter {
|
|
3
3
|
apiToken: string;
|
|
4
|
-
|
|
4
|
+
templateSlug: string;
|
|
5
5
|
env: EnvironmentType;
|
|
6
6
|
zIndex: number;
|
|
7
7
|
options: ImporterOptions;
|
|
8
|
-
constructor(apiToken: string,
|
|
8
|
+
constructor(apiToken: string, templateSlug: string, options?: ImporterOptions);
|
|
9
9
|
onValidateRecord: OnValidateRecord;
|
|
10
10
|
onValidateBatch: OnValidateBatch;
|
|
11
11
|
onSubmit: OnSubmit;
|
package/lib/esm/index.js
CHANGED
|
@@ -14,10 +14,10 @@ import ReactDOM from "react-dom";
|
|
|
14
14
|
import { Importer } from "./Importer";
|
|
15
15
|
import { fuseImporterId } from "./common";
|
|
16
16
|
var FuseImporter = /** @class */ (function () {
|
|
17
|
-
function FuseImporter(apiToken,
|
|
17
|
+
function FuseImporter(apiToken, templateSlug, options) {
|
|
18
18
|
if (options === void 0) { options = {}; }
|
|
19
19
|
this.apiToken = apiToken;
|
|
20
|
-
this.
|
|
20
|
+
this.templateSlug = templateSlug;
|
|
21
21
|
this.options = __assign({ env: "production", zIndex: 1000, batchValidationDelayMs: 500 }, options);
|
|
22
22
|
}
|
|
23
23
|
FuseImporter.prototype.close = function () {
|
|
@@ -34,7 +34,7 @@ var FuseImporter = /** @class */ (function () {
|
|
|
34
34
|
document.body.appendChild(div);
|
|
35
35
|
ReactDOM.render(React.createElement(Importer, {
|
|
36
36
|
apiToken: this.apiToken,
|
|
37
|
-
|
|
37
|
+
templateSlug: this.templateSlug,
|
|
38
38
|
options: this.options,
|
|
39
39
|
onValidateRecord: this.onValidateRecord,
|
|
40
40
|
onValidateBatch: this.onValidateBatch,
|