fuse-importer 0.1.2-testing → 0.1.4-testing

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/esm/Importer/ImporterWithContext.d.ts +2 -0
  2. package/lib/esm/Importer/ImporterWithContext.js +12 -8
  3. package/lib/esm/Importer/Matcher/index.js +0 -11
  4. package/lib/esm/Importer/Review/ReviewContextProvider.js +55 -14
  5. package/lib/esm/Importer/Stepper/common/getEnumFieldValueMatchingsInitialValue.js +7 -4
  6. package/lib/esm/Importer/Stepper/index.js +61 -2
  7. package/lib/esm/Importer/Uploader/DragAndDropImporter/ImporterDropzone.js +19 -11
  8. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/filterMethods.js +2 -9
  9. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.d.ts +2 -3
  10. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/index.js +66 -15
  11. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/useSpreadsheetFilter.d.ts +1 -1
  12. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/utils.d.ts +1 -0
  13. package/lib/esm/Importer/common/Spreadsheet/SpreadsheetContextProvider/utils.js +7 -0
  14. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetData.js +2 -2
  15. package/lib/esm/Importer/common/Spreadsheet/components/SpreadsheetRowCheckboxes.js +1 -7
  16. package/lib/esm/Importer/common/Spreadsheet/components/fields/SpreadsheetInput.js +1 -1
  17. package/lib/esm/Importer/common/Spreadsheet/components/fields/index.js +16 -15
  18. package/lib/esm/Importer/common/Spreadsheet/hooks.d.ts +1 -2
  19. package/lib/esm/Importer/common/Spreadsheet/hooks.js +21 -39
  20. package/lib/esm/Importer/common/Spreadsheet/transformation/transformators.js +1 -25
  21. package/lib/esm/Importer/contexts/ImporterContextProvider.d.ts +3 -3
  22. package/lib/esm/Importer/contexts/ImporterContextProvider.js +31 -20
  23. package/lib/esm/common/Table/TableActions/CustomActions/CustomActions.js +81 -31
  24. package/lib/esm/common/Table/TableActions/DeleteSelectedRows.js +9 -1
  25. package/lib/esm/common/Table/TableActions/RowFilters.js +10 -6
  26. package/lib/esm/common/columnsTransformations.js +0 -8
  27. package/lib/esm/common/datePatterns.js +10 -10
  28. package/lib/esm/common/inputs/SelectMenu.js +6 -2
  29. package/lib/esm/common/inputs/TextInput.js +1 -1
  30. package/lib/esm/locales/de.d.ts +2 -1
  31. package/lib/esm/locales/de.js +2 -1
  32. package/lib/esm/locales/en.d.ts +2 -1
  33. package/lib/esm/locales/en.js +2 -1
  34. package/lib/esm/locales/es.d.ts +2 -1
  35. package/lib/esm/locales/es.js +2 -1
  36. package/lib/esm/locales/fr.d.ts +2 -1
  37. package/lib/esm/locales/fr.js +2 -1
  38. package/lib/esm/types.d.ts +17 -5
  39. package/lib/esm/types.js +0 -1
  40. package/lib/main.js +24 -24
  41. package/package.json +1 -1
@@ -43,14 +43,6 @@ export var datePatterns = [
43
43
  value: "yy/MM/dd",
44
44
  label: "yy/MM/dd (e.g. 23/08/31)",
45
45
  },
46
- {
47
- value: "EEEE MMMM yyyy",
48
- label: "Day MMMM Year (e.g. Tuesday August 2023)",
49
- },
50
- {
51
- value: "EEEE dd MMMM yyyy",
52
- label: "Day Day-of-Month Month Year (e.g. Tuesday 08 August 2023)",
53
- },
54
46
  {
55
47
  value: "MM-dd-yy",
56
48
  label: "MM-dd-yy (e.g. 01-15-90)",
@@ -61,7 +53,7 @@ export var datePatterns = [
61
53
  },
62
54
  {
63
55
  value: "dd-MM-yy",
64
- label: "dd-MM-yy (e.g. 15-01-90)",
56
+ label: "dd-MM-yy (e.g. 15-01-90)",
65
57
  },
66
58
  {
67
59
  value: "dd-MM-yyyy",
@@ -167,6 +159,14 @@ export var datePatterns = [
167
159
  value: "EEE, MMM dd, yyyy",
168
160
  label: "EEE, MMM dd, yyyy (e.g. Mon, Jan 15, 1990)",
169
161
  },
162
+ {
163
+ value: "EEEE MMMM yyyy",
164
+ label: "Day MMMM Year (e.g. Tuesday August 2023)",
165
+ },
166
+ {
167
+ value: "EEEE dd MMMM yyyy",
168
+ label: "Day Day-of-Month Month Year (e.g. Tuesday 08 August 2023)",
169
+ },
170
170
  ];
171
171
  export var dateTimePatterns = [
172
172
  {
@@ -317,7 +317,7 @@ export var timePatterns = [
317
317
  },
318
318
  {
319
319
  value: "hh:mm:ss a",
320
- label: "hh:mm:ss a (e.g. 01:30:45 PM)",
320
+ label: "hh:mm:ss a (e.g. 01:30:45 PM)",
321
321
  },
322
322
  ];
323
323
  export var allowedPatterns = {
@@ -35,6 +35,7 @@ export var SelectMenuScrollArea = styled(Div)(function (_a) {
35
35
  var _b = _a.theme, colors = _b.colors, c = _b.css;
36
36
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 16px;\n overflow-y: auto;\n max-height: 250px;\n ", ";\n "], ["\n padding: 16px;\n overflow-y: auto;\n max-height: 250px;\n ", ";\n "])), function (p) { return p.theme.css.scrollbarDark; });
37
37
  });
38
+ var isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
38
39
  export var SelectMenu = function (_a) {
39
40
  var _b;
40
41
  var _c = _a.isOpen, isOpen = _c === void 0 ? false : _c, _d = _a.onClose, onClose = _d === void 0 ? null : _d, _e = _a.placement, placement = _e === void 0 ? "auto" : _e, referenceElement = _a.referenceElement, children = _a.children, selectMenuClassName = _a.selectMenuClassName, props = __rest(_a, ["isOpen", "onClose", "placement", "referenceElement", "children", "selectMenuClassName"]);
@@ -42,7 +43,10 @@ export var SelectMenu = function (_a) {
42
43
  var _g = useState(null), width = _g[0], setWidth = _g[1];
43
44
  var options = {
44
45
  placement: placement,
45
- strategy: "absolute",
46
+ // On Firefox we use absolute positioning because fixed positioning
47
+ // doesn't seem to work well with the select menu (more info in PR)
48
+ // may be related to https://github.com/floating-ui/floating-ui/issues/1729
49
+ strategy: isFirefox ? "absolute" : "fixed",
46
50
  modifiers: [
47
51
  {
48
52
  name: "offset",
@@ -69,6 +73,6 @@ export var SelectMenu = function (_a) {
69
73
  if (referenceElement)
70
74
  setWidth(referenceElementWidth);
71
75
  }, [referenceElementWidth]);
72
- return (_jsx(_Fragment, { children: isOpen && (_jsxs(Div, __assign({ pRelative: true }, props, { children: [_jsx(SelectMenuBackdrop, { onClick: onClose }), _jsx(SelectMenuDiv, __assign({ ref: setPopperElement, style: __assign(__assign({}, styles.popper), { width: width }), className: selectMenuClassName }, attributes.popper, { children: _jsx(SelectMenuScrollArea, { children: children }) }))] }))) }));
76
+ return (_jsx(_Fragment, { children: isOpen && (_jsxs(Div, __assign({}, props, { children: [_jsx(SelectMenuBackdrop, { onClick: onClose }), _jsx(SelectMenuDiv, __assign({ ref: setPopperElement, style: __assign(__assign({}, styles.popper), { width: width }), className: selectMenuClassName }, attributes.popper, { children: _jsx(SelectMenuScrollArea, { children: children }) }))] }))) }));
73
77
  };
74
78
  var templateObject_1, templateObject_2, templateObject_3;
@@ -63,7 +63,7 @@ var TextInput = function (_a) {
63
63
  id: id,
64
64
  padding: padding,
65
65
  name: name,
66
- }, { type: isPasswordVisible ? "text" : type, value: _value || "", onChange: function (_a) {
66
+ }, { autoComplete: "off", type: isPasswordVisible ? "text" : type, value: _value || "", onChange: function (_a) {
67
67
  var value = _a.target.value;
68
68
  return set_Value(value);
69
69
  }, ref: setInputRef, onBlur: function () {
@@ -57,8 +57,9 @@ declare const _default: {
57
57
  table_actions: {
58
58
  filters_by_rows: {
59
59
  all_rows: string;
60
- valid_rows: string;
61
60
  invalid_rows: string;
61
+ duplicates: string;
62
+ duplicates_deleted: string;
62
63
  };
63
64
  search_rows: {
64
65
  tooltip: string;
@@ -58,8 +58,9 @@ export default {
58
58
  table_actions: {
59
59
  filters_by_rows: {
60
60
  all_rows: "Alle Zeilen",
61
- valid_rows: "Gültige Zeilen",
62
61
  invalid_rows: "Ungültige Zeilen",
62
+ duplicates: "Gültige",
63
+ duplicates_deleted: "{{count}} duplikate gelöscht",
63
64
  },
64
65
  search_rows: {
65
66
  tooltip: "Etwas suchen",
@@ -57,8 +57,9 @@ declare const _default: {
57
57
  table_actions: {
58
58
  filters_by_rows: {
59
59
  all_rows: string;
60
- valid_rows: string;
61
60
  invalid_rows: string;
61
+ duplicates: string;
62
+ duplicates_deleted: string;
62
63
  };
63
64
  search_rows: {
64
65
  tooltip: string;
@@ -58,8 +58,9 @@ export default {
58
58
  table_actions: {
59
59
  filters_by_rows: {
60
60
  all_rows: "All Rows",
61
- valid_rows: "Valid Rows",
62
61
  invalid_rows: "Invalid Rows",
62
+ duplicates: "Duplicates",
63
+ duplicates_deleted: "{{count}} duplicates deleted",
63
64
  },
64
65
  search_rows: {
65
66
  tooltip: "Search something",
@@ -57,8 +57,9 @@ declare const _default: {
57
57
  table_actions: {
58
58
  filters_by_rows: {
59
59
  all_rows: string;
60
- valid_rows: string;
61
60
  invalid_rows: string;
61
+ duplicates: string;
62
+ duplicates_deleted: string;
62
63
  };
63
64
  search_rows: {
64
65
  tooltip: string;
@@ -58,8 +58,9 @@ export default {
58
58
  table_actions: {
59
59
  filters_by_rows: {
60
60
  all_rows: "Todas las Filas",
61
- valid_rows: "Filas Válidas",
62
61
  invalid_rows: "Filas Inválidas",
62
+ duplicates: "Duplicadas",
63
+ duplicates_deleted: "{{count}} duplicados eliminados",
63
64
  },
64
65
  search_rows: {
65
66
  tooltip: "Buscar algo",
@@ -57,8 +57,9 @@ declare const _default: {
57
57
  table_actions: {
58
58
  filters_by_rows: {
59
59
  all_rows: string;
60
- valid_rows: string;
61
60
  invalid_rows: string;
61
+ duplicates: string;
62
+ duplicates_deleted: string;
62
63
  };
63
64
  search_rows: {
64
65
  tooltip: string;
@@ -58,8 +58,9 @@ export default {
58
58
  table_actions: {
59
59
  filters_by_rows: {
60
60
  all_rows: "Toutes les lignes",
61
- valid_rows: "Lignes valides",
62
61
  invalid_rows: "Lignes invalides",
62
+ duplicates: "Doublons",
63
+ duplicates_deleted: "{{count}} doublons supprimés",
63
64
  },
64
65
  search_rows: {
65
66
  tooltip: "Rechercher quelque chose",
@@ -15,6 +15,7 @@ export type ImporterOptions = {
15
15
  disableSubmitIfInvalid?: boolean;
16
16
  records?: Record[];
17
17
  language?: string;
18
+ modal?: boolean;
18
19
  } & SpreadsheetOptions;
19
20
  export declare enum FieldTypes {
20
21
  boolean = "boolean",
@@ -83,8 +84,8 @@ export declare const validationTypesBase: readonly ["cannot_contain", "contain",
83
84
  export declare const mutableValidationTypes: ("boolean" | "max_length" | "min_length" | "cannot_contain" | "contain" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex" | "integer" | "less_than" | "greater_than" | "even" | "odd" | "float" | "email" | "url" | "before_date" | "after_date")[];
84
85
  export type ValidationTypes = typeof validationTypesBase[number];
85
86
  export type TransformationOptionKeys = "prefix" | "number_of_decimals";
86
- export declare const transformationTypesBase: readonly ["sentence_case", "capitalize", "uppercase", "lowercase", "trim_whitespace", "autoformat", "prefix", "number_of_decimals", "round", "floor", "ceiling", "autodetect"];
87
- export declare const mutableTransformationTypes: ("prefix" | "number_of_decimals" | "sentence_case" | "capitalize" | "uppercase" | "lowercase" | "trim_whitespace" | "autoformat" | "round" | "floor" | "ceiling" | "autodetect")[];
87
+ export declare const transformationTypesBase: readonly ["sentence_case", "capitalize", "uppercase", "lowercase", "trim_whitespace", "autoformat", "prefix", "number_of_decimals", "round", "floor", "ceiling"];
88
+ export declare const mutableTransformationTypes: ("prefix" | "number_of_decimals" | "sentence_case" | "capitalize" | "uppercase" | "lowercase" | "trim_whitespace" | "autoformat" | "round" | "floor" | "ceiling")[];
88
89
  export type TransformationTypes = typeof transformationTypesBase[number];
89
90
  export interface FieldValidation {
90
91
  id?: number;
@@ -113,8 +114,10 @@ export type TemplateHeader = {
113
114
  validations: FieldValidation[];
114
115
  transformations: FieldTransformation[];
115
116
  position: number;
117
+ id?: number;
118
+ archived?: boolean;
116
119
  };
117
- type CARecordFn = (record: Record) => Record;
120
+ type CARecordFn = (record: Record) => Promise<Record> | Record;
118
121
  export type CustomActionTypes = "record";
119
122
  type CustomActionHandler<T extends CustomActionTypes> = T extends "record" ? CARecordFn : never;
120
123
  export type CustomAction<T extends CustomActionTypes = CustomActionTypes> = {
@@ -139,6 +142,11 @@ export type Integration = {
139
142
  active: boolean;
140
143
  provider: string;
141
144
  };
145
+ export type ColumnMapping = {
146
+ matched_column_name: string;
147
+ template_column_name: string;
148
+ id?: number;
149
+ };
142
150
  export type TemplateInfo = {
143
151
  columns: TemplateHeader[];
144
152
  integrations: Integration[];
@@ -146,6 +154,7 @@ export type TemplateInfo = {
146
154
  organization: Organization;
147
155
  name: string;
148
156
  preview_first_time: boolean;
157
+ column_mappings_attributes?: ColumnMapping[];
149
158
  };
150
159
  export type Field = {
151
160
  name: string;
@@ -166,7 +175,7 @@ export type ColumnRequiredProps<T extends FieldTypesAsUnion> = Partial<Pick<Temp
166
175
  transformations?: ColumnTransformations<T>[];
167
176
  } & (T extends "enum" ? EnumOptions : T extends "time" ? TimeOptions : OtherOptions);
168
177
  export type ValidationTypesRules<T extends FieldTypesAsUnion> = T extends "integer" ? IntegerValidationRule : T extends "float" ? FloatValidationRule : T extends "string" ? StringValidationRule : T extends "email" ? EmailValidationRule : T extends "enum" ? EnumValidationRule : T extends "url" ? UrlValidationRule : T extends "boolean" ? BooleanValidationRule : T extends "date" ? DateValidationRule : T extends "datetime" ? DateTimeValidationRule : T extends "time" ? TimeValidationRule : never;
169
- export type TransformationTypesRules<T extends FieldTypesAsUnion> = T extends "integer" ? IntegerTransformationRule : T extends "float" ? FloatTransformationRule : T extends "string" ? StringTransformationRule : T extends "enum" ? EnumTransformationRule : T extends "url" ? UrlTransformationRule : T extends "date" | "datetime" | "time" ? DateDateTimesAndTimesTransformationRule : never;
178
+ export type TransformationTypesRules<T extends FieldTypesAsUnion> = T extends "integer" ? IntegerTransformationRule : T extends "float" ? FloatTransformationRule : T extends "string" ? StringTransformationRule : T extends "url" ? UrlTransformationRule : T extends "date" | "datetime" | "time" ? DateDateTimesAndTimesTransformationRule : never;
170
179
  export type ValidationTypeOptions<T extends ValidationTypesRules<FieldTypesAsUnion>> = T extends "cannot_contain" | "contain" | "regex" ? {
171
180
  pattern: string;
172
181
  } : T extends "max_length" ? {
@@ -211,7 +220,6 @@ type FloatValidationRule = "less_than" | "greater_than" | "even" | "odd" | "uniq
211
220
  type FloatTransformationRule = "number_of_decimals";
212
221
  type EmailValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
213
222
  type EnumValidationRule = "unique_case_sensitive" | "unique_case_insensitive";
214
- type EnumTransformationRule = "autodetect";
215
223
  type UrlValidationRule = "cannot_contain" | "contain" | "max_length" | "min_length" | "length_exactly" | "unique_case_sensitive" | "unique_case_insensitive" | "regex";
216
224
  type UrlTransformationRule = "prefix";
217
225
  type BooleanValidationRule = "boolean";
@@ -219,4 +227,8 @@ type DateValidationRule = "unique_case_sensitive" | "unique_case_insensitive" |
219
227
  type DateTimeValidationRule = "unique_case_sensitive" | "unique_case_insensitive" | "before_date" | "after_date";
220
228
  type TimeValidationRule = "unique_case_sensitive" | "unique_case_insensitive";
221
229
  type DateDateTimesAndTimesTransformationRule = "autoformat";
230
+ export type DuplicateRecords = {
231
+ records: Record;
232
+ count: number;
233
+ };
222
234
  export {};
package/lib/esm/types.js CHANGED
@@ -60,6 +60,5 @@ export var transformationTypesBase = [
60
60
  "round",
61
61
  "floor",
62
62
  "ceiling",
63
- "autodetect",
64
63
  ];
65
64
  export var mutableTransformationTypes = __spreadArray([], transformationTypesBase, true);